I have a question for you.
I am creating an administration panel, this is the first time for me, and I have some problems.
1. Problem
I am using mysqli_fetch_assoc() in this way:
$row_cnt = mysqli_fetch_assoc($result);
printf('Result set has %d rows.<br />', $row_cnt);
if ($row_cnt['COUNT(id)'] == 0) {
return false;
} else {
return true;
}
I use this to see if in the DB there are some entries, it returns 1 everytime, whatever thing I insert in the fields. I thought that it has to return 0 if there are no entry in the DB, am I wrong?
Please be patient, this is my first login page with admin panel.
Just from taking a quick peek –
mysql_real_escape_string requires a connection to be established via mysql_connect, you need to use the mysqli_real_escape… function – http://php.net/manual/en/mysqli.real-escape-string.php