RE: [PHP] Problem with Testing if the user has an account in my d atabase
| From: | Matt Schroebel | Date: | Thu, 15 Aug 2002 18:40:54 +0000 |
| Subject: | RE: [PHP] Problem with Testing if the user has an account in my d atabase | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-112825@lists.php.net to get a copy of this message | ||
> From: Sebastian Marcu [mailto:sebimarcu@yahoo.com]
> Sent: Thursday, August 15, 2002 2:32 PM
> Subject: [PHP] Problem with Testing if the user has an
> account in my database
>
>
> For some reason though it isn't working right and
> keeps telling me that the 'Email' address is already
> taken even though this entry is non-existant in the
> database.
>
> What am I doing wrong with my code below? Is there a
> better way to check if the email address is already
> contained in the database?
>
> _______________________________________
>
> require ("config.inc.php");
>
> $db = mysql_connect($dbserver,$nutzer,$passwort);
>
> $myData = mysql_db_query($dbname,"SELECT * FROM
> learningZoneCustomer WHERE Email='$rEmail'");
Make sure you either addslashes or config magic_quotes_gpc and do
some validation on this tainted user data field $rEmail.
>
> if ($myData > 0)
$myData will always be true as long as the sql is valid. Use mysq_num_rows()
To see if there was a hit.