PHP MySQL if row exists not doing anything
320
Solution:
if(mysql_num_rows($check)>0) {
echo " ";
}
else
{
change your line of code to this, this would check if it already exist. Flies Away
Answer
Solution:
Try checking in the following manner
Also try printing the query to see how the value is embedding for debugging purpose...
Answer
Solution:
If it's a ban list based on a unique username why not alter the table to make the column unique. This code will also delete duplicates in the column 'Ban'.
Next, mysql_num_rows() is deprecated in php 5.5
http://php.net/manual/en/function.mysql-affected-rows.php
Your best bet (even if your mysql functions work) is to change the mysql function calls to mysqli function calls. They are more secure and up to date.As well as making sure there is a constant in your code so your not switching between them.
If you change the mysql commands to mysqli this should work.
Lastly, if you change the 'Ban' column to unique and make use of the mysqli_affected_rows this code should be all you need to insert when doesn't exist.