I insert some data from a php foreach. And when the data insert, I make sure if the data has already existed in 2 tables? if not, insert, else jump.
But in this process, how can I know each item data has been inserted or no?
{
//some foreach process get $title, $name, $date
mysql_query("INSERT INTO table1 (title,name,date) SELECT '".$title."','".$name."','".$date."' FROM dual WHERE not exists (SELECT title FROM table1 WHERE table1.title = '".$title."') AND NOT EXISTS (SELECT title FROM table2 WHERE table2.title = '".$title."')");
//I want to add some judge like this:
//if this item insert {
//do some stuff;
//} else {
//do some stuff;
//}
}
From http://php.net/function.mysql-query: