English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

This is my php mysql select query:

$query = "SELECT badge_number, first_name, last_name, email, user_id FROM users WHERE email = '$email' AND activation_code = '$code' ";
$result = @mysql_query ($query);
$row = mysql_fetch_array ($result, MYSQL_NUM);

BUT it comes up with the error

mysql_fetch_array(): supplied argument is not a valid MySQL result resource in...

Whats wrong??

2007-08-27 04:10:33 · 5 answers · asked by jeff lemon 1 in Computers & Internet Programming & Design

5 answers

try to replace this line:
$result = @mysql_query ($query);

with this:
$result = mysql_query ($query);

is it helpful?

2007-08-27 04:21:05 · answer #1 · answered by Riff Almighty 3 · 0 1

It probably means your query failed. Remove the @ so you get error logging and check to see if $result is false before using mysql_fetch_array(), if it is print the result of mysql_error() to get a description of the error (and the result of mysql_errno() if you want the error code as well)

So basicly take
$result = @mysql_query ($query);
$row = mysql_fetch_array ($result, MYSQL_NUM);
and replace it with
$result = mysql_query ($query);
if(!$result)
{
echo(mysql_error());
}
else
{
$row = mysql_fetch_array ($result, MYSQL_NUM);
}

2007-08-27 04:26:15 · answer #2 · answered by jonathanlks 4 · 0 0

as for me that error message comes because of the fault in your query. I think you should check your query again!

mysql_fetch_array ( resource result [, int result_type])

try to change [ int result_type ] to MYSQL_BOTH as the default value of argument mysql_fetch_array.

hope it will help!
good luck!

2007-08-27 05:10:01 · answer #3 · answered by Nuris Kandar M 2 · 0 0

You are getting worse by the minute!
160 questions up to now, and you have learnt nothing!
Get a life (in another field than programming)

2007-08-27 05:17:52 · answer #4 · answered by just "JR" 7 · 0 1

try youngcoders.com they will help

2007-08-27 04:19:06 · answer #5 · answered by zerocool 3 · 0 1

fedest.com, questions and answers