// ceck if CF alredy exist
$ctrl_cf = @mysql_query($db,“SELECT id FROM avvisi WHERE cf=’$cfavviso’”) or die(mysql_error());
if(@mysql_num_rows($ctrl_cf)>0)
{
?>
<?php
}else{
Now, with php 7 i must use mysqli, but if i use " or die(mysql’_error());" ther was an error: mysqli_error()
expects parameter 1 to be mysqli, null given in
Well, first, that old code was never correct. You do not use the @ at the beginning of mysql commands.
That means it suppresses the error message. Therefore, the die may not give you the error.
Also, nobody has used mysql in years. Mysqli replaced it as of PHP5.0. But, for better, much better security, you should learn PDO. It is what most professionals use today.
For mysqli, here is an example with the connection and a simple query with row count checking. Hope it helps…