HI REPLACE THIS BLOCAK THEN WILL BE FINE INTEAD OF THIS if(mysqli_fetch_row($result)>0) { $rows=mysqli_num_rows($result); for($i=0;$i<$rows;$i++) { $res_row= mysqli_fetch_row($result); $topic[] = array('id'=>$res_row[0],'name'=>$res_row[1],'url'=>$res_row[2],'rating'=>$re s_row[3], 'category'=>$res_row[4] ,'site_main'=> $res_row[5]); } } REPLACE THIS if(mysqli_num_rows ($result)>0) { $rows=mysqli_num_rows($result); for($i=0;$i<$rows;$i++) { $res_row= mysqli_fetch_row($result); $topic[] = array('id'=>$res_row[0],'name'=>$res_row[1],'url'=>$res_row[2],'rating'=>$re s_row[3], 'category'=>$res_row[4] ,'site_main'=> $res_row[5]); } } REASON WHEN YOU CHECKING IF CONDITION FIRST ROW ALREADY FETCHED, AGAIN YOU STARTING FETCH STATEMENT IN FOR LOOP Thanks, Muthukumar Selvarasu, Project Manager (Web Development), Webmasters Ltd. _____ From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On Behalf Of Vijaya Lakshmi Sent: Tuesday, December 18, 2007 4:30 PM To: php-objects@xxxxxxxxxxxxxxx Subject: RE: Regarding retrieving multiple rows from database through PHP code Hi, Thank you very much for your response.I tried by using your code but i didn't get first row values.Please once try and tell me thanks vijaya Muthukumar Selvarasu <muthukumar_se@ <mailto:muthukumar_se%40hotmail.com> hotmail.com> wrote: Hi try the below code if(mysqli_fetch_row($result)>0) { $rows=mysqli_num_rows($result); for($i=1;$i<=$rows;$i++) { $res_row= mysqli_fetch_row($result); $topic[] = array('id'=>$res_row[0],'name'=>$res_row[1],'url'=>$res_row[2],'rating'=>$re s_row[3], 'category'=>$res_row[4] ,'site_main'=> $res_row[5]); Thanks, Muthukumar Selvarasu, Project Manager (Web Development), Webmasters Ltd. _____ From: php-objects@ <mailto:php-objects%40yahoogroups.com> yahoogroups.com [mailto:php-objects@ <mailto:php-objects%40yahoogroups.com> yahoogroups.com] On Behalf Of Vijaya Lakshmi Sent: Tuesday, December 18, 2007 3:59 PM To: php-objects@ <mailto:php-objects%40yahoogroups.com> yahoogroups.com Subject: Regarding retrieving multiple rows from database through PHP code Hi All, We have implemented the below code.Actually we are getting 5 results for the below code.But we able to get only 4 values,we are missing the first row out of 5 results.We cant able to predict why we are getting this result. Please once go through this code and help us. <?php function write_query($sql) { echo "<xmp>"; echo $sql.';'; echo "</xmp>"; } function trim_param($str) { if(trim($str) == '') { return 0; } elseif(trim($str) == 'N') { return 0; } else { return $str; } } function GetRating($url) { $res_new1=array(); $Query1=""; for ($i=0;$i<count($url);$i++) { $str=0; $mysqli = mysqli_connect("localhost", "root", "123", "db"); $urls=$url["$i"]; $res = $mysqli->query("call rating('$urls',@abc);"); if(mysqli_num_rows($res)>0) { $row = mysqli_fetch_row($res); $str=$row[0]; } if($str>0) { $res_new1[]=$str; } else { $res_new1[]="NONE"; } $mysqli->close( ); } return $res_new1; } function Clix_Rated_site($str_searchString,$mysqli) { $str_searchString = trim($str_searchString); $topic = array(); $topic_one=array(); $topic_two=array(); $Query1 = ""; $temp_str_searchString =""; if(substr($str_searchString,strlen($str_searchString)-1) == 's') { $temp_str_searchString = substr($str_searchString,0,strlen($str_searchString)-1); $var="+".mysql_escape_string($temp_str_searchString)."*"; $Query1="call Clix_Rated_site('$var')"; } else { $temp_str_searchString = $str_searchString; $var=mysql_escape_string($temp_str_searchString); $Query1="call Clix_Rated_site('$var')"; } $mysqli = mysqli_connect("localhost", "root", "123", "db"); $result = $mysqli->query("$Query1"); if(mysqli_num_rows($result)==0) { $var="+".mysql_escape_string($str_searchString)."*"; $mysqli->close(); $mysqli = mysqli_connect("localhost", "root", "123", "db"); $Query1="call Clix_Rated_site('$var')"; $result = $mysqli->query("$Query1"); } if(mysqli_fetch_row($result)>0) { $rows=mysqli_num_rows($result); for($i=0;$i<$rows;$i++) { $res_row= mysqli_fetch_row($result); $topic[] = array('id'=>$res_row[0],'name'=>$res_row[1],'url'=>$res_row[2],'rating'=>$re s_row[3], 'category'=>$res_row[4] ,'site_main'=> $res_row[5]); } } else { $topic[] = "None"; } $mysqli->close(); return $topic; } ?> Thankig u all. --------------------------------- Get the freedom to save as many mails as you wish. Click here to know how. [Non-text portions of this message have been removed] [Non-text portions of this message have been removed] --------------------------------- Forgot the famous last words? Access your message archive online. Click here. [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]