![]() |
|
#1
|
|||
|
|||
Trying to check the existance of data in MySQLI am new to MySQL and PHP. I have created a simple form on my website that asks for the users name, email, subject and the ereason for contact. When the user hits the send button an email is sent to me as well as the data is entered into a database. All of this worked properly but what I would like to do now is before the data is sent to the database, I would like to check the database to make sure both the name and email of the user aren't already in the DB. If the name or email is already in the DB then I would liike to send the user to an error page telliing them that either of their entries already exists. Hopefully that makes sense. Here is the code I have so far. The send_contact.php is a script that sends the email.
PHP Code:
Hopefully someone can understand what I saying. Thanks for having a look. Nick Last edited by admin : 07-Jun-2007 at 22:33.
Reason: Please insert your PHP code between [php] & [/php] tags
|
|
#2
|
||||
|
||||
Re: Trying to check the existance of data in MySQLHello Nick,
I have edited your post so the code is syntax highlighted, please let me know if I messed it up. Also, I got side-tracked when preparing my reply to you. So I'll reply in parts. Some related comments about your PHP script first: When submitting variables to your functions, you don't need to "quote" them, for example: PHP Code:
When using user submitted data like the ones supplied by the GLOBAL variable $_POST and others, you need to be careful with them.
For example: PHP Code:
|
|
#3
|
|||
|
|||
Re: Trying to check the existance of data in MySQLFigured it out. Thanks for the help.
Nick |
Recent GIDBlog
First week of IA training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Moving data from MySQL to MySQL | meurer | MySQL / PHP Forum | 0 | 25-Jan-2007 09:03 |
| Cpanel downgrade MYSQL 4.1.X to MySQL 4.0.xx | Webhosting-live | Web Hosting Forum | 1 | 01-Sep-2006 02:54 |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 13:12 |
| [CONTEST?]Data Structure Test | dsmith | C Programming Language | 2 | 06-Jun-2004 15:13 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The