我的错误
您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在第1行查看“post,view FROM nbb_groups WHERE group_id ='1''附近使用正确的语法
$setting_query = mysql_query("SELECT * FROM nbb_settings");
$setting = mysql_fetch_array($setting_query);
if( isset( $id ) ) $group_id = userinfo($id,"group_id");
else $group_id = "4";
$groupinfo_query = mysql_query("SELECT acp,mod,post,view FROM nbb_groups WHERE
group_id = '$group_id'")or die (mysql_error());
$groupinfo_row = mysql_fetch_array($groupinfo_query);
$acpstatus = $groupinfo_row["acp"];
$modstatus = $groupinfo_row["mod"];
$poststatus = $groupinfo_row["post"];
$viewstatus = $groupinfo_row["view"];
答案 0 :(得分:1)
试试这个
$groupinfo_query = mysql_query("SELECT `acp`,`mod`,`post`,`view` FROM nbb_groups WHERE
group_id = '$group_id'")or die (mysql_error());
用`(反引号)
括起字段名称字段名称MOD是MYSQL中的保留字...
答案 1 :(得分:0)
mod
是mysql关键字。
MOD(N,M), N % M, N MOD M;
更改字段的名称。
参考:http://www.w3resource.com/mysql/mathematical-functions/mysql-mod-function.php
答案 2 :(得分:0)
示例Mysql查询:
<?php
$t=mysql_connect("localhost", "root", "")//Coonector
or die(mysql_error());
mysql_select_db("category")//Set DB name
or die(mysql_error());
$result = mysql_query("SELECT * FROM `nbb_settings` ORDER BY `id` DESC")
or die(mysql_error());
while ($rec = mysql_fetch_array($result)){
echo $rec['name']."<br>";
}
mysql_close($t);//Close Session
?>
请给我错误....