Jump to content

insert if not in DB


Miko

Recommended Posts

Hello,

 

I'm creating a script that should check in my MySQL DB if a value is allready present or not, if it is not present it should insert it into the database.

 

Was thinking of doing like this:

 

SELECT * FROM dates WHERE date = $date AND depot = $depot

 

then add an IF statement

 

if($sql_date != $date){
  "insert into db statement and code
} 

 

Seems that it isn't a correct way to do it?

Maybe work with array?

Link to comment
https://forums.phpfreaks.com/topic/178614-insert-if-not-in-db/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.