OK (here i go again - sorry) - I'm trying to check to see whether a variable outputted from a database is empty or not. I think that this should work:
if (!empty($type2)) {
$quantity3 = $quantity2 + 1 ;
$sql = "UPDATE `basket` SET `quantity`='$quantity3' WHERE `sessid`='$sessid' AND `itemid`='$itemid' AND `type`='$type'";
// execute SQL query and get result
$sql_result3 = mysql_query($sql,$db);
So, above, i check to see whether it contains something, if it does, I update the quantity. Works fine.
} else {
// create SQL statement
$sql = "
insert into basket values ('','$sessid','$itemid','1','$type') ";
// execute SQL query and get result
$sql_result2 = mysql_query($sql,$db);
}
This should add a new record if the returned variable is empty (i.e ""), but it doesn't! Am i missing someting obvious again?