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] Link to comment https://forums.phpfreaks.com/topic/33903-first-record-dropped/ 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); Link to comment https://forums.phpfreaks.com/topic/33903-first-record-dropped/#findComment-159157 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. Link to comment https://forums.phpfreaks.com/topic/33903-first-record-dropped/#findComment-159159 Share on other sites More sharing options...
Shamrox Posted January 12, 2007 Author Share Posted January 12, 2007 golden! thanks much. Link to comment https://forums.phpfreaks.com/topic/33903-first-record-dropped/#findComment-159161 Share on other sites More sharing options...
Shamrox Posted January 12, 2007 Author Share Posted January 12, 2007 . Link to comment https://forums.phpfreaks.com/topic/33903-first-record-dropped/#findComment-159177 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.