Blaine, Are you adding/deleting records? Check that your MySQL tables are defined as type MyISAM; if they are regular ISAM table the autoincrement numbers are reused. That was a surprise! That may not be the problem, but I see you don't have an "ORDER BY" clause in your SQL. Add one, "ORDER BY probid" if probid is your autoinc field. Cheers - Miles Thompson
At 12:34 PM 7/12/2002 -0400, Blaine D. Dinsmore wrote: >I'm using MySQL and I have noticed that my primary key which are >autoincrementing numbers do not sort properly when pulling the results to >the browser. They are showing consecutively all the way until 150 then they >start going backwards for example: >157 >156 >155 >154 >159 >160 >161 >162 >163 >When I do a query in MySQL they are sequenced correctly but using the php >mysql_fetch_array() I get this crazy numbering sequence. Does anyone know >what this could be? > >Here is my code: > ><body bgcolor="#000000" text="#FFFFFF" link="#99FF33" vlink="#FFFF00" >alink="#99CCFF"> ><FONT FACE=ARIAL> ><?php > include('functions.php'); > > $dbase="lims_issues"; >If ($_GET[order] == 1) { >$sql= "SELECT probid,resolved,loggerid,DATE_FORMAT(logdate,'%m-%d-%Y') AS >date,priority,screen,descript,notes" . > " FROM bugs"; >} > >If ($_GET[order] == 2) { >$sql= "SELECT probid,resolved,loggerid,DATE_FORMAT(logdate,'%m-%d-%Y') AS >date,priority,screen,descript,notes" . > " FROM bugs WHERE resolved=0"; >} > >If ($_GET[order] == 3) { >$sql= "SELECT probid,resolved,loggerid,DATE_FORMAT(logdate,'%m-%d-%Y') AS >date,priority,screen,descript,notes" . > " FROM bugs WHERE resolved=1"; >} > >If ($_GET[order] == 4) { >$sql= "SELECT probid,resolved,loggerid,DATE_FORMAT(logdate,'%m-%d-%Y') AS >date,priority,screen,descript,notes" . > " FROM bugs WHERE discussed=0"; >echo("<font size=5><b>Issues Not Disscussed With Beckman</b></font>"); >} > >If ($_GET[order] == 5) { >$sql= "SELECT probid,resolved,loggerid,DATE_FORMAT(logdate,'%m-%d-%Y') AS >date,priority,screen,descript,notes" . > " FROM bugs WHERE discussed=1"; >echo("<font size=5><b>Issues Disscussed With Beckman</b></font>"); >} >mysqlconn($dbase,$sql); > > > while( $myrow = mysql_fetch_array($result) ){ > ?> ><Table border="1" cellpadding="0" cellspacing="0" style="border-collapse: >collapse" bordercolor="#777777" width="100%"> > <TR bgcolor="#006600"> > <TD colspan=3> > <?php echo("<b>Issue ID: </b>" . "<a href=modify.php?getprobid=" >.$myrow["probid"] .">" . $myrow["probid"] . "</a>"); ?> > </TD> > <?php > if ($myrow["resolved"] == '1') { > Echo("<TD bgcolor=#006600>"); > Echo("<b><font color=#FFFFFF>Resolved</font></b>"); > Echo("</TD>"); > > > >-- >PHP Database Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php