If statement with two conditions
Posted: Thu Mar 11, 2004 2:28 am
Hi All,
I'm a php newbie, and I'm having trouble creating this if statement with two conditions in it. Here's what I'm trying to get (some of my code is in dutch, but that's only my email body): I want two conditions in my bold if statement. I've pasted my code at the bottom of this email.
I've tried this, which I think should work:
the problem is in the $payment_method. I'm trying to define it by using a mysql query, but I'm having trouble assigning the query's value to $payment_method.
So my code should be something like this:
But this doesn't work, can anybody please tell me how to get this single result that comes out of my database (it's always one value) to $payment_method?
Thanks alot!
Vestax
EDITED BY BECH100: PLEASE USE BBCODE TO HIGHLIGHT YOUR CODE
I'm a php newbie, and I'm having trouble creating this if statement with two conditions in it. Here's what I'm trying to get (some of my code is in dutch, but that's only my email body): I want two conditions in my bold if statement. I've pasted my code at the bottom of this email.
I've tried this, which I think should work:
Code: Select all
if ($orders_status_array[$status] == "In behandeling") && ($payment_method == "COD") {So my code should be something like this:
Code: Select all
$result = mysql_query("SELECT `payment_method` FROM `orders` WHERE `orders_id` = '$oid'")
or die(mysql_error());
$row = mysql_fetch_array($result);
$payment_method = $row['payment_method']);Thanks alot!
Vestax
Code: Select all
if (tep_not_null($action)) {
switch ($action) {
case 'update_order':
$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
$status = tep_db_prepare_input($HTTP_POST_VARS['status']);
$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
$order_updated = false;
$check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
$check_status = tep_db_fetch_array($check_status_query);
$check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");
$check_status = tep_db_fetch_array($check_status_query);
if ( ($check_status['orders_status'] != $status) || tep_not_null($comments)) {
tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int)$oID . "'");
$customer_notified = '0';
if (isset($HTTP_POST_VARS['notify']) && ($HTTP_POST_VARS['notify'] == 'on')) {
$notify_comments = '';
if (isset($HTTP_POST_VARS['notify_comments']) && ($HTTP_POST_VARS['notify_comments'] == 'on')) {
$notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
}
[b] if ($orders_status_array[$status] == "In behandeling") [/b]
{
$email = "Geachte Heer/Mevrouw, " . $payment_method . "\n\n\n" . "Uw bestelling bij " . STORE_NAME . " is in behandeling genomen, als u ervoor heeft gekozen om het bedrag vooraf over te maken, dan kunt u onderaan deze email de betalingsgegevens vinden." . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . "Betalingsgegevens:" . "\n\n" . "Soul2Soul Kidz" . "\n" . "Girorekening: 6945424 \n" . "Plaats: Eindhoven" . "\n" . "Omschrijving: Bestelnummer " . $oID . $payment_method . "\n\n" . "Zodra uw betaling binnen is zullen de kleren verstuurd worden." . "\n\n" . "Met Vriendelijke Groet," . "\n\n\n" . "Soul2Soul Kidz";
}
else {
$email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
}