PHP SQL Query ERROR in a select statement
<pre><code>$id = $_POST['idn'];
$con=mysqli_connect("localhost","root","xyz","patient");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = "SELECT count(*) FROM record WHERE ID='$id'";
$count = mysql_result(mysql_query($query),0);
if($count &gt; '0')
{
id exist
}
else
{
add id &amp; record 
}
</code></pre>

<p>whats the error here it does not check for if ID exists and adds duplicate id where ID is RC50001 RC50002...... ID defined as text in table</p>
