Php/mysql to query multiple tables

Discussion in 'PHP' started by webmaster4321, Jan 8, 2012.

  1. #1
    The following script will query the single table coupon_name successfully.

    mysql_select_db($database_MyDB, $MyDB);
    $query_GetCoupon = sprintf("SELECT * FROM submitted WHERE coupon_name LIKE %s ORDER BY total DESC", GetSQLValueString("%" . $colname_GetCoupon . "%", "text"));
    $GetCoupon = mysql_query($query_GetCoupon, $MyDB) or die(mysql_error());
    $row_GetCoupon = mysql_fetch_assoc($GetCoupon);
    $totalRows_GetCoupon = mysql_num_rows($GetCoupon);
    PHP:

    I need to query two tables being coupon_name, coupon_type

    Also, its an OR requirement. The query does not need to be true on both tables, just on one of them to display a record.

    Any help will be greatly appreciated. New to programming, trying my best.
     
    webmaster4321, Jan 8, 2012 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    you dont need to query both tables. that depends on your conditional statement in PHP.
     
    bartolay13, Jan 11, 2012 IP