Modifying a record works but not in actual database?
| From: | lmlweb@mybc.com | Date: | Sat, 09 Feb 2002 16:47:46 +0000 |
| Subject: | Modifying a record works but not in actual database? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-84109@lists.php.net to get a copy of this message | ||
I'm trying to set up a "modify record" page, and after testing and triple-checking
the syntax and form, and even running the query in the phpMyAdmin interface
to make sure the query is correct.
This is just a snippet of what I've done:
<?php
// open connection
include ("connectdatabase.inc");
// format names to protects the O'Haras etc.
$esc_fname = addslashes($fname);
$esc_lname = addslashes($lname);
$esc_email = addslashes($email);
$esc_web = addslashes($web);
// set up query
$sql = 'UPDATE thistable
SET FNAME = "$esc_fname", LNAME = "$esc_lname", EMAIL
= "$esc_email", WEB = "$esc_web"
WHERE ID = "$id"';
// perform query
$sql_result = mysql_query($sql);
if (!$sql_result) {
echo "Can't execute $sql " . mysql_error();
exit;
}
// close connection
mysql_close($connection);
?>
The problem? On the PHP front (my "mofidy record" page) says it's performed
without a problem. However, if I were to do a "view all records" - I
can see that none of the changes has actually been made to the database.
Adding a record is not a problem; nor is deleting a record.
Can someone point me into the right direction as to what I might be doing
wrong?
Thanks!
Laurie Landry