0

The goal is to check if a number is in the database. If it is it will give an echo that you have won. This is my current code but it does not seem to work.

Also only mysqli solutions please because mysql is deprecated.

$user_id = "dopnummer";
$mysqli = mysqli_connect('localhost', 'root', '', 'onsbier');
$checkUserID = mysqli_query("SELECT nummer FROM 'nummers' WHERE actief ='$user_id'");

if (mysqli_num_rows($checkUserId) > 0) {
    echo "User id exists already.";
    $user = mysqli_fetch_array($checkUserId);
    print_r($user); 
Xatenev
  • 6,383
  • 3
  • 18
  • 42
  • wrap off quotes form table and column name instead use backtick – Saty Jun 21 '16 at 07:52
  • 2
    *"It does not seem to work"* is no useable statement to debug anything. – Xatenev Jun 21 '16 at 07:53
  • What do you mean 'it does not seem to work'? Does the code return an error? Have you checked the error logs? Have you tried debugging your code and if so what have you tried and what's the result? – dimlucas Jun 21 '16 at 07:58

0 Answers0