Re: New Problem with Arrays won't show the first record of a query.

From: Date: Sat, 13 Mar 2004 00:56:04 +0000
Subject: Re: New Problem with Arrays won't show the first record of a query.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-180304@lists.php.net to get a copy of this message
Because you do mysql_fetch_assoc() once before going into your while loop. Get rid of that first $row_prefs = mysql_fetch_assoc(...) line there and it will work. -Rasmus On Fri, 12 Mar 2004, Elliot J. Balanza wrote: > Ok thanks to Michael Nolan I was able to do what I needed. The final code is > this: > > <snip-snip> > mysql_select_db($database_MBTTIENDA, $MBTTIENDA); > $query_prefs = "SELECT * FROM mtmbt_prefs ORDER BY Pref_name ASC"; > $prefs = mysql_query($query_prefs, $MBTTIENDA) or die(mysql_error()); > $row_prefs = mysql_fetch_assoc($prefs); > $totalRows_prefs = mysql_num_rows($prefs); > > while ($row_prefs = mysql_fetch_assoc($prefs)) { > $MTMBT[$row_prefs['Pref_name']] = $row_prefs['Pref_value']; > } > > mysql_free_result($prefs); > <snip-snip> > > and it works fine EXCEPT it wont show the first record of the query... any > ideas why? > > Vamp > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#180304) next »