我可以遍历数据库结果并删除斜杠吗?
(每次我编辑文本并将其放回数据库时,我开始得到更多的斜线)
$db = new connection();
$query = "SELECT * FROM ITEMS, ALPACA_SALES WHERE ITEMS.uid = '$id' AND ALPACA_SALES.uid = ITEMS.uid";
$results = $db->query($query);
$data = array();
while($info = mysql_fetch_array($results))
{
$data[] = stripslashes($info);
}
但我收到以下错误:
Notice: Array to string conversion in /home/content/myfile.php on line 78
当我将数据添加到数据库时,我执行以下操作:
if (!empty($_POST['more_text']))
{
$more_text = addslashes($_POST['more_text']);
}
else
{
$error = false;
$error_message = "Please add a description.";
}
然后我使用 UPDATE 插入数据库:
$query2 = "UPDATE ALPACA_SALES SET more_text = '$more_text' WHERE uid = '$id'";
$result = $db->query($query2);