I started learning php, I'm having some problems with this mysql query
我开始学习php,我对这个mysql查询有一些问题
mysql_query( "UPDATE boardinfo SET totalPostCount = '" . $GLOBALS['postCount'] + 1 . "' WHERE boardName = '" . $_POST['board'] )
Error: near '1' WHERE boardName = 'Site' at line 1
All I need to do here is to update the value of totalPostCount if it's boardName matches value from $_POST['board']
Please, go easy on me, I've only started this yesterday...
错误:接近'1'WHERE boardName ='Site'在第1行所有我需要做的是更新totalPostCount的值,如果它的boardName匹配来自$ _POST ['board'的值]请放轻松我,我'我们昨天才开始......
1 个解决方案
#1
0
In your statement, quotes are not closed in last.
在您的陈述中,报价最后没有结束。
mysql_query( "UPDATE boardinfo SET totalPostCount = '" .$GLOBALS['postCount'] + 1 . "' WHERE boardName = '" . $_POST['board']."'" )
If it doesn't solve your issue,try one more thing.
如果它无法解决您的问题,请再试一次。
$val = $GLOBALS['postCount'] + 1;
mysql_query( "UPDATE boardinfo SET totalPostCount = '" .$val . "' WHERE boardName = '" . $_POST['board']."'" )
Hope it will solve your problem
希望它能解决你的问题
#1
0
In your statement, quotes are not closed in last.
在您的陈述中,报价最后没有结束。
mysql_query( "UPDATE boardinfo SET totalPostCount = '" .$GLOBALS['postCount'] + 1 . "' WHERE boardName = '" . $_POST['board']."'" )
If it doesn't solve your issue,try one more thing.
如果它无法解决您的问题,请再试一次。
$val = $GLOBALS['postCount'] + 1;
mysql_query( "UPDATE boardinfo SET totalPostCount = '" .$val . "' WHERE boardName = '" . $_POST['board']."'" )
Hope it will solve your problem
希望它能解决你的问题