In 2dys code, m trying best for updating values on the basis of id coumn value but its not updating... thn i tried to target data using select command.. nd it shws d result thr4 now m confused wth update command... plss chkout ths code as well...
<?php
$host="localhost";
$username="root";
$password="";
$db_name="new";
$tbl_name="web_members";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$id=$_GET['id'];
echo $id, $name, "<hr>";
echo $rows['id'], "<hr>";
$b="Select * from $tbl_name where id='$id'";
$result=mysql_query($b);
while($rows=mysql_fetch_array($result))
{
echo $rows['id'], "<hr>";
echo $rows['name'], "<hr>";
echo $rows['lastname'], "<hr>";
echo $rows['email'], "<hr>";
}
// Having problem in update data in mysql database
$sql="UPDATE $tbl_name set name='$name', lastname='$lastname', email='$email' where id='$id'";
$result=mysql_query($sql);
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='list_records.php'>View result</a>";
}
else {
echo "ERROR";
}
?>