Warptweet Posted April 15, 2007 Share Posted April 15, 2007 I use the old code below to fetch information from the database... $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $result = mysql_query("SELECT * FROM person WHERE FirstName='Peter'"); while($row = mysql_fetch_array($result)) { echo $row['FirstName'] . " " . $row['LastName']; echo "<br />"; } Well, how can I return a row (with LIMIT 1) with upload_votes AT LEAST 3, and with the HIGHEST upload_rating of all the rows in the database table? Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/47054-find-the-highest-number-in-table/ Share on other sites More sharing options...
MadTechie Posted April 15, 2007 Share Posted April 15, 2007 $result = mysql_query("SELECT * FROM person WHERE FirstName='Peter' AND upload_votes >= 3 ORDER BY upload_votes ASC LIMIT 1"); Link to comment https://forums.phpfreaks.com/topic/47054-find-the-highest-number-in-table/#findComment-229502 Share on other sites More sharing options...
Barand Posted April 15, 2007 Share Posted April 15, 2007 Haven't a clue since I have no idea what the database/table structure is. All we know your post is that you have a table named "person" with columns firstname and lastname. Those with telepathic abilities (like MadTechie) may be able to help Link to comment https://forums.phpfreaks.com/topic/47054-find-the-highest-number-in-table/#findComment-229505 Share on other sites More sharing options...
MadTechie Posted April 15, 2007 Share Posted April 15, 2007 Well i just done a CICO, C*** In C*** OUT if it works i am the dog's ... if not then oh well PS it's called OT Overseas Telepathic basically the same but costs a little more and also a bit fuzzy at times Link to comment https://forums.phpfreaks.com/topic/47054-find-the-highest-number-in-table/#findComment-229510 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.