Jump to content

problem with putting info in MySQL.


foreverhex

Recommended Posts

I have made this code and Im still new at MySQL so I apoligize if it looks buggy. But when you go to submit the info it wont switch any thing and makes the name value 0? Here is the code, any ideas why?

[code]<?php

include 'db.php';

//Grab the reviewed user info

$user = $_POST['user'];
$password = $_POST['password'];
$name = $_POST['name'];
$email = $_POST['email'];
$age = $_POST['age'];
$sex = $_POST['sex'];
$location = $_POST['location'];
$medium = $_POST['medium'];
$interests = $_POST['interests'];
$homepage = $_POST['homepage'];

//New Password check
if ((!$password)) {

$sql = mysql_query("UPDATE users SET name='$name' AND email='$email' AND age='$age' AND sex='$sex' AND location='$location' AND medium='$medium' AND interests='$interests' WHERE user='$user'");

}

else {
$newpassword =md5($password);

$sql = mysql_query("UPDATE users SET password='$newpassword' AND name='$name' AND email='$email' AND age='$age' AND sex='$sex' AND location='$location' AND medium='$medium' AND interests='$interests' WHERE user='$user'");

if(!$sql) {
echo "There has been an error while trying to modify your account. Please report a bug in the forums or try again later.";
}
}

echo 'You information has been updated!';
?>[/code]
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.