2013-06-05 26 views
-2

我有以下代码根据状态排序我的表信息。使用mysql数据库信息排序表的代码

$query = "SELECT * FROM affiliate_tasks WHERE username = '$_SESSION[username]'"; 

if(isset($_POST['sort-selection'] && $_POST['sort-selection'] != 'all')) 
{ 
    $query .= " AND status = '". $_POST['sort-selection']."';" ; 
} 

$result = mysqli_query($con, $query); 

当我运行网页,它给了我这个错误:60

Parse error: syntax error, unexpected T_BOOLEAN_AND, expecting ',' or ')' in /home/content/38/10473938/html/website/panda/affiliates/task.php on line 60 

线如下:

if(isset($_POST['sort-selection'] && $_POST['sort-selection'] != 'all')) { 

我无法弄清楚什么是错的代码任何帮助将不胜感激!

+1

您错位了'isset'的结尾')'。 – deceze

+0

为什么是-1?这是一个合法的问题 – user2371301

+0

这并不意味着它是一个很好的问题。 – deceze

回答

2

看起来好像你在该行的不对的地方得到了右括号..

if(isset($_POST['sort-selection'] && $_POST['sort-selection'] != 'all')) { 

应该

if(isset($_POST['sort-selection']) && $_POST['sort-selection'] != 'all') { 
0

。在你的右括号语法错误

if(isset($_POST['sort-selection']) && $_POST['sort-selection'] != 'all') 
           //^this one was missed and added at the end