Hi,
I am trying to delete a record from a table and nothing is responding. Check out my code:
<body>
<?
$sql = "Update stud set name='$name', email='$email', password='$password', department='$department' where rowid=$rowid";
$connection = mysql_connect("localhost","univrel","univrel") or die ("Couldn't connect to server.");
$db = mysql_select_db("univrel",$connection) or die ("Couldn't connect to database.");
$sql_result = mysql_query($sql, $connection);
// echo("$sql_result");
// echo("Record updated!");
?>
<br><br>
<a href="records.php3"><b>Back</b></a>
</body>
When i echo each line, my $sql code returns the new values but the execution $sql_result does not return the updated values. I think that is very weird.
This is my modify code table records i want to update:
<body>
<form action="update.php3?rowid=$rowid" method="post">
<b><h1>Modify selected fields below.</h1></b>
<?
$sql = "select * from stud where rowid=$rowid";
$connection = mysql_connect("localhost","univrel","univrel") or die ("Couldn't connect to server.");
$db = mysql_select_db("univrel",$connection) or die ("Couldn't connect to database.");
$result = mysql_query($sql, $connection);
$row = mysql_fetch_object($result);
$resultentry["name"] = $row->name;
$resultentry["email"] = $row->email;
$resultentry["password"] = $row->password;
$resultentry["department"] = $row->department;
printf("Enter Name:<br>
<input type=text name=name value='%s'><br><br>
", $resultentry["name"]);
printf("Email Address:<br>
<input type=text name=email value='%s'><br><br>
", $resultentry["email"]);
printf("Assigned Password:<br>
<input type=password name=password value='%s'><br><br>
", $resultentry["password"]);
printf("Department:<br>
<input type=text name=department value='%s'><br><br>
", $resultentry["department"]);
printf("</table>\n");
printf("<input type=Submit value=Update>");
printf("</form");
mysql_free_result($result);
?>
</form>
</body>
Can you help?