title: How to determine whether an insert into database operation succeeded?
body: <p>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.</p>
  
  <p>But in this process, how can I know each item data has been inserted or no?</p>
  
  <pre><code>{
  //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;
        //}     
  }
  </code></pre>