Problems with Php and Mysqli

Asked

Viewed 42 times

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];
}
  • 1

    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.

  • I don’t understand....

  • 2

    Your code is full of errors, I recommend taking a look at the mysqli documentation to see the changes.

  • 1

    I agree with @Francisco... You need to review your algorithm. PHP documentation is amazing for this...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.