Hi
Cannot get this to work. I have tried various combinations for the condition but still not getting the desired result.
I have a textbox array that the user can select an amount in. If an amount is entered this inserts a record in the db which has an order id. The amount selected then shows in the form against the product ordered. Should this amount be updated I put the ordered id’s into an array which I’m then trying to search against from the post variables. The problem is the condition never seems to be true or false and the new array contains all of the post data. Any suggestions greatly welcomed.
$order_items = mysql_query("SELECT orderid FROM table WHERE a=$a AND b='$b ")
or die (mysql_error());
while ($rows = mysql_fetch_array($order_items)) {
$ordered_item[] = $rows['orderid'];
}
$size_array = count($_POST['priceid']);
for ($a=0; $a<$size_array; $a++) {
if ($_POST['amount'][$a] != 0 && (array_search($_POST['orderid'][$a], $ordered_item) >= 0)) {
$session_orders[] = $_POST['orderid'][$a];
$session_orders[] .= $imageid;
$session_orders[] .= $_POST['priceid'][$a];
$session_orders[] .= $_POST['item'][$a];
$session_orders[] .= $_POST['price'][$a];
$session_orders[] .= $_POST['amount'][$a];
}
}
echo "<pre>";
print_r($session_orders);
echo "<pre>";