Robert Granlund
asked on
Query Syntax With LIKE
I have a variation on a question I asked earlier . How do I use LIKE in the following query and then in creating the variables?
Line 7 and Line 20;
Line 7 and Line 20;
$check_alt = "SELECT meta_value, meta_key
FROM wp_woocommerce_order_itemmeta
WHERE (meta_key = 'Bicycle Info - Primary Operator First Name'
OR meta_key = 'Bicycle Info - Primary Operator Last Name'
OR meta_key = 'Bicycle Info - Bicycle Serial Number'
OR meta_key = '_line_total'
OR meta_key LIKE 'Custom Price - Bicycle Liability %')
AND order_item_id = :order_id ";
$checking_alt = $pdo->prepare($check_alt);
$checking_alt->execute(array(':order_id' => $order_id)) or die(print_r($checking_alt -> errorInfo()));
$res_alt = $checking_alt->fetchAll();
if ($res_alt) {
foreach ($res_alt as $rows) {
if($rows->meta_key == "_line_total") {
$total = $rows->meta_value;
}
elseif($rows->meta_key == 'Custom Price - Bicycle Liability') {
$total_liabil = $rows->meta_value;
}
}
}
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
ASKER