Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in F:\www\messagebook\admin\index.php on line 17
在我的机器上运行的好好的,换了台机器就成这了,并且不止一处这样的警告,但是所有警告都是指向的mysql_fetch_array()。
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in F:\www\messagebook\admin\check.php on line 12
<?php
session_start();
include_once('../include/public.inc.php');
if($_SESSION['admin']==''){
$name=$_POST['name'];
$passowrd=$_POST['psw'];
if ($name && $passowrd){
$sql = "select * from admin where name = '$name' and psw='$passowrd' limit 1";
$query = mysql_query($sql);
$result = mysql_fetch_array($query);
if($result){
$_SESSION['admin'] = $name;
header("Location: index.php");
exit;
}else{
echo "<script language=javascript>alert('用户名密码错误');window.location.href='login.php';</script>";
}
}else {
echo "<script language=javascript>alert('用户名密码不能为空');window.location.href='login.php';</script>";
}
}
?>
在我的机器上运行的好好的,换了台机器就成这了,并且不止一处这样的警告,但是所有警告都是指向的mysql_fetch_array()。
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in F:\www\messagebook\admin\check.php on line 12
<?php
session_start();
include_once('../include/public.inc.php');
if($_SESSION['admin']==''){
$name=$_POST['name'];
$passowrd=$_POST['psw'];
if ($name && $passowrd){
$sql = "select * from admin where name = '$name' and psw='$passowrd' limit 1";
$query = mysql_query($sql);
$result = mysql_fetch_array($query);
if($result){
$_SESSION['admin'] = $name;
header("Location: index.php");
exit;
}else{
echo "<script language=javascript>alert('用户名密码错误');window.location.href='login.php';</script>";
}
}else {
echo "<script language=javascript>alert('用户名密码不能为空');window.location.href='login.php';</script>";
}
}
?>
if (!$conn = mysql_connect($host,$user,$passpword)) die(mysql_error());