php mysql easy peasy

Associate
Joined
17 Oct 2002
Posts
312
Location
herts
hi there

i need to reuse a sql query a few times on one page but i think after the first time i need to set the query to the first record again but am unsure of how to do it, here is my code.

Code:
	while ( $a_row = mysql_fetch_array( $result ) )
	{
	?>
	 <tr>
	  <td>
	  <select name=seasons>
			<?php
			while ( $b_row = mysql_fetch_array( $result_seasons ) )
			{
			echo ("<option value='".$b_row['season']."'>".$b_row['season']);
			}
			?>
	  </select>

i need something like a movefirst() function, or making it a multidimensional array maybe.
what is the best way to acheive this please

cheers
 
Do you mean reuse an sql query or a result set from an sql query? The code you have posted doesnt have any sql querys in it just two different result sets.

If im right, you mean you need to reuse the dataset in several instances like the code example you gave. In this case, you can use mysql_data_seek(resultset,0) to return the pointer to the first row in the result set.
 
Back
Top Bottom