UPDATE a MySQL row -- Need Help --
Posted: Fri Aug 20, 2004 8:30 pm
I am posting an items 'id' from the url http://www.onestopauctionshop.net/spinc ... elling.php so that I can change the status of an item from 'status = selling' to 'status ='sold'
I am getting a bunch of errors, which you will see if you click on the "Mark Sold!" link from the above url.
I am getting a bunch of errors, which you will see if you click on the "Mark Sold!" link from the above url.
Code: Select all
<?php
$P_id = $_GET['id'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
// A query to select the item 'id'
$sql = "SELECT id FROM bookmark WHERE status='selling'";
if (!$queryResource = mysql_query($sql, $dbConn)) {
trigger_error('Query error ' . mysql_error() . ' SQL: ' . $sql);
}
// Fetch a single row from the result
$row = mysql_fetch_array($queryResource, MYSQL_ASSOC);
// A new title
$title = 'sold';
$sql = "UPDATE bookmark SET status='$title' WHERE id='$P_id'" . $row['id'] . "'";
if (!$queryResource = mysql_query($sql, $dbConn)) {
trigger_error('Query error ' . mysql_error() . ' SQL: ' . $sql);
}
echo "Sold! <a href='http://onestopauctionshop.com/spinco/AdMiN.htm'>Back</a>";
?>