0

这段代码昨天工作正常,今天突然开始显示错误.. 显示带有个人资料图片的用户时,die('Error') 给出错误提前感谢您的帮助......我正在学习 php,所以将转换为 pdo之后

<?php
include("dbconfig.php");
// Create connection
$conn=mysql_connect($db_host,$username,$password) or die('Error1');;

mysql_select_db("motorklq_glmindb",$conn) or die('Error2');


$result = mysql_query("SELECT adno,fname,lname,profilepic,gscore FROM gtable WHERE contest!='on' ORDER BY gscore DESC  LIMIT 3") or die('Error');;

echo "<table><tr><th></th><th>gScore Leader</th><th></th><th></th></tr>";
echo "<tr><th>Firstname</th><th>Lastname</th><th>Image</th><th>Glamour</th></tr>";

while($row = mysql_fetch_array($result)){
    print "<tr><td>".$row['fname']."</td><td>".$row['lname']."</td><td>".'<img src="data:image/jpeg;base64,' . base64_encode( $row['profilepic'] ) . '"  width="32" height="32">'."</td><td>".$row['gscore']."</td></tr>";
}
print "</table>";
mysql_close($conn);
?>

链接到数据库https://www.dropbox.com/s/dv8vhla0fxhw2p7/db.png

4

3 回答 3

0

我认为您在选择查询中为idno输入了adno错误。

希望有帮助

于 2013-11-09T10:54:47.103 回答
0
SELECT adno,

改成

SELECT idno,
于 2013-11-09T10:56:05.917 回答
0

删除多余的;从查询

$conn=mysql_connect($db_host,$username,$password) or die('Error1');;
$result = mysql_query("SELECT adno,fname,lname,profilepic,gscore FROM gtable WHERE contest!='on' ORDER BY gscore DESC  LIMIT 3") or die('Error');;

$conn=mysql_connect($db_host,$username,$password) or die('Error1');
$result = mysql_query("SELECT idno,fname,lname,profilepic,gscore FROM gtable WHERE contest!='on' ORDER BY gscore DESC  LIMIT 3") or die('Error');
于 2013-11-09T10:56:43.983 回答