PHP Login Register help

This is a discussion on "PHP Login Register help" within the PHP Forum section. This forum, and the thread "PHP Login Register help are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 9th, 2006, 14:50
Junior Member
Join Date: Jul 2006
Location: UK
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Login Register help

Hey

I'm having an issue that I can't find the answer to on google. Im creating a login and register system, only it is by invitation only so the person has to enter their details which get checked with the details on the database before they are allowed to create an account.

I am now writing the bit that inserts the password, heres my code:

Code: Select all
$query= "INSERT INTO members (password) VALUES ('$password') WHERE name='$name' and email='$email'";

$result = mysql_query($query) or die ('Could not execute query');
How do I insert the password into the specific row? I get could not execute query. The idea if that it finds the correct row by matching the name and email... any ideas?

Thanks

Last edited by atlaskid; Nov 9th, 2006 at 15:20.
Reply With Quote

  #2 (permalink)  
Old Nov 9th, 2006, 15:13
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: PHP Login Register help

You have set-up your sql string in one variable but used a different variable in your execution.
Reply With Quote
  #3 (permalink)  
Old Nov 9th, 2006, 15:21
Junior Member
Join Date: Jul 2006
Location: UK
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Login Register help

Hey, thanks for pointing that out but I changed the for the purpose of this post, it wouldnt work with it the way itis now.
Reply With Quote
  #4 (permalink)  
Old Nov 9th, 2006, 16:10
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: PHP Login Register help

You also have single quotes around what are supposed to be variables thereby turning them into string constants.
Reply With Quote
  #5 (permalink)  
Old Nov 9th, 2006, 16:42
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Login Register help

Quote:
Originally Posted by ukgeoff View Post
You also have single quotes around what are supposed to be variables thereby turning them into string constants.
I think the single quotes are fine where you have them. Your main string is double quoted which is fine. However, the INSERT inserts a new row which isn't what you want to do, I don't think - you're looking for an UPDATE to change the password in an existing row or a REPLACE to replace a complete row (but the syntax of that would be different).
Reply With Quote
  #6 (permalink)  
Old Nov 10th, 2006, 12:56
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Login Register help

Use UPDATE.
Reply With Quote
  #7 (permalink)  
Old Nov 10th, 2006, 21:34
Junior Member
Join Date: Jul 2006
Location: UK
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Login Register help

Thanks!!
Reply With Quote
Reply

Tags
login, php, register

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Login/register alexgeek PHP Forum 63 Jul 31st, 2007 11:42
some type of member login/register system Lucid. Web Page Design 22 Feb 3rd, 2006 17:19


All times are GMT. The time now is 18:34.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43