| | |
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 |
apache api array basic beginner broken cache cakephp class cms code computing confirm countingeverycharactersfromastring cron curl customizableitems database date delete dynamic echo email error fcc file filter folder form forms forum freelancing function functions gc_maxlifetime google header headmethod howtowriteathesis href htaccess html iframe image include incode ip javascript joomla limit link login malfunction match memmory memory menu method mod_rewrite multiple mysql navigation neutrality oop pagerank parsing paypal pdf php phpmysql query question random recursiveloop root script search select server sessions sms snippet soap source space sql support! system table template thesishelp trouble tutorial upload url variable video web window.onbeforeunload=closeme; youtube






