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.


 Subscribe in a reader

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

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Nov 9th, 2006, 15: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 16:20.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Nov 9th, 2006, 16:13
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Login Register help

You have set-up your sql string in one variable but used a different variable in your execution.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Nov 9th, 2006, 16: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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Nov 9th, 2006, 17:10
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Login Register help

You also have single quotes around what are supposed to be variables thereby turning them into string constants.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Nov 9th, 2006, 17: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).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Nov 10th, 2006, 13: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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Nov 10th, 2006, 22: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!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
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 18:19


All times are GMT. The time now is 14:04.


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