Todolist--(7)显示列表

list.php




计划页面


    
        ";
        $dbc=@mysqli_connect('127.0.0.1', 'root','123456','todolist') 
            or die('could not connect to mysql');
        mysqli_set_charset($dbc,'utf8');
       if($_SERVER['REQUEST_METHOD']=='POST'){
       if($_POST['orderhidden']=='a'){
        if(!empty($_POST['content'])){
            $content=$_POST['content'];
            $p="insert into listmessage (content ,user_id) values (\"$content\",\"{$_SESSION['user_id']}\")";
            @mysqli_query($dbc,$p);
            $r=mysqli_affected_rows($dbc);
            echo $r;
            if($r<=0)
                {
                echo "添加失败";
            }
        }else{
            echo"请添加内容";           
        } 
    }
    }
    if($_SERVER['REQUEST_METHOD']=='POST'){
        //if($_POST['orderhidden']=='b'){
    $list_id=$_POST['hidden'];
    $q="delete from listmessage where list_id='$list_id'";
    $r=mysqli_query($dbc,$q);
    if(!$r){
        echo"请重新点击删除";
        //echo mysqli_error($dbc);
    }
   // }   
    }
      $q="select content,list_id from listmessage where user_id={$_SESSION['user_id']}";
        $s=mysqli_query($dbc,$q);
        $num=mysqli_num_rows($s);
       if($s){
         //$order=0;
        
         echo'您有'.$num.'条计划';
         echo'
'; echo'您有'.$num.'个计划编码'; echo''; while($row=mysqli_fetch_array($s,MYSQLI_ASSOC)){ echo''; } echo''; echo'
'.$row['content']. '
内容:
'; } ?> 注销
更改密码
返回首页

此项目的完整代码可以到我的github,todolist进行下载。

你可能感兴趣的:(Todolist--(7)显示列表)