Hi Gavin,
I didn't know if you knew this or not but there is a site which
provides lives PHP / MySQL support. Take a look at http://www.phphelpdesk.com . It
is a live PHP support site which helps you get real time answers to PHP problems.
Keith
* Gavin Philips-Page ([EMAIL PROTECTED]) wrote:
> User-Agent: Microsoft-Entourage/9.0.2509
> Date: Thu, 07 Mar 2002 18:20:31 +0200
> Subject: Stepping through a MySQL_fetch_array in PHP?
> From: Gavin Philips-Page <[EMAIL PROTECTED]>
> To: MySQL Problems <[EMAIL PROTECTED]>
>
> Could anybody please help:
>
> In the query I have included a limit string which allows me to display
> individual records page by page. The limit string variable is
> incremented/decremented using hyperlinks. I feel it would be better if I
> could somehow manually step through the returned
> $query_data = mysql_fetch_array($result). Is it possible to create a loop
> with a counter to step through the records contained in the array?
>
> // PHP Code
> $link_id = db_connect($default_dbname) ;
> if(!$link_id) error_message(sql_error()) ;
> $query = "select count(*) from $user_tablename" ;
> $result = mysql_query($query) ;
> if(!$result) error_message(sql_error()) ;
> $query_data = mysql_fetch_row($result) ;
> $total_num_user = $query_data[0] ;
> if(!$total_num_user) error_message('No records found!') ;
>
> $query = "select usernumber, userid, userpassword, username, sex,
> nationality, usermail, userprofile, registerdate, date_format(registerdate,
> '%M, %e, %Y') as formatted_registerdate, lastaccesstime,
> date_format(lastaccesstime, '%M, %e, %Y') as formatted_lastaccesstime from
> $user_tablename $order_by_str $sort_order_str $limit_str" ;
>
> $result = mysql_query($query) ;
> if(!$result) error_message(sql_error()) ;
>
> $query_data = mysql_fetch_array($result) ;
> // Table displaying the found records from MySQL database
>
> Thanx
>
> Gavin
>
#######################################################
Keith Elder
Email: [EMAIL PROTECTED] AIM: ZZorKKa YIM: keitheld
Phone: 1-734-507-1438
Text Messaging (145 characters): [EMAIL PROTECTED]
Web: http://www.zorka.com (Howto's, News, and hosting!)
"With enough memory and hard drive space
anything in life is possible!"
#######################################################
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php