php - echo all row of a mysql_num_rows -


i have following php

  $q=mysql_query("select smiles geoandenergies weight='".$data."' ") or die(mysql_error());  $n=mysql_num_rows($q); //not mysql_fetch_row, not return count array  if($n>0)  {    $info=mysql_fetch_row($q);     echo $info[0];   }   else {    echo "molecule not find";   } 

i echo not $info[0] $info[0]+"<"+ $info[1] + "<" .... + $info[n], correct syntax?

thanks

use while loop fetch rows

$q=mysql_query("select smiles geoandenergies weight='".$data."' ") or die(mysql_error());  $n=mysql_num_rows($q);    if($n>0)  {    $val='';    while($info=mysql_fetch_row($q))     {       if($val!='')           $val.=' < ';       $val.= $info[0];     }  }   else {    $val= "molecule not find";   }  echo $val; 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -