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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.