我知道在查询中运行 mysql_real_escape_string 时必须使用它,例如:
$ProjectHasReservationQuery = ("
SELECT *
FROM reservelist rl
INNER JOIN project p on rl.projectid = p.projectid
WHERE rl.projectid = ". mysql_real_escape_string($record['projectid']) ."
AND restype = 'res'
");
但是如何呼应它,例如:
query1 = mysql_query("SELECT * FROM users");
while ($record = mysql_fetch_array($query1 ))
{
echo "".stripslashes(mysql_real_escape_string($record['usersurname']))."";
// OR
echo "".$record['usersurname']."";
}
哪一个?我个人认为echo "".$record['usersurname']."";
,因为这是来自查询而不是进入。但要100%确定。
(我知道 PDO 和 mysqli)