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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.