deemar Posted August 30, 2006 Share Posted August 30, 2006 This is the code i am working with:[CODE]<?php//$result = mysql_query("SELECT * FROM zen_orders Where orders_id=".$_GET['order_id']);$sql = "SELECT * FROM zen_orders_total Where orders_id=".$_GET['order_id'];$result = mysql_query($sql) or die(mysql_error());$row = mysql_fetch_array($result)?><?php$ot_shipping_amount=$row['class->ot_shipping'];$ot_total_amount=$row['class->ot_total'];//echo $ot_shipping_amount;if ($ot_shipping_amount>0) {echo "<a target='_blank' href='https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&[email protected]&item_name=Online_Order&item_number=&amount=$ot_total_amount&no_shipping=2&no_note=1¤cy_code=USD&bn=PP-BuyNowBF&charset=UTF-8'>Please click here to Pay.</a>";}else{echo "Your shipment total has not been updated.";}?>[/CODE]Here is a link to view the table i am working with.[URL=http://onpointsys.com/table.jpg]http://onpointsys.com/table.jpg[/URL]What i am tryint to achieve:I would like to SELECT a clause with two Where's. Example, one by order_id from the URL which i have already done and also by the class column which has a value of ot_shipping but must also query the data in the value column .Then i am trying to create an if statement where if the ot_shipping value is greater than zero display the link if not echo the text above.So at the end i am trying to get the following results.order_id=1 and ot_shipping=144.2700 so that i can then place ot_shipping in a variable.Any ideas? Link to comment https://forums.phpfreaks.com/topic/19151-php-select-where-clause-has-multiple-requests/ Share on other sites More sharing options...
fenway Posted August 30, 2006 Share Posted August 30, 2006 Just add another piece to the WHERE clause... what are you unsure about? Link to comment https://forums.phpfreaks.com/topic/19151-php-select-where-clause-has-multiple-requests/#findComment-82873 Share on other sites More sharing options...
deemar Posted August 30, 2006 Author Share Posted August 30, 2006 Not sure had to actually add the other piece to the Where clause. I think there is an AND in there but i can't get the correct syntax.I think. Link to comment https://forums.phpfreaks.com/topic/19151-php-select-where-clause-has-multiple-requests/#findComment-82887 Share on other sites More sharing options...
fenway Posted August 30, 2006 Share Posted August 30, 2006 Post whatever you have so far. Link to comment https://forums.phpfreaks.com/topic/19151-php-select-where-clause-has-multiple-requests/#findComment-82986 Share on other sites More sharing options...
deemar Posted August 30, 2006 Author Share Posted August 30, 2006 [code]<?php//$result = mysql_query("SELECT image_name from photo_album WHERE file_name=".$_GET['username'],$db); //$result = "SELECT * FROM zen_orders_total Where orders_id='15' AND class='ot_shipping'//UNION//SELECT * FROM zen_orders_total Where orders_id='1' AND class='ot_total'";$result = "select orders_id, (select value from zen_orders_total where orders_id=15 and class='ot_total') as total, (select value from zen_orders_total where orders_id=15 and class='ot_shipping') as shipping from zen_orders_total where orders_id";//$result11 = mysql_query($result) or die (mysql_error());$row = mysql_fetch_array($result)?><?php$shipping_total=$result['shipping'];$transfer_total=$result['total'];if ($shipping_total>0) {echo "<a target='_blank' href='https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&[email protected]&item_name=Online_Order&item_number=&amount=$transfer_total&no_shipping=2&no_note=1¤cy_code=USD&bn=PP-BuyNowBF&charset=UTF-8'>Please click here to Pay.</a>";echo $shipping_total;echo $transfer_total;}else{echo 'Your shipment total has not been updated.';echo $shipping_total;echo $transfer_total;}?>[/code] Link to comment https://forums.phpfreaks.com/topic/19151-php-select-where-clause-has-multiple-requests/#findComment-83032 Share on other sites More sharing options...
fenway Posted August 31, 2006 Share Posted August 31, 2006 That's a very different query than what you described. Link to comment https://forums.phpfreaks.com/topic/19151-php-select-where-clause-has-multiple-requests/#findComment-83261 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.