Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

php - supplied argument is not a valid MySQL result resource

I have developed a small CMS on my local WAMP machine.

Once I have exported my project on to the hosting, the following problem shows up

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homepages/36/d288053636/htdocs/MYWEBSITE/admin/index.php on line 44

Warning: Cannot modify header information - headers already sent by (output started at /homepages/36/d288053636/htdocs/MYWEBSITE/admin/index.php:44) in /homepages/36/d288053636/htdocs/MYWEBSITE/admin/index.php on line 62

LINE 44:

$row = mysql_fetch_assoc(mysql_query("SELECT id,usr FROM pureUser WHERE usr='{$_POST['username']}' AND pass='".md5($_POST['password'])."'"));

Line 62:

header("Location: index.php");

What does those errors mean?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The SQL query has not finished correctly. You most likely uploaded the script, but have either not uploaded the database, or have wrong database credentials.

Hint You can get very good and descriptive error messages when you put the following code after a failing mysql_query statement:

if (mysql_error()) {
    die(mysql_error());
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...