Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2010
    Posts
    47
    Thanks
    0
    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 );

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •