Jump to content

First record dropped


Shamrox

Recommended Posts

Probably a simple mistake and I couldn't find an answer doing a search here, so another post on why the first record is dropped. Any one see what's wrong with my code? Works, but the first record never shows.

[code]
mysql_select_db($database_spectrum, $spectrum);
$query_rs_rep = "SELECT stbrepid, stb_lastname FROM spec_stbrep ORDER BY stb_lastname ASC LIMIT 0, 30 ";
$rs_rep = mysql_query($query_rs_rep, $spectrum) or die(mysql_error());
$row_rs_rep = mysql_fetch_assoc($rs_rep);
$totalRows_rs_rep = mysql_num_rows($rs_rep);
$repList = '';
while ( $row_rs_rep = mysql_fetch_array($rs_rep) ) {
  $repList = $repList.'<li><a href="\dashboard.php?rep='.$row_rs_rep['stbrepid'].'&page=registrar">'.$row_rs_rep['stb_lastname'].'</a></li>';
}
[/code]
Link to comment
https://forums.phpfreaks.com/topic/33903-first-record-dropped/
Share on other sites

This line grabs the first record:

$row_rs_rep = mysql_fetch_assoc($rs_rep);

Then before you do anything with it you start a WHILE loop which grabs the 2nd and remaining records.

while ( $row_rs_rep = mysql_fetch_array($rs_rep) ) {

Remove the first line I entered above.
Link to comment
https://forums.phpfreaks.com/topic/33903-first-record-dropped/#findComment-159159
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.