You are here: QUERY AND UPDATE PROBLEM « PHP Programming Language « IT news, forums, messages
QUERY AND UPDATE PROBLEM

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация