| | |
Checking for multiple database entries
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2004
Posts: 19
Reputation:
Solved Threads: 0
Hey, I've written a script in PHP that writes data into a MySQL database upon request, but what I'd also like to include is a script that will go in after the request is made, and check to make sure that the same entry does not already exist... and I have no clue where to start. I've never tried to do anything like this before, and am not sure what to do. If I could get some ideas from anyone it would be greatly appreciated. Thanks!
All you have to do is run a select statement looking for the value you just inserted. This goes right after your insert statement.
If you need more help let us know.
PHP Syntax (Toggle Plain Text)
Here's some pseudo code: 1. insert into table(field1) values('value') 2. y = select count(field1) from table where field1 = 'value' 3. if (y == 1) just one exists elseif( y > 1) multiple exist
If you need more help let us know.
Check out my blog at http://www.shinylight.com for more stuff about web dev.
![]() |
Similar Threads
- random selection of database entries (ASP.NET)
- Probem with Checking the database (VB.NET)
- Spell Checking Against Words in Database (PHP)
- asp form post, form validation, new window (ASP)
- DDNS client: Multiple zone entries (Domains and DNS)
- multiple select database (PHP)
- "topantispyware" virus (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: Reseller script
- Next Thread: making own webmail
| Thread Tools | Search this Thread |
301 access apache api array autocomplete beginner binary broken button cakephp checkbox class cms code compression cron curl data database date display dropdown dropdownlist duplicates dynamic echo email error execution file files folder form forms function functions google href htaccess html htmlspecialchars httppost image include insert integration ip javascript joomla jquery limit link links login mail md5 menu methods mlm multiple mysql oop paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote script search secure server session sessions sms source space sql subscription syntax system table tutorial update upload url validator variable video virus volume votedown web youtube






