【问题标题】:mysqli_fetch_row() magic_quotes_runtime are deprecated since PHP 5.3mysqli_fetch_row() magic_quotes_runtime 自 PHP 5.3 起已弃用
【发布时间】:2014-01-02 12:57:48
【问题描述】:

我刚刚将代码从 mysql 转移到 mysqli,以下行是从代码中选择的,它不是一个完整的文件。测试了连接,它工作正常。 "$totalRows" 这个变量显示了一个计数,这意味着查询没有问题。但是"$row = mysqli_fetch_row($result);" 线路很麻烦。当执行到这一点时,它会抛出一条错误消息:

"Warning: mysqli_fetch_row() [function.mysqli-fetch-row]: magic_quotes_runtime are deprecated since PHP 5.3"

当我使用 mysql 时,相同的代码运行良好。如果能得到快速回复,我将不胜感激。

$query = "SELECT -------
WHERE
product.productid =" . $productid;

$productid = mysqli_real_escape_string(linkDb(), $productid);

$result = mysqli_query(linkDb(), $query);               
$totalRows = mysqli_num_rows($result);

$DetailsHTML = "";

if ($totalRows > 0) {   
    $productid = mysqli_real_escape_string(linkDb(), $productid);       
    $row = mysqli_fetch_row($result);

【问题讨论】:

标签: php mysqli row fetch


【解决方案1】:

试试这个

if (get_magic_quotes_runtime()) {
    $productid = stripslashes($productid); 
}

$productid = mysqli_real_escape_string(linkDb(), $productid);       
$row = mysqli_fetch_row($result);

【讨论】:

  • 将您的 php 版本升级到 5.4x 或在您当前的 php 版本中禁用 get_magic_quotes_runtime
【解决方案2】:

问题并没有我想的那么大。我正在研究代码的技术细节。我所做的只是关闭了一个魔术引号运行时,一切都得到了修复。

【讨论】:

    猜你喜欢
    • 2012-07-24
    • 2011-02-17
    • 2020-12-08
    • 2020-01-09
    • 2011-09-06
    • 1970-01-01
    • 2017-10-19
    • 2014-03-28
    • 1970-01-01
    相关资源
    最近更新 更多