Problem with insertion query using foreach loop
<p>I am using foreach loop for insertion query. At the same time I am matching value if those are exist in databse or not. If value exist than I want to skip that particular key and than move to next key value to insert. Again it check if value exist or not than save record if values are not exist in datavase.</p>

<p>I have used following approach to do this.</p>

<pre><code>foreach( $inputs as $key =&gt; $value) {
if ($key == 'empty') continue;
    $check=mysql_query("select * from from t_atc_list where s_title='$key' and r_name='$value'");

    if(mysql_num_rows($check)!=0){ continue;        }
    $result = mysql_query("INSERT into t_atc_list(a_name, s_title, r_name) values('$album','$key', '$value')")or die(mysql_error());
    echo "&lt;strong&gt;$key&lt;/strong&gt; Singer &lt;strong&gt;$value&lt;/strong&gt;&lt;/br&gt;";

}
</code></pre>

<p><strong>NOTE :</strong>
(1). Values are inserting if value are already present that is duplicate entries.
(2). I am getting warning " mysql_num_rows(): supplied argument is not a valid MySQL result resource in..."</p>
