require("includes/connect.php");
$result = mysql_query("SELECT * FROM entries", $link);
while ($row = mysql_fetch_array($result)) {
htmlentities($row['quotes']);
}
我想显示的数据是在数据库中,但我不断获取:mysql_real_escape_string()预计参数1是字符串
Warning: mysql_real_escape_string() expects parameter 1 to be string
这有什么错在上面的代码,导致问题?我对PHP很陌生,我正试图理解发生了什么以及为什么这样做。
connect.php
$link = mysql_connect("localhost", "root", "");
if (!$link) {
die("Could not connect to the db");
}
mysql_select_db("ENTRIES", $link);
(我工作的这个地方,所以用户名/密码真的并不重要,现在)
这不是上面的代码导致的问题,因为它没有'mysql_real_escape_string()'。除非它包含在'connect.php'文件中,在这种情况下,我们需要看到它。 – Mchl 2012-01-13 08:38:41
发布你的'connect.php'文件中的代码。 – Cyclonecode 2012-01-13 08:40:37
完成了,我试图使用mysql_real_escape_string(),但我做错了。我怎样才能正确地把它放入? – nowayyy 2012-01-13 08:42:17