<html>
<head>
<title>**Othello**</title>
</head>
<body>
<h1>Othello Game</h1>
<meta http-equiv="Refresh" content="5">
<?php
mysql_connect("localhost", "root", "othello") or die("เชื่อมต่อไม่สำเร็จ มีข้อมูลผิด");
mysql_select_db("othello") or die("เลือกฐานข้อมูลไม่ได้");
$number = $_POST['number'];
$result = mysql_query("SELECT * FROM othellotable WHERE number = $number");
while($row = mysql_fetch_array($result))
{
echo "<br />";
echo $row['table'];
echo "<br />";
}
?>
ผลแสดง
โชว์ได้ตามที่ต้องการ แต่พอหน้า page refresh ก้อขึ้น warning ใครรู้ บอกหน่อยยยย
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\game.php on line 17
<head>
<title>**Othello**</title>
</head>
<body>
<h1>Othello Game</h1>
<meta http-equiv="Refresh" content="5">
<?php
mysql_connect("localhost", "root", "othello") or die("เชื่อมต่อไม่สำเร็จ มีข้อมูลผิด");
mysql_select_db("othello") or die("เลือกฐานข้อมูลไม่ได้");
$number = $_POST['number'];
$result = mysql_query("SELECT * FROM othellotable WHERE number = $number");
while($row = mysql_fetch_array($result))
{
echo "<br />";
echo $row['table'];
echo "<br />";
}
?>
ผลแสดง
โชว์ได้ตามที่ต้องการ แต่พอหน้า page refresh ก้อขึ้น warning ใครรู้ บอกหน่อยยยย
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\game.php on line 17
คำสั่ง sql น่าจะผิดครับ แนะนำให้เอาคำสั้งไปวางบน phpmyadmin หรอไม่ก็ลองเพิ่มคำสั้งนี้ลงไปหลัง query ครับ or die(mysql_error())
งงอ่ะคะ
ขอละเอียดๆอีกรอบได้มั้ยคะ
ขอละเอียดๆอีกรอบได้มั้ยคะ
refresh แล้ว $number ไม่มีหรือเปล่า.....
ให้ลอง echo query ออกมาดูก่อน
ให้ลอง echo query ออกมาดูก่อน
อ๋อ ถ้านู๋ต้องการให้กลับไปหน้ารับค่า
ใสอย่างนี้ได้มั้ยคะ
<meta http-equiv="Refresh" content="5";url=othello.php>
หรือต้องเพิ่มตรงไหน
ใสอย่างนี้ได้มั้ยคะ
<meta http-equiv="Refresh" content="5";url=othello.php>
หรือต้องเพิ่มตรงไหน
งง กันเป็นแถบ แล้วต้องการกลับไปรับค่าทำไมครับ ที่บอกว่า refresh แล้วขึ้น warning เกิดจากการ refresh หน้าที่โชว์ข้อมูลรึป่าว