Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selection problem 1

Status
Not open for further replies.

z3phir

Programmer
Joined
Dec 15, 2002
Messages
16
Location
RO
hi ! i use this to get the value of a row from a database

$string = "select * from voci where formid='$formid'";
$result=mysql_query($string);
$row=mysql_fetch_array($result);
$vociid = $row[vociid];

it works great but i have one problem i need to get the smallest value from all rows that works with the select condition. 10x in advance
 
smallet value of what?

Use combination of order by clause and LIMIT.

eg
Code:
$string = "select * from voci where formid='$formid' order by formid LIMIT 1";// replace formid with the fieldname of swhich smallest value u want



--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top