How do I write an IF statment in php that checks a database for $varialbe and have it only perform the action if $varialbe is not already in the database.
views:
45answers:
3
+2
A:
You can count number of items in database by SELECT count(*) FROM table WHERE field=? query, and then insert record if there is no such records.
You can also add UNIQUE index to the table column you want to have only unique values
Ivan Nevostruev
2009-11-06 22:33:16
+1
A:
if (! DBA::RowExists("select 1 from table where key = '$varialbe'"))
{
...
}
Don
2009-11-06 22:33:19
A:
You can stop having us do your homework.
Look at this user's question history: http://stackoverflow.com/users/201349/unknown-google
sirlancelot
2009-11-06 22:48:50