[GLLUG] [ot]MySQL/PHP

Mike Szumlinski szumlins@msu.edu
Wed, 27 Feb 2002 21:17:27 -0500


Okay, so I've built a form that works fine and posts data to a mysql
database correctly. Now I want to add a little validation to make sure that
no one has put the same info in twice. I'd like to use a non auto increment,
non primary key value (an e-mail address actually) as the validator, so if
someone tried to use the form twice with the same e-mail address, they
wouldn't be able to post the second time and the page would say something
like "you have already registered"

Essentially, this means doing a query of the email addresses already in the
table and checking to see if the one just input is already in the table.

Right now I was thinking something like this, but I am totally wrong:

$emailcheck=mysql_query("select email from $tableselect","localhost","user")

This pulls out an array as far as I can tell (multiple e-mail addresses, one
variable, must be an array, right?)

I'm probably wrong on this altogether, so if anyone knows how to do what I
need to do, I'd really really appreciate it because I am on a time crunch
for this project for work (otherwise the inhouse guy does a half-assed job
on an MSSQL/asp NT server instead of my hard fought FreeBSD box)

-Mike

-=--===---===---===---===-=-
|Mike Szumlinski           |
|Michigan State University |
-=--===---===---===---===-=-
"We are what we repeatedly do. Excellence, then, is not an act, but a habit"

                                                                 -Aristotle