0

这是警告:

用户警告:“where 子句”查询中的未知列“student2”:SELECT first, last, id FROM sgp_student_log WHERE username1 =student2 in .../public_html/includes/common.inc(1731) : eval()'d code on第 18 行。

这是代码:

<?
global $user;
$rus = db_query("SELECT first, last, id FROM {student_log} WHERE username1 =%s", $user->name); 
$ruw = db_fetch_array($rus);
print_r($ruw);
?>

当然,像下面这样的东西会起作用

<?
global $user;
$res = db_query("SELECT first, last, id FROM {student_log} WHERE username1 ='student2'"); 
$row = db_fetch_array($res);
print_r($row);
?>
4

0 回答 0