I have a table of info setup and am in the process of writing script to edit some of the data.
I have setup two php scripts to do this, update.php and updated.php and they appear as follows:
UPDATE.php
<?
$id=$_GET['id'];
$username="tddftegh";
$password="scarlet";
$database="margaritaair_com";
mysql_connect(localhost,$username,$password);
$query=" SELECT * FROM flightlog WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$date=mysql_result($result,$i,"date");
$type=mysql_result($result,$i,"type");
$hours=mysql_result($result,$i,"hours");
$departure=mysql_result($result,$i,"departure");
$destination=mysql_result($result,$i,"destination");
$comment=mysql_result($result,$i,"comment");
<form action="updated.php" method="post">
<input type="hidden" name="ud_id" value="<? echo "$id"; ?>">
Date: <input type="text" value="ud_date" value="<? echo "$date"?>"><br>
Type of Flight: <input type="text" value="ud_type" value="<? echo "$type"?>"><br>
Time of Flight: <input type="text" value="ud_hours" value="<? echo "$hours"?>"><br>
Departure: <input type="text" value="ud_departure" value="<? echo "$departure"?>"><br>
Destination: <input type="text" value="ud_destination" value="<? echo "$destination" ?>"><br>
Comment: <input type="text" value="ud_comment" value="<? echo "$comment"?>"><br>
<input type="Submit" value="Update">
</form>
++$i;
}
and UPDATED.php
<?
$ud_id=$_POST['ud_id'];
$ud_date=$_POST['ud_date'];
$ud_type=$_POST['ud_type'];
$ud_hours=$_POST['ud_hours'];
$ud_departure=$_POST['ud_departure'];
$ud_destination=$_POST['ud_destination'];
$ud_comment=$_POST['ud_comment'];
$username="tddftegh";
$password="scarlet";
$database="margaritaair_com";
mysql_connect(localhost,$username,$password);
$query="UPDATE flightlog WHERE id='$ud_id' SET date='$ud_date' type='$ud_type' hours='$ud_hours' departure='$ud_departure' destiantion='$ud_destination' comment='$ud_comment'";
mysql_query($query);
echo "Record Updated";
mysql_close();
?>
First of all, does this look correct, and secondly I keep getting a parse error of
Parse error: unexpected '<' in /home/virtual/site61/fst/var/www/html/flightlog/update.php on line 23 when I run the code and I cannot find the error.
Thanks