phpfreaks,
I'm new to php and I need to edit some records which I have displayed from mysql.The displaying of the records works well but now I want to be able to put a particular record in a form and edit.This is the code for displaying the records:
<?
$db=mysql_pconnect("localhost","","");
if(!$db)
{
echo "Error:unable to connect to database server";
exit;
}
mysql_select_db("test");
$query="select * from customers";
$result=mysql_query($query);
$num_results=mysql_num_rows($result);
echo "<p class=\"title\">Number of customers found ".$num_results."</p>";
?>
<table width=75% border=0 cellpadding=2 cellspacing=0>
<tr class="title" bgcolor="#FF9900"><td>Customerid</td>
<td>Name</td>
<td>Address</td>
<td>City</td></tr>
<?
for($i=0;$i<$num_results;$i++)
{
$row=mysql_fetch_array($result);
if($i%2){
echo"<tr bgcolor=\"#CCCCCC\" class=\"details\">\n";
}
else{
echo"<tr bgcolor=\"white\" class=\"details\">\n";
}
echo"<td>".($i+1)."</td>\n";
echo"<td><a href=edit.php?id=".($row["customerid"]).">".($row["name"])."</a></td>\n";
echo"<td>".($row["address"])."</td>\n";
echo"<td>".($row["city"])."</td>\n";
echo"</tr>";
}
echo "</table>";
?>
I want that when somebody clicks on the particular customer link the value of the records are transferred to a form which I can then edit.
Please help me.
Cheers