I put an insert statement inside an if statement to test if the insert is succesful :

foreach($print as $key => $value){
if($qty[$key] > 0){
if($rs=mysql_query("insert into inventory (location,invqty,invcid,invprint) values ('$location',$qty[$key],$cid,'$print[$key]')")){
echo "inserted $qty[$key] pieces of $print[$key] into $location<br>";
} else {
echo "<br>insert of $print[$key] for $qty[$key] pieces failed<br>";

However, if I put bad data in the insert, e.g. a non-numeric qty in a an integer field, it doesn't execute the else portion of the if statement. No error, either.

PHP docs say:
Only for SELECT,SHOW,EXPLAIN or DESCRIBE statements mysql_query() returns a resource identifier or FALSE if the query was not executed correctly. For other type of SQL statements, mysql_query() returns TRUE on success and FALSE on error.

What's up with this?

Thanks for the help,