1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Mysql query to show only active products. Please take a look

Discussion in 'MySQL' started by a4tech, Mar 25, 2013.

  1. #1
    Hello,

    I am looking for help to show only active products. This is mysql table code:

     $sql = "SELECT count(*) as total_product FROM insights_base";
    PHP:
    This is the mysql syntax that i try. But in out put in shows all Active and Inactive products. How to make it possible that it shows only Active products.

    Please help me that it shows only Active products and do not list Inactive products.
     
    Solved! View solution.
    Last edited: Mar 26, 2013
    a4tech, Mar 25, 2013 IP
  2. #2
    You should look into using PDO or mysqli as its so much more secure, mysql is soon to be deprecated.
    However if you must use mysql try this:

    $sql = "SELECT count(*) as total_product FROM insights_base where status='ACTIVE'";
    Code (markup):
     
    malky66, Mar 25, 2013 IP