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 );
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.
|All times are GMT +1. The time now is 01:31 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.