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 you use the LIMIT function like this in php

    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
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,023
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Depends on what you mean by "first".

    That will give the one matching the city, state, and city that has the lowest *account number*.

    Which might be okay, but might be completely useless.

    How can we guess?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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