From the server side, I do this thing:

$row = mysql_fetch_array("SELECT img,name,life,atk,def,exp,type FROM pokemon WHERE id_pok = '".$_GET['startpoke']."'") or die('Error:'.mysql_error()); 

and I get the following error:

Warning: mysql_fetch_array () expects parameter 1 to be resource, given in C: xampphtdocsstyleregister.php

Please tell me what the error is.

Reported as a duplicate by Athari , Yura Ivanov , Maxim Kamalov , ixSci , AntonioK May 16 '15 at 6:05 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • > C: xampphtdocsstyleregister.php is our mego editor screwed up, or are you messed up with the paths? - Ozim
  • Prikol you make the same mistakes every day! - Palmervan

1 answer 1

First, sql needs to be executed (execute) and then the result of the selection is retrieved from it, which is what you are told in the error message ..

 $res = mysql_query("SELECT img,name,life,atk,def,exp,type FROM pokemon WHERE id_pok = '".$_GET['startpoke']."'") or die('Error:'.mysql_error()); while($row = mysql_fetch_array($res)) { print_r($row); }