Php 错误警告:mysql_fetch_array()希望参数1是资源,布尔值在中给出
当我运行我的代码时,我继续得到这些错误,我无法找出我需要修复什么 这是我收到的错误Php 错误警告:mysql_fetch_array()希望参数1是资源,布尔值在中给出,php,html,mysql,Php,Html,Mysql,当我运行我的代码时,我继续得到这些错误,我无法找出我需要修复什么 这是我收到的错误 Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in 我的代码: <?php if(isset($_POST['dt'])){ $ab=$_POST['dt']; $maconnexion=mysql_connect("localhost","root",""); $mabase=my
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
我的代码:
<?php if(isset($_POST['dt'])){
$ab=$_POST['dt'];
$maconnexion=mysql_connect("localhost","root","");
$mabase=mysql_select_db("gestion de production",$maconnexion);
$requete="select p.num,e.mat,e.nom,a.codea,a.designation,a.stock from employe e,production p,article a where e.mat=p.mat and p.codea=a.codea and p.date de naissance='$ab'";
$resultat=mysql_query($requete,$maconnexion);}
function stock(){
global $ab; global $resultat;
global $maconnexion;
?>
<table border=1>
<tr>
<td>num
<td>mat
<td>nom
<td>codea
<td>designation
<td>qt
<?php
while($ligne=mysql_fetch_array($resultat,MYSQL_NUM)){
echo"<tr>";
echo"<td>$ligne[0]<td>$ligne[1]<td>$ligne[2]<td>$ligne[3]<td>$ligne[4]<td>$ligne[5]";
$re="insert into wproduction values('$ligne[0]','$ab','$ligne[1]','$ligne[2]','$ligne[3]','$ligne[4]','$ligne[5]')";
$res=mysql_query($re,$maconnexion);} }
if(isset($_POST['a'])){
stock();
}
?>
您必须检查$resultat===false。如果是,这是一个mysql错误,因此您必须截取它,而不是在此期间解析它。我检查了它,显示select p.num、e.mat、e.nom、a.codea、a.designation、a.stock from employe e e、production p、article a其中e.mat=p.mat和p.codea=a和p.date de naissance='2013-12-03'qt警告:mysql_fetch_数组期望参数1是资源,第38行C:\Program Files\EasyHP-12.1\www\my portable Files\saisie1.php中给出的布尔值$resultat变量不是requedt,而是结果,因此如果您将其变量转储,它应该是“资源”类型。如果是布尔值,则您的请求有错误,因此无法返回有效结果。mysql\u错误打印的是什么?我尝试了显示警告:mysql\u fetch\u数组期望参数1是资源,布尔值在C:\Program Files\EasyHP-12.1\www\my portable Files\production\saisie.php第38行给出。不,不是。这是一个PHP错误;如果您回显mysql\u错误的内容,您将确切看到数据库错误是什么。它显示2013-12-03mysql\u错误请帮助我