Jump to content

Update members details


unistake

Recommended Posts

Hi all,

 

I am trying to write a script where the user can update their details.

 

The html form sends the details across to this php file below. All the php variables echo after the query however the values do not replace the current values in the mysql database.

 

Also for some reason the fname is the only one that changes no matter what the value is. It is entered in to mysql as '0'.

 

I think the problem will be in the php below.

 

As all the information below is echoed correctly, and because the value of 'fname' changes I know the connection is working fine.

I guess the error must be in the query I have written, however there is no error that comes up...

 

Hope you can point me in the right direction.

 

Thanks

 

<?php
include("../cxn.php");

$fname = $_POST['fname'];
$lname = $_POST['lname'];
$newemail = $_POST['newemail'];
$telephone = $_POST['telephone'];
$icao = $_POST['icao'];
$newpassword = $_POST['newpassword'];
$id = $_POST['id'];

$sql = "UPDATE Members SET fname='$fname' AND lname='$lname' AND email='$newemail' AND telephone='$telephone' AND password='$newpassword' AND icao='$icao' WHERE id='$id'";
$result = mysqli_query($cxn,$sql)
or die ("Couldn't execute query");

echo "Your new details are: <p>";
echo "$fname <br> $lname <br> $newemail <br> $telephone <br> $icao <br> $newpassword";

?>

Link to comment
https://forums.phpfreaks.com/topic/216080-update-members-details/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.