View Full Version : URGENT - PHP not working..
Basically, I have this code;
<?php
$query = "select *
from `winningflight`
order by points desc";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
echo $row['flight'];
?>
This is the table
http://i.imgur.com/qHORvn4.png
It always shows A, not B
Chippiewill
15-06-2013, 12:21 PM
I personally can't see a problem with the code, maybe add limits. Also the MySQL bindings just got deprecated, you may want to use the MySQLi ones instead.
I personally can't see a problem with the code, maybe add limits. Also the MySQL bindings just got deprecated, you may want to use the MySQLi ones instead.
I had a limit, but that didn't work:/ And I don't 100% know what that means :')
Chippiewill
15-06-2013, 01:05 PM
"LIMIT 0,1" on the end of your mysql query will return just one result starting at the first result.
I sorted it using MAX, but thanks Chippie!
In future (when your table gets a little more info) you may want to limit the query to the field names you want to return to optimise performance :)
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.