$sql="select * from table where blah=$blah"; $x=mysql_query($sql); while ($data=mysql_fetch_array($x)) { echo "$data[columnName]"; }
I think is what your trying to do... On Thu, 7 Mar 2002, Gavin Philips-Page wrote: |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 | | --------------------------------------------------------------------- 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 <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php