Jump to content


Profile Editor (MySql & PHP)


1 reply to this topic

#1 Crofty

    Young Padawan

  • Members
  • Pip
  • 32 posts

Posted 29 August 2006 - 07:17 PM

hey, i am currently trying to make a profile editing system for my memebers on my site but seem to have a bit of trouble

the code i am using is
mysql_query("UPDATE `users` SET `username` = '$username' WHERE `street1`= '$street1' AND `street2` = '$street2' AND `town` = '$town' AND `county` = '$county' AND `postcode` = '$postcode' AND `country` = '$country' AND `email` = '$email'");

is this the correct way to use it or what?

thanks

#2 Demonslay

    P2L Jedi

  • Members
  • PipPipPip
  • 970 posts
  • Gender:Male
  • Location:A strange world where water falls out of the sky... for no reason.
  • Interests:Graphic Design, Coding, Splinter Cell, Cats

Posted 29 August 2006 - 08:02 PM

Nope, the AND keyword only should be needed with clauses such as WHERE.
Also that code probably wouldn't do anything since you are saying you need to update the username where all of those variables are equal to the post data (I presume).

mysql_query("UPDATE `users` SET username='$username' , street1='$street1' , street2='$street2' , town='$town' , county='$county' , postcode='$postcode' , country='$country' , email='$email' WHERE username=$_POST[id]");

There ya go, that should work for ya. :ph34r:

You should also add the WHERE clause for the username or something like I tried at the end there. I'm not quite sure how you are verifying or getting which user to update, but that's how you would do it.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users