can't update database
Posted: Sat Dec 07, 2002 12:41 am
Hello,
I am trying to write an update script, this script is a reused script tht I've used for another db and it works there, but not here. I have allready created and add entry and delete entry with similar code
$table_name = business (name of table)
$id is variable that sends the table primary key from other page, i have a table at bottom of page that shows what is updated, And it has all the correct info, and says it was successful, but when I go back and check, it didn't update
$db = @mysql_select_db("$db_name", $connection) or die("Error2 - Couldn't connect - try again later");
$sql = "UPDATE $table_name
SET
catID = '$catID',
busName = '$busName',
busOwner = '$busOwner',
busAd = '$busAd',
busCity = '$busCity',
busPostal = '$busPostal',
busPhone = '$busPhone',
busPhone2 = '$busPhone2',
busFax = '$busFax',
busUrl = '$busUrl',
busEmail = '$busEmail',
busLogo = '$busLogo',
featured = '$featured',
keyWords = '$keyWords',
busDesc = '$busDesc'
WHERE busID = '$id'
";
$result = @mysql_query($sql, $connection) or die("Error3 - Couldn't connect - try again later");
?>
I am trying to write an update script, this script is a reused script tht I've used for another db and it works there, but not here. I have allready created and add entry and delete entry with similar code
$table_name = business (name of table)
$id is variable that sends the table primary key from other page, i have a table at bottom of page that shows what is updated, And it has all the correct info, and says it was successful, but when I go back and check, it didn't update
$db = @mysql_select_db("$db_name", $connection) or die("Error2 - Couldn't connect - try again later");
$sql = "UPDATE $table_name
SET
catID = '$catID',
busName = '$busName',
busOwner = '$busOwner',
busAd = '$busAd',
busCity = '$busCity',
busPostal = '$busPostal',
busPhone = '$busPhone',
busPhone2 = '$busPhone2',
busFax = '$busFax',
busUrl = '$busUrl',
busEmail = '$busEmail',
busLogo = '$busLogo',
featured = '$featured',
keyWords = '$keyWords',
busDesc = '$busDesc'
WHERE busID = '$id'
";
$result = @mysql_query($sql, $connection) or die("Error3 - Couldn't connect - try again later");
?>