Jump to content

[SOLVED] stupid question


HAVOCWIZARD

Recommended Posts

in a query i get the result. how can i move the pointer inside the result to the next record ? example


$record1 = ($result['field_name']); //hotel
if ($record1 = "hotel")
{skip or jump or what do i need here} // go to next record and check
else
{
echo ($record1);
}

 

what will work here, i anybody can help, thanks

Link to comment
https://forums.phpfreaks.com/topic/55568-solved-stupid-question/
Share on other sites

 

Hello

 

The best way is to use any of the fetch function like :

 

mysql_fetch_array()

mysql_fetch_row()

mysql_fetch_object()

 

Ex:

 

$result = mysql_query("Select * from tablename");

 

while($data=mysql_fetch_array($result))

{

  check whether $data['field name'] equals

 

}

 

 

You can do this by using  mysql_data_seek ( resource $result, int $row_number )

 

Find the total rows by using mysql_num_rows() and go use a for loop to go to each record.

 

More abt Mysql functions: http://au3.php.net/mysql

 

Regards

Aniesh

[email protected]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.