Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
06-19-2013, 03:11 PM #1
- Join Date
- Jul 2010
- Thanked 0 Times in 0 Posts
can php LIMIT function work like this
is this correct to find the first record of Royalty creditor Distributor given country, state , city
$SQLDISTRIBUTOR = " SELECT * FROM DISTRIBUTOR ";
$SQLDISTRIBUTOR.= " WHERE COUNTRYCOD =" . $_SESSION['COUNTRYCOD'];
$SQLDISTRIBUTOR.= " AND STATECOD =" . $_SESSION['STATECOD'];
$SQLDISTRIBUTOR.= " AND CITYCOD =" . $_SESSION['CITYCOD'];
$SQLDISTRIBUTOR.= " ORDER BY ACCOUNT_NUMBER ASCENDING LIMIT 1 ";
$FDISTRIBUTOR = mysql_query( $SQLDISTRIBUTOR, $CON );
06-19-2013, 03:46 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,659 Times in 2,628 Posts
PHP doesn't have a LIMIT function. I presume you mean MySQL which has a proprietary LIMIT available for SQL.
That will find one record yes. It is the "first" by definition of your WHERE clauses and ORDER BY, but there is no logical assumption of "first" in a DBMS.
Since this hasn't really anything to do with PHP, I'll move this to the MySQL forum.
header('HTTP/1.1 420 Enhance Your Calm');