0

我收到此错误消息:“Mysql_fetch_array 提供的参数不是有效的 MYSQL 结果”但我不知道代码有什么问题

$sql = "SELECT *, status_pedido.nome as descricao_status,frete.nome as nome_frete, historico.data as data_hist, DATE_FORMAT(historico.`data`,'%d/%m/%Y') as data, DATE_FORMAT(historico.`data`,'%H:%i:%s ') as hora
                    FROM midiosto_db.`l-pedidos` as pedido
                    INNER JOIN midiosto_db.`l-pedido-historico` as historico
                        ON pedido.id = historico.`id-pedido`
                    INNER JOIN midiosto_db.`l-status` as status_pedido
                        ON status_pedido.id = historico.`id-status`
                    INNER JOIN midiosto_db.`l-frete` as frete
                        On frete.id = pedido.`id-frete`
                    WHERE pedido.id  = ".$_GET["id_pedido"]."
                    ORDER BY data_hist DESC";

$query_historico = mysql_query($sql);
$row_historico = mysql_fetch_array($query_historico);
4

1 回答 1

1

小心使用此代码执行 SQL 输入... get 根本不安全。使用 PDO 代替 mysql_query。

对于您的错误消息,query_historico 可能不是您期望的类型,因为您的 SQL 语句可能是错误的。

于 2014-03-06T14:03:32.470 回答