Re: WHY need to query 2x to get results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 22 July 2003 18:20, Ow Mun Heng wrote:
> Hi,
>
> 	I have a code that goes like this. Scroll down to the "<----------"
> sign. How come I need another $result = mysql_query($sql) at that location?
> If I don't have it, the results coming out will only start printing from
> the 2nd Row.. Omitting the 1st.
>
> Results as wanted
>
> row 1		value1
> row 2		value2
> row 3 	value3
>
> Getting this instead
>
> row 2		value2
> row 3 	value3
>
> ????
>
> Pls Help.
>
> 	$result = mysql_query($sql);
>
> 	$num_results = mysql_num_rows($result);
>
> 	$row = mysql_fetch_row($result);

The above line has gobbled up your 1st row of results and moved the result 
pointer onto the 2nd row.

Use mysql_data_seek() to reset the pointer back to the 1st row.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-db
------------------------------------------
/*
Flights never leave from Gate #1 at any terminal in the world
		-- Murphy's Laws for Frequent Flyers n4
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux