saghir69
04-01-2008, 03:07 PM
I'm trying to customise a cart script to use it for my needs, but i'm a bit stuck. I've commented the code below, i hope it makes sence. can someone think of a way around?
$cartid = "hghhghg";
$sql = 'SELECT * FROM data2 WHERE id = '.$id;
$result = $db->query($sql);
$row = $result->fetch();
extract($row);
// here I need to update each item a person is ordering with a variable called cartid so i know what the person is ordering
mysql_query("UPDATE data2 SET cartid = '" . $cartid . "' WHERE id = '".$id."'"); // $cartid in this line needs to be the value i have set in line one
// but because the data from the first query is in a array. there is no way to diffrenciate between the $row data or a variable
$output[] = '<tr>';
$output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>';
$output[] = '<td>'.$type.'<br>Extra Copies</td>';
$output[] = '<td>£'.$price.'<br>£1 Each</td>';
// basically I want to run the update query with variables set in my script and not the data from the first select query. can some one help please?
$cartid = "hghhghg";
$sql = 'SELECT * FROM data2 WHERE id = '.$id;
$result = $db->query($sql);
$row = $result->fetch();
extract($row);
// here I need to update each item a person is ordering with a variable called cartid so i know what the person is ordering
mysql_query("UPDATE data2 SET cartid = '" . $cartid . "' WHERE id = '".$id."'"); // $cartid in this line needs to be the value i have set in line one
// but because the data from the first query is in a array. there is no way to diffrenciate between the $row data or a variable
$output[] = '<tr>';
$output[] = '<td><a href="cart.php?action=delete&id='.$id.'" class="r">Remove</a></td>';
$output[] = '<td>'.$type.'<br>Extra Copies</td>';
$output[] = '<td>£'.$price.'<br>£1 Each</td>';
// basically I want to run the update query with variables set in my script and not the data from the first select query. can some one help please?
