我收到此错误消息:“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);
答案 0 :(得分:1)
使用此代码注意SQL权限... get根本不安全。使用PDO代替mysql_query。
对于您的错误消息,query_historico可能不是您期望的类型,因为您的SQL语句可能是错误的。