This is my code.Please tell me how to update it.How can I get values individually so that I can update my database.please help me...
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("hai", $con);
$sql = "SELECT FirstName,LastName,Age FROM persons where Age='12'";
$result = @mysql_query($sql, $con) or die("Cannot execute query.". mysql_error());
$numrow = mysql_num_rows($result);
if ($numrow != 0)
{
// fetch each record in result set
for ($counter == 0; $row = mysql_fetch_row($result); $counter++)
{
// build table to display result
print ("<form action='pp1.php' method='post'><h2><center>Member Profile</center></h2>");
print ("<table border = '1' cellpadding = '3' cellspacing = '2' style = 'background-color: #ADD8E6'>");
print ("<tr>");
print ("<th>Firstname</th>");
print ("<th>Lastname</th>");
print ("</tr>");
print ("<tr>");
foreach ($row as $key => $value)
print ("<td><input type ='text' value='$value' size = '30'></td>");
print ("</tr>");
print ("</table>");
}
}
print ("<table>");
print ("<tr>");
print ("<td> </td>");
print ("<td width='4%'> </td>");
print ("<td></tr>");
print ("<tr>");
print ("<td> </td>");
print ("<td width='4%'> </td>");
print ("<td><input type='submit' name='submit' value='Upgrade'></td>");
print ("</table></form>");
mysql_close($con);
?>