0
I recently uploaded an old code for Mysqli and it’s giving errors.
Erro:
Notice: Undefined variable: connection in /var/www/public_html/includes/functions.php on line 8
Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in /var/www/public_html/includes/functions.php on line 8
Warning: mysqli_query() expects at least 2 parameters, 1 given in /var/www/public_html/includes/functions.php on line 9
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /var/www/public_html/includes/functions.php on line 10
Code:
function idinfo($id,$value) {
$id = mysqli_real_escape_string($connection, $id);
$sql = mysqli_query("SELECT * FROM purchasify_users WHERE usern='$id'");
$row = mysqli_fetch_array($sql);
return $row[$value];
}
It is nice that you validate if your line is returning something. See if this set with isset() and also its number of lines is greater than 0.
– Thiago Cunha
I don’t understand....
– Abd Domingos
Your code is full of errors, I recommend taking a look at the mysqli documentation to see the changes.
– Francisco
I agree with @Francisco... You need to review your algorithm. PHP documentation is amazing for this...
– Thiago Cunha