Re: To check for existing user in database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/1/15 tedd <tedd.sperling@xxxxxxxxx>

> 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_affected_rows())
>   {
>   // then report a duplicate email/record.
>   }
> else
>   {
>  // else insert a new record in the dB.
>   }
>
> HTH's
>
> tedd


You should not forget to use mysql_real_escape_string() just as Daniel Brown
explained...

-eddy

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux