I make a registration page.
So Registration page ready and fetch data with page view data.
so update option not working some errors....
attach all file zip folder with database...
Error showing this
Notice: Undefined variable: conn in C:\xampp\htdocs\registration\update.php on line 25
Fatal error: Call to a member function query() on null in C:\xampp\htdocs\registration\update.php on line 25
Fatal error: Call to a member function query() on null in C:\xampp\htdocs\registration\update.php on line 25
Please resolve.......or new code comment....
Thanks so much....
if(!isset($_GET['id']))
{
exit('User Not Exists.');
}
$mysqli = new mysqli("localhost", "root", "", "test");
// Check connection
if($mysqli === false){
die("ERROR: Could not connect. " . $mysqli->connect_error);
}
// Attempt select query execution
$sql = "SELECT * FROM record where id = ".$_GET['id'];
if($result = $mysqli->query($sql)){
if($result->num_rows > 0){
$row = $result->fetch_array();
}
}
if(isset($_POST['update']))
{
$sql = "UPDATE record SET name='".$_POST['name']."', email='".$_POST['email']."', mobile='".$_POST['mobileno']."', address='".$_POST['address']."' WHERE id=".$_GET['id'];
if ($conn->query($sql) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $conn->error;
}
}
?>
Registration
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Bharathi RajaRank #1,777 · 842 reputationPosted Apr 5, 2018, 4:28 AM EDT