Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Select Statement

Status
Not open for further replies.

Bandit99

Technical User
Oct 1, 2001
1
US
Hopefully this isn't a stupid question but I'm new to php and mysql and this is confusing the heck out of me. Can someone put me out of my misery and tell me why this doesn't work:

This select statement works fine -
$dl_wallet_sql = "select products_id, products_name FROM " . TABLE_ORDERS_PRODUCTS . ", " . TABLE_ORDERS . " WHERE orders_products.orders_id = orders.orders_id and orders.shipping_method = 'Download'";

This in fact returns 6 records (as expected). However if I use this -
$dl_shipping_way = 'Download';
$dl_wallet_sql = "select products_id, products_name FROM " . TABLE_ORDERS_PRODUCTS . ", " . TABLE_ORDERS . " WHERE orders_products.orders_id = orders.orders_id and orders.shipping_method = '" . $dl_shipping_way . "'";

This returns 1 (the first) record where in fact the shipping_method <> Download. Can someone please explain why it doesn't work and what the correct syntax should be. Unfortunately I need the second method to work because it gets the 'Download' text from a language file and I want language support.

Many thanks

Nigel



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top