-1

I have a php code where I just query to insert rows into table via POST method every thing happens fine with WARNING ,I couldn't figure out why is that a warning message

WARNING MESSAGE IS: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a266/public_html/poster.php on line 9

CODE IS:

include "db.php";
$sql=mysql_query("INSERT INTO tb1 (col1,col2) VALUES ('$_val1', '$_val2')");
while($row=mysql_fetch_assoc($sql))
$output[]=$row;
$result="inserted";

NOTE :Value is perfectly inserted into table and returns "inserted" message But why is that warning..?

Vinod
  • 77
  • 2
  • 10

1 Answers1

1

INSERT just returns true or false.There is no result to fetch with INSERT query.

Prem
  • 1,447
  • 2
  • 10
  • 21
  • You are right I made mistake in fetching..I coded as mysql_query ($sql); this solved the warning..thankyou – Vinod Jun 16 '14 at 11:32