|
Posted by Lag on 02/23/06 07:10
Having a problem updating my database from a web page, through a
submission form. Can anyone help?
----THIS IS MY CODE IN update.php----(user, pass, and database are
typed in directly, I changed them here for securiy reasons :) )
<?php
/*---CONNECT TO DATABASE---*/
$conn = mysql_connect("localhost", "user", "pass") or
die(mysql_error());
mysql_select_db("database",$conn) or die(mysql_error());
$event = $_GET["id"];
$title=$_POST['title'];
$date=$_POST['datetime'];
$desc=$_POST['desc'];
//---UPDATE ENTRY IN DATABASE---
$query = "UPDATE 'calendar_events' SET 'event_title' = '$title',
'event_start' = '$date', 'event_shortdesc' = '$desc' WHERE 'id' =
$event";
//LIST ITEMS
echo "$event $title $date $desc";
mysql_query($query);
echo "Record Updated";
mysql_close();
?>
-----------------------THIS IS THE
OUTPUT-------------------------------------
TEST changed 2006-02-22 06:00:00 TESTING EDITINGRecord Updated
--------------------------------------------------------------------------------------------
The original information was "TEST 2006-02-22 06:00:00 TESTING EDITING"
I changed "TEST" to "TEST changed" in the submit form on a previous
page.
I included the echo to see if my information was truly getting passed,
it is. I passed the id, title, event_start, and event_shortdesc from
the previous page where the submission form is located. Why isn't my
database entry (row) updating? Please help.
Navigation:
[Reply to this message]
|