Shamrox Posted January 12, 2007 Share Posted January 12, 2007 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] Quote Link to comment Share on other sites More sharing options...
kobmat Posted January 12, 2007 Share Posted January 12, 2007 Remove this line$row_rs_rep = mysql_fetch_assoc($rs_rep); Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 12, 2007 Share Posted January 12, 2007 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. Quote Link to comment Share on other sites More sharing options...
Shamrox Posted January 12, 2007 Author Share Posted January 12, 2007 golden! thanks much. Quote Link to comment Share on other sites More sharing options...
Shamrox Posted January 12, 2007 Author Share Posted January 12, 2007 . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.