PHP查询数据库出错、
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->define("MYSQL_SERVER_NAME","localhost"); define("MYSQL_USERNAME","root"); define("MYSQL_PASSWORD",""); define("MYSQL_DATABASE","test"); define("TABLE_NAME","voicemail"); //连接数据库server地址,用户名,密码 $conn = mysql_connect(MYSQL_SERVER_NAME,MYSQL_USERNAME,MYSQL_PASSWORD) or die(" Sorry , Could not connect to MySQL server ! "); //选取database mysql_select_db(MYSQL_DATABASE,$conn) or die("select database fial !"); //php 要注意防注入 //转义在 【单引号、 双引号 、反斜杠、 NULL、】添加反斜杠 $uniqueid = addslashes($uniqueid); $sql = "select * from ".TABLE_NAME." where uniqueid ='$uniqueid'"; echo $sql; //取到结果集 $result = mysql_query($sql) or die("SQL query fail "); //游标 while($row = mysql_fetch_row($result)){ echo $row["billsec"]; } //关闭连接 mysql_close();