Hi ,
My earlier problem has been solved, Thanks all for the support, now i made a new page(update.php) which is used to update information, update criteria is based on the date, so for that i first fetch the information based on the date and then i am trying to update it, but my update query does'nt seem to work.
let my explain you what my script is doing below first i am fetching the data which is based on the date
using textbox, and then i take column name "TIME" and "INITIALS" into the text box which i would like to update it ,but my update query does'nt seem to work.
Please find the code below.
<form action="update.php" method="post">
<input type=text value=search name=search >
<input type=submit name=submit value=Search>
</form>
<?php
#$dates=$_POST['search'];
#echo $dates;
if(isset($_POST['submit'])) {
date_default_timezone_set('Asia/Calcutta');
$date=date("m/d/Y");
echo "Current Date Is = ";
echo "$date";
$con = mysql_connect("localhost","root","access");
if(!$con) {
die("Unable Connect To Database Server " .mysql_error());
}
$selectdb=mysql_select_db("baltimore",$con);
if(!$selectdb)
{
die ("Database Connection Error" .mysql_error());
}
$table="baltimore";
if(isset($_POST['update'])) //if update button is pressed execute the query
{
$updatequery = "UPDATE $table SET INITIALS='$_POST[initials]', TIME='$_POST[time]' WHERE DATE='{$_POST["search"]}'"; //search is the textbox name
mysql_query($updatequery,$con);
} //End of isset function
$sql= "select DATE,JOBNAME,INITIALS,TIME from $table where DATE='{$_POST["search"]}'"; //date is enter by username into the text box its working.
$mydata=mysql_query($sql,$con);
echo "<table width=100% height=10% border=1>
<tr>
<th>DATE</th>
<th>JOBNAME</th>
<th>INITIALS </th>
<th>TIME</th>
</tr>";
while($records = mysql_fetch_array($mydata)){
echo "<form action=update.php method=post>";
echo "<tr>";
echo "<td>" . $records['DATE'] . "</td>";
echo "<td>" . $records['JOBNAME'] . "</td>";
echo "<td>" . "<input type=text name=initials value=" . $records['INITIALS'] . " </td>";
echo "<td>" . "<input type=text name=time value=" . $records['TIME'] . " </td>";
echo "<td>" . "<input type=submit name=update value=update" . " </td>";
echo "</form>";
}
echo "</table>";
}
?>
Thanks In Advance
Regards
Ashish