This is my first time so please be patient with me. I have tried and tried without success! My database has 7 fields with the last one being 'id' as key and auto increment I am trying to update one or all of the fields in 1 record only. However I just get a new record with all previous data except id is incremented by 1. This is my code:
<?php
$error = '';
ini_set('display_errors', 1);
session_start();
if(!isset($_SESSION['login_user'])){ // If session is not set then redirect to Login Page
header("Location:Login.php");
}
// grab connection code
$login_id = $_SESSION['login_id'];
include "connection.php";
$query = "SELECT * FROM bvoa_login WHERE id = '$login_id'";
// get result
$result = $conn->query($query);
//create array of result
$row = $result->fetch_assoc();
// set existing data into variables
$curr_name = $row["name"];
$curr_username = $row["username"];
$curr_email = $row["email"];
$curr_property_no = $row["property_no"];
$curr_website = $row["website"];
if($_SERVER["REQUEST_METHOD"] == "POST") {
if (!empty($_POST['username']) && !empty($_POST['email'])
&& !empty($_POST['new_password']) && !empty($_POST[ 'password_confirm']) && !empty($_POST['location']) && !empty($_POST['real_name'])){
$username = $_POST['username'];
$real_name = $_POST['real_name'];
$email = $_POST['email'];
$new_password = $_POST['new_password'];
$password_confirm = $_POST['password_confirm'];
$location = $_POST['location'];
$website = $_POST['website'];
// compare passwords...
if (strcmp($new_password, $password_confirm) == 0){
$password_hash = sha1($new_password);
$query = "UPDATE `bvoa_login` SET `username`='$username' WHERE `id`='$login_id'";
$result = $conn->query($query);
}else{
$error = "Passwords do not match.";
}
}else{
$error = "You must enter all fields to continue.";
}
$conn->close();
}
?>
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I am setting up a Paypal sandboxEverything works fine
I've tried doing my research on my issue but have not been able to solve itI'm attempting to Ajax POST on click
I need to send both key value pair parameters and HTTP body content (in this case, an XML string) using PHPcURL is my go to method for similar tasks, but I can't figure out how to send both with a single cURL Post request
I'm creating a mobile app when the user is logged in the page redirects to homephp and the URL changes, how to redirect without changing URL?