dodgei Posted January 25, 2007 Share Posted January 25, 2007 This loop is skipping every other record. Why is that?When I sort the records ascending it retrieves the odds. When I sort descending it retrieves the evens.Here is the code.[code]<?php$odbc = odbc_connect ('accounting', 'root', '') or die('Could Not Connect to ODBC Database!');$sql = "select * from entry order by EntryID ASC"; $results = @odbc_exec($odbc, $sql) or die("<tt>problem with $sql : " . odbc_errormsg() . "</tt>\n");while($r = @odbc_fetch_object($results)) { echo $r->EntryID; echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?action=delete&row_id=" . $r->EntryID . ">delete</a>\n";}odbc_close($odbc);?>[/code]Out put is :1delete 3delete 5delete 7delete 9delete 11delete 13delete 15delete Quote Link to comment Share on other sites More sharing options...
trq Posted January 25, 2007 Share Posted January 25, 2007 can we see a sample of the output? That code shouldn't possibly skipp any records. Quote Link to comment Share on other sites More sharing options...
dodgei Posted January 25, 2007 Author Share Posted January 25, 2007 Thats weird, it shows skipped records when its in the browser but when I click to view the source codeall of the records are there.Whats going on?? Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 25, 2007 Share Posted January 25, 2007 You never close your link. Try this[code=php:0]echo '<a href="' . $_SERVER['PHP_SELF'] . '?action=delete&row_id='. $r->EntryID . '">delete</a>'."\n";[/code] Quote Link to comment Share on other sites More sharing options...
dodgei Posted January 25, 2007 Author Share Posted January 25, 2007 I get this error when I try that,PHP Parse error: parse error, unexpected T_ECHO in C:\Inetpub\wwwroot\QualityInn\alpaha.php on line 11 I thought "/a" ended the link. Quote Link to comment Share on other sites More sharing options...
trq Posted January 25, 2007 Share Posted January 25, 2007 [code=php:0]echo "<a href=\"{$_SERVER['PHP_SELF']}?action=delete&row_id={$r->EntryID}\">delete</a>\n"[/code] Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 25, 2007 Share Posted January 25, 2007 Yes but you never had the closing " on the href.I don't see a problem with mine, but if escaping the double quotes works better, do that. Quote Link to comment Share on other sites More sharing options...
dodgei Posted January 25, 2007 Author Share Posted January 25, 2007 Thrope,I tried the correction you suggested and I get the same thing. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 25, 2007 Share Posted January 25, 2007 echo $r->EntryID; <- does this line still have the ; on it, or did you erase it. Quote Link to comment Share on other sites More sharing options...
trq Posted January 25, 2007 Share Posted January 25, 2007 Post your current code. Quote Link to comment Share on other sites More sharing options...
dodgei Posted January 25, 2007 Author Share Posted January 25, 2007 [code]<?php$odbc = odbc_connect ('accounting', 'root', '') or die('Could Not Connect to ODBC Database!');$sql = "select * from entry order by EntryID ASC"; $results = @odbc_exec($odbc, $sql) or die("<tt>problem with $sql : " . odbc_errormsg() . "</tt>\n");while($r = @odbc_fetch_object($results)) { echo $r->EntryID; echo "<a href=\"{$_SERVER['PHP_SELF']}?action=delete&row_id={$r->EntryID}\">delete</a>\n"}odbc_close($odbc);?>[/code] Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 25, 2007 Share Posted January 25, 2007 You don't have the ; on the end of the line. 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.