webdev007
Programmer
- Sep 9, 2005
- 168
Why do I get a warning when it all goes fine
After the script excerpt are a bunch of inserts or updates and rating math
all are ok.
If I echo the query and paste it in phpMyadmin
I get the expected results
so where is my problem?
existing in the DB are the values id and phone
in my "while" I use those to perform a comparison
with values passed either via POST or SESSION
those values are named $id_check and $phone_check
do you see anything wrong?
Again I get the warning but the job is done!
Warning: mysql_result(): supplied argument is not a valid MySQL result resource
After the script excerpt are a bunch of inserts or updates and rating math
all are ok.
If I echo the query and paste it in phpMyadmin
I get the expected results
so where is my problem?
existing in the DB are the values id and phone
in my "while" I use those to perform a comparison
with values passed either via POST or SESSION
those values are named $id_check and $phone_check
do you see anything wrong?
Again I get the warning but the job is done!
Warning: mysql_result(): supplied argument is not a valid MySQL result resource
Code:
$conn=db_connect();
$query = "select phone, id from my_table where id !='$id' AND phone='$phone' "; echo"$query";
$result = mysql_query($query) ;
// search to match new with existing
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i <$num)
{
$id_check= mysql_result($result,$i,"id");
$phone_check= mysql_result($result,$i,"phone");