Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql help needed

Status
Not open for further replies.

rosesau

Programmer
Joined
May 24, 2001
Messages
9
Location
AU
Hi,

i am unsure what to put in this line, currectly i have the following line

$RS=mysql_fetch_array($RS_query);

but i get the following error message

supplied argument is not a valid MySQL result resource. so that statement most be total wrong.

i am trying to get a result from a row when the username and password matches in a database. the line before is as follows

$RS_query-MySQL_query(($SQL),$MyConn);

so what should i use is the $RS line that does the same job.
any help that you can give me would be great

thanks
Rose
 
Okay,

You get the "supplied argument is not a valid MySQL result resource" error because the query didn't get any resultset back.

Try this;

$result = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'");
if($row = mysql_fetch_array($result))
{
print("Welcome!!");
}

Hope that helped a bit :-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top