HOME > PHP > PHP Forum > รันบน local ได้ แต่พออัพขึ้น server กลับไม่ได้ error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
รันบน local ได้ แต่พออัพขึ้น server กลับไม่ได้ error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
include("config.inc.php");
if(isset($_GET[cusid])){
$sql = "select * from customer c JOIN province p ON c.prov_id=p.prov_id where Cus_id=$_GET[cusid]";
$result = mysql_query($sql);
$data = mysql_fetch_array($result);-------------->ติดบรรทัดนี้ค่ะ
$result = mysql_query($sql) or die(mysql_error());
เอา error มาดูคับ
Date :
2010-08-10 19:27:04
By :
pjgunner
No. 6
Guest
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
<?
include("config.inc.php");
if(isset($_GET[cusid])){
$sql = "select * from customer c inner JOIN province p ON c.prov_id=p.prov_id where Cus_id=$_GET[cusid]";
$result = mysql_query($sql); mysql_error();...............>แบบนี้ใช่ไหมค่ะ
$data = mysql_fetch_array($result);
?>
Date :
2010-08-10 19:50:58
By :
boomy
No. 7
Guest
error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
<?
include("config.inc.php");
<=== ลองเพิ่ม mysql_select_db('xxxxxx');
if(isset($_GET[cusid])){
$sql = "select * from customer c inner JOIN province p ON c.prov_id=p.prov_id where Cus_id=$_GET[cusid]";
$result = mysql_query($sql);
mysql_error();...............>แบบนี้ใช่ไหมค่ะ
$data = mysql_fetch_array($result);
?>
$cusid=$_GET['cusid'];
echo $cusid; //<<== ลอง echo ดูว่ามีค่ามาหรือเปล่า
$sql = "select * from customer c JOIN province p ON c.prov_id=p.prov_id where Cus_id='$cusid";
$result = mysql_query($sql) or die ("Error Message");
$data = mysql_fetch_array($result);
if (เงื่อนไข...){
echo "xxxxxxxxxxxxxxxxxxxxxxxx";
} else if (เงื่อนไข...) {
echo "xxxxxxxxxxxxxxxxxxxxxxx";
}
mysql_close($connection);
end.....
Date :
2010-08-11 18:20:33
By :
nprawit
No. 12
Guest
ยังไม่ได้ค่ะ error !!!! Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource