SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru adammc's Avatar
    Join Date
    Aug 2004
    Location
    Cairns, Australia
    Posts
    762
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Little help with query

    Hi guys,

    How is the most efficient way to check the following:

    // check if this made a product inactive - 0 in stock

    PHP Code:
    $inv_query "SELECT quantity FROM Products WHERE product_code='$item_id'";
        
    $inv_result mysql_query($inv_query);
        
    $inv_row mysql_fetch_array($inv_result);

    {
    *** If 
    quantity is less than 1 (zero in stock or minusthen do something.


  2. #2
    Non-Member thewebhostingdir's Avatar
    Join Date
    Oct 2005
    Posts
    703
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your logic is ok. However, you do not need to check if the quantity is minute. It will never go negative.


Bookmarks

Posting Permissions

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