When you click on save it is passed through to a saveitem.php - this seems to work with a successful "Successfully saved the entry." message however nothing updates!
help.
thanks
Code: Select all
<html>
<body>
<?php
$username="xxxx";
$password="xxxx";
$database="xxxx_xxxx";
// saving script
// connect to the server
mysql_connect( 'localhost', $username, $password )
or die( "Error! Could not connect to database: " . mysql_error() );
// select the database
mysql_select_db( $database )
or die( "Error! Could not select the database: " . mysql_error() );
// get the variables from the URL request string
$id = $_REQUEST['id'];
$contact_nfirst = $_REQUEST['contact_nfirst'];
$contact_nlast = $_REQUEST['contact_nlast'];
$contact_email = $_REQUEST['contact_email'];
$contact_phone = $_REQUEST['contact_phone'];
$car_make = $_REQUEST['car_make'];
$car_model = $_REQUEST['car_model'];
$car_year = $_REQUEST['car_year'];
$car_mileage = $_REQUEST['car_mileage'];
$car_price = $_REQUEST['car_price'];
$car_type = $_REQUEST['car_type'];
$car_info = $_REQUEST['car_info'];
$car_pbracket = $_REQUEST['car_pbracket'];
// if $id is not defined, we have a new entry, otherwise update the old entry
if( $id )
{
$query = "UPDATE table SET contact_nfirst='$contact_nfirst', contact_nlast='$contact_nlast', contact_email='$contact_phone', car_make='$car_make', car_model='$car_model', car_year='$car_year', car_mileage='$car_mileage', car_price='$car_price', car_type='$car_type', car_info='$car_info', car_pbracket='$car_pbracket' WHERE 'id'='$id'";
}
else
{
$query = "INSERT INTO newsstuf_usedcars ( 'contact_nfirst','contact_nlast','contact_email','contact_phone','car_make','car_model','car_year','car_mileage','car_price','car_type','car_info','car_pbracket' )
VALUES ( '$contact_nfirst','$contact_nlast','$contact_email','$contact_phone','$car_make','$car_model','$car_year','$car_mileage','$car_price','$car_type','c$ar_info','$car_pbracket' )";
}
// save the info to the database
$results = mysql_query( $query );
// print out the results
if( $results )
{
echo( "Successfully saved the entry." );
}
else
{
die( "Trouble saving information to the database: " . mysql_error() );
}
?>
</body>
</html>feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]