This is probably something simple, but I can't see it. I need to update an entry in a mysql database, I have the form but I am not seeing the info being passed, it passes the ID. It's just not updating anything but the id in the mysql table. I think that the version of php is 5. I can echo a value from the form in this script and it is bringing values across (I think), but the mysql isn't getting updated. I know it would have to be my dopey code after the SET function, but I have no clue what the problem is. nay help would be appreciated!
Here's the code for the mysql updater:
<?php include("settings.php");
// Connect to server and select database.
mysql_connect("$hostname", "$username", "$password")or die("cannot connect");
mysql_select_db("$databasename")or die("cannot select DB");
// update data in mysql database
$sql="UPDATE $table SET date='$date', artist='$artist', venue='$venue', address='$address', time='$time' WHERE id='$id'";
$result=mysql_query($sql);
?>
<span class="body">Info Being Passed<br />id, date, artist, venue, address, time<br />
<?php
// if successfully updated.
if($result){
echo mysql_query($sql) or die (mysql_error());
}
else {
echo "ERROR";
}
?>
Won't update mysql form
Moderator: General Moderators
-
mikeashfield
- Forum Contributor
- Posts: 159
- Joined: Sat Oct 22, 2011 10:50 am
Re: Won't update mysql form
I don't see you get the data passed from the HTML form? Please paste ALL of your code here so we can better understand what you're doing