Hi i have this script as follows, and i cant understand why it doesnt work. all my connections are correct and it does put values in the database...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns=" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> update record fields in the events table </title>
</head>
<body>
<center>
<?
include 'database_conn.php';
$neventCode = $_POST['neventCode']; // need this to identify the particular record
$ntitle = $_POST['ntitle'];
$nartistname = $_POST['nartistname']; // new value for artistname
$ndescription = $_POST['ndescription'];
$ntype = $_POST['ntype'];
$nstartdate = $_POST ['nstartdate'];
$nenddate = $_POST['nenddate'];
$ntime = $_POST['ntime'];
$nvenuename = $_POST['nvenuename']; // new value for venuename
$nvenueaddress = $_POST['nvenueaddress'];
$ntelephone = $_POST['ntelephone'];
$nurl = $_POST['nurl'];
//print on the screen that the record is currently being updated
echo "<h1>Updating record ... </h1>";
//command to update the events table
$sql = "UPDATE events SET title = $ntitle, artistname = $nartistname, description = $ndescription, type = $ntype, startdate = $nstartdate, enddate = $nenddate, time = $ntime, venuename = $nvenuename, venueaddress = $nvenueaddress, telephone = $ntelephone, url = $nurl, WHERE eventCode = $neventCode";
mysql_query($sql) or die (mysql_error());
echo "<h2>Record updated</h2>";
mysql_close($conn);
?>
<form name="Back to Admin" method="post" action="Administration.html">
<input type="submit" name="submit" value="Back to Admin">
</form>
</center>
</body>
</html>
and the values before and after are as follows (in the database)
mysql> select *from events;
+-----------+--------------------+-------------------------+------------------------------------+-------+------------+------------+------+-------------------+---------------------------------------------------------+-------------+---------------------------------+
| eventCode | title | artistname | description | type | startdate | enddate | time | venuename | venueaddress | telephone | url |
+-----------+--------------------+-------------------------+------------------------------------+-------+------------+------------+------+-------------------+---------------------------------------------------------+-------------+---------------------------------+
| 1 | ONE NIGHT OF QUEEN | Gary Mullen & The Works | Live in concert one night of queen | music | 2006-12-09 | 2006-12-09 | 1900 | Metro Radio Arena | Metro Radio Arena Newcastle Newcastle upon Tyne NE4 7NA | 0870 7000 9 | |
+-----------+--------------------+-------------------------+------------------------------------+-------+------------+------------+------+-------------------+---------------------------------------------------------+-------------+---------------------------------+
1 row in set (0.00 sec)
mysql> select *from events;
+-----------+---------------------------+-------------------------------+-------------------------------+----------------------+------------+------------+------+----------------------+-------------------------------+-------------+-------------------------------+
| eventCode | title | artistname | description | type | startdate | enddate | time | venuename | venueaddress | telephone | url |
+-----------+---------------------------+-------------------------------+-------------------------------+----------------------+------------+------------+------+----------------------+-------------------------------+-------------+-------------------------------+
| 1 | ?><?php echo ?>
< | ?><?php echo ?>
<?php | ?><?php echo ?>
<?php | ?><?php echo ?>
| 0000-00-00 | 0000-00-00 | ?><? | ?><?php echo ?>
| ?><?php echo ?>
<?php | ?><?php ech | ?><?php echo ?>
<?php |
+-----------+---------------------------+-------------------------------+-------------------------------+----------------------+------------+------------+------+----------------------+-------------------------------+-------------+-------------------------------+
1 row in set (0.00 sec)
Do you see any problems??
thanks
tammy
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns=" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> update record fields in the events table </title>
</head>
<body>
<center>
<?
include 'database_conn.php';
$neventCode = $_POST['neventCode']; // need this to identify the particular record
$ntitle = $_POST['ntitle'];
$nartistname = $_POST['nartistname']; // new value for artistname
$ndescription = $_POST['ndescription'];
$ntype = $_POST['ntype'];
$nstartdate = $_POST ['nstartdate'];
$nenddate = $_POST['nenddate'];
$ntime = $_POST['ntime'];
$nvenuename = $_POST['nvenuename']; // new value for venuename
$nvenueaddress = $_POST['nvenueaddress'];
$ntelephone = $_POST['ntelephone'];
$nurl = $_POST['nurl'];
//print on the screen that the record is currently being updated
echo "<h1>Updating record ... </h1>";
//command to update the events table
$sql = "UPDATE events SET title = $ntitle, artistname = $nartistname, description = $ndescription, type = $ntype, startdate = $nstartdate, enddate = $nenddate, time = $ntime, venuename = $nvenuename, venueaddress = $nvenueaddress, telephone = $ntelephone, url = $nurl, WHERE eventCode = $neventCode";
mysql_query($sql) or die (mysql_error());
echo "<h2>Record updated</h2>";
mysql_close($conn);
?>
<form name="Back to Admin" method="post" action="Administration.html">
<input type="submit" name="submit" value="Back to Admin">
</form>
</center>
</body>
</html>
and the values before and after are as follows (in the database)
mysql> select *from events;
+-----------+--------------------+-------------------------+------------------------------------+-------+------------+------------+------+-------------------+---------------------------------------------------------+-------------+---------------------------------+
| eventCode | title | artistname | description | type | startdate | enddate | time | venuename | venueaddress | telephone | url |
+-----------+--------------------+-------------------------+------------------------------------+-------+------------+------------+------+-------------------+---------------------------------------------------------+-------------+---------------------------------+
| 1 | ONE NIGHT OF QUEEN | Gary Mullen & The Works | Live in concert one night of queen | music | 2006-12-09 | 2006-12-09 | 1900 | Metro Radio Arena | Metro Radio Arena Newcastle Newcastle upon Tyne NE4 7NA | 0870 7000 9 | |
+-----------+--------------------+-------------------------+------------------------------------+-------+------------+------------+------+-------------------+---------------------------------------------------------+-------------+---------------------------------+
1 row in set (0.00 sec)
mysql> select *from events;
+-----------+---------------------------+-------------------------------+-------------------------------+----------------------+------------+------------+------+----------------------+-------------------------------+-------------+-------------------------------+
| eventCode | title | artistname | description | type | startdate | enddate | time | venuename | venueaddress | telephone | url |
+-----------+---------------------------+-------------------------------+-------------------------------+----------------------+------------+------------+------+----------------------+-------------------------------+-------------+-------------------------------+
| 1 | ?><?php echo ?>
< | ?><?php echo ?>
<?php | ?><?php echo ?>
<?php | ?><?php echo ?>
| 0000-00-00 | 0000-00-00 | ?><? | ?><?php echo ?>
| ?><?php echo ?>
<?php | ?><?php ech | ?><?php echo ?>
<?php |
+-----------+---------------------------+-------------------------------+-------------------------------+----------------------+------------+------------+------+----------------------+-------------------------------+-------------+-------------------------------+
1 row in set (0.00 sec)
Do you see any problems??
thanks
tammy