
August 21st, 2004, 07:42 AM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 4
Time spent in forums: 27 m 8 sec
Reputation Power: 0
|
|
|
UPDATE a MySQL row -- Need Help --
I am posting an items 'id' from the url http://www.onestopauctionshop.net/spinco/admin_allusersselling.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.
Basicaly, I want it to $_GET the id from the url, then take that id number and change the status column for that item from 'selling' to 'sold.' Is there a better way to maintain the status of an item (i.e.- selling, sold and shipped). I just need a way to keep track of an item while its being processed.
PHP Code:
<?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>"; ?>
|