Re: [PHP] To check for existing user in database

2009-01-22 Thread Lars Torben Wilson
2009/1/16 Shawn McKenzie : > Lars Torben Wilson wrote: >> 2009/1/15 tedd : >>> At 9:46 AM -0800 1/15/09, Chris Carter wrote: >>> >>> Chris: >>> >>> That's not the way I would do it. After establishing a connection with the >>> database, I would use the query: >>> >>> $query "SELECT email FROM owner

Re: [PHP] To check for existing user in database

2009-01-18 Thread tedd
At 10:36 AM -0600 1/16/09, Shawn McKenzie wrote: mysql_num_rows() may make more sense, however mysql_affected_rows() will work the same with a select. The PHP mysql_affected_rows() calls the MySQL mysql_affected_rows(), which states: "For SELECT statements, mysql_affected_rows() works like mysq

Re: [PHP] To check for existing user in database

2009-01-16 Thread Nathan Rixham
Eric Butera wrote: $result = mysql_query($query) or die(mysql_error()); You know guys, after seeing all this talk of sql injection over the past few days, I'd also like to point out or die is pretty bad too. Especially when coupled with mysql_error(). It can expose sensitive system info (secur

Re: [PHP] To check for existing user in database

2009-01-16 Thread Eric Butera
> $result = mysql_query($query) or die(mysql_error()); You know guys, after seeing all this talk of sql injection over the past few days, I'd also like to point out or die is pretty bad too. Especially when coupled with mysql_error(). It can expose sensitive system info (security vuln) when a sim

Re: [PHP] To check for existing user in database

2009-01-16 Thread Shawn McKenzie
Lars Torben Wilson wrote: > 2009/1/15 tedd : >> At 9:46 AM -0800 1/15/09, Chris Carter wrote: >> >> Chris: >> >> That's not the way I would do it. After establishing a connection with the >> database, I would use the query: >> >> $query "SELECT email FROM owners WHERE email = '$emailAddress' ": >>

Re: [PHP] To check for existing user in database

2009-01-16 Thread tedd
At 11:01 PM -0800 1/15/09, Lars Torben Wilson wrote: 2009/1/15 tedd : You want to use mysql_num_rows() there instead of mysql_affected_rows(). (Just a typo in this case, I suspect, but for the benefit of the less experienced it's worth pointing out.) For the newer PHP users, mysql_num_rows() tel

Re: [PHP] To check for existing user in database

2009-01-15 Thread Lars Torben Wilson
2009/1/15 tedd : > At 9:46 AM -0800 1/15/09, Chris Carter wrote: > > Chris: > > That's not the way I would do it. After establishing a connection with the > database, I would use the query: > > $query "SELECT email FROM owners WHERE email = '$emailAddress' ": > $result = mysql_query($query) or die(

Re: [PHP] To check for existing user in database

2009-01-15 Thread Edmund Hertle
2009/1/15 tedd > At 9:46 AM -0800 1/15/09, Chris Carter wrote: > > Chris: > > That's not the way I would do it. After establishing a connection with the > database, I would use the query: > > $query "SELECT email FROM owners WHERE email = '$emailAddress' ": > $result = mysql_query($query) or die(

Re: [PHP] To check for existing user in database

2009-01-15 Thread tedd
At 9:46 AM -0800 1/15/09, Chris Carter wrote: Chris: That's not the way I would do it. After establishing a connection with the database, I would use the query: $query "SELECT email FROM owners WHERE email = '$emailAddress' ": $result = mysql_query($query) or die(mysql_error()); if(mysql_aff

Re: [PHP] To check for existing user in database

2009-01-15 Thread John Corry
You might want to (seriously) look at the PEAR Auth class. It can save you a TON of time...all the stuff you're trying to do with this code (that you were just told you're going to have to rewrite) is already done for you. It's very handy for registering/tracking users of your sites. John Corry

Re: [PHP] To check for existing user in database

2009-01-15 Thread Daniel Brown
Welcome to the list, Chris. Your code is going to require some rewriting to save you a lot of headaches and serious security issues down the road. So here we go: On Thu, Jan 15, 2009 at 12:46, Chris Carter wrote: */ if($_POST['submit']) { // Check to see if the user already exist

[PHP] To check for existing user in database

2009-01-15 Thread Chris Carter
Hi, I know this is very basic question, this is so because I am a basic programmer struggling to make things work. Where in this code should I be trying to check if the user already exists and throw an error saying "The user already exists ding ding ding". The check has to be done with the email