<?php
include"./include/config.php";
$sql_user = "Select * From member Where user='$user' ";
$result = mysql_query($sql_user);
$row= mysql_fetch_array($result);
if ($row['user'])
echo "<script language='javascript'>alert('Be known sure can not can record');history.back();</script> ";
?>
มันขึ้น Error ยังงี้คะ
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\wesiam\check_user.php on line 6
เดาว่า connect database ไม่ได้หรือไม่ก็ไม่มี user นั้นอยู่
ตามเพ่ PlaKriM บอกเลยนะครับ
Quote:
<?php
include"./include/config.php";
$sql_user = "Select * From member Where user='$user' ";
$result = mysql_query($sql_user);
$row= mysql_fetch_array($result);
if ($row['user'])
echo "<script language='javascript'>alert('Be known sure can not can record');history.back();</script> ";
?>
<?php
include"./include/config.php";
$sql= "Select * From member Where user='$user'";
$result = mysql_query($sql);
$row= mysql_fetch_array($result);
if ($row['user'])
echo "<script language='javascript'>alert('Be known sure can not can record');history.back();</script> ";
?>
อันนี้ไฟล์ Connect database นะคะ Code (PHP)
<?
$host="localhost";
$us="root";
$wp="1234";
$dbname="website_db";
$c=mysql_connect($host,$us,$wp);
if(!$c) {
echo"ไม่สามารถติดต่อฐานข้อมูลได้";
mysql_query("SET CHARACTER SET utf8");
exit();
}
?>
<?php
include"./include/config.php";
$sql= "Select * From member Where user='$user'";
$result = mysql_query($sql);
$row= mysql_fetch_array($result);
if ($row['user']){
echo "<script language='javascript'>alert('Be known sure can not can record');history.back();</script> ";
}
?>