检查MySQL DB的值

Hi guys im trying to check if a value(token) inside my MYSQL DB exists.

Main informations:

Table: Tokens Column: Token

My latest try:

<?php
    // DATABASE STUFF
    $servername = "localhost";
    $username = "userhere";
    $password = "passhere";
    $dbname = "zwinky";
    $token = $_GET['a'];

    $conn = new mysqli($servername, $username, $password, $dbname);
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    } 

    $result = mysql_query("SELECT * FROM Tokens WHERE Token = '$token'");
    $matchFound = mysql_num_rows($result) > 0 ? 'yes' : 'no';
    echo $matchFound;
?>

Does anyone have a idea?

If you are using mysqli_* then you can't use mysql_*

Try this one

<?php
// DATABASE STUFF
$servername = "localhost";
$username = "userhere";
$password = "passhere";
$dbname = "zwinky";
$token = $_GET['a'];

$con=mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (mysqli_connect_errno()){
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

// Perform queries 
$result = mysqli_query($con,"SELECT * FROM Tokens WHERE Token = '$token'");
$matchFound = mysqli_num_rows($result) > 0 ? 'yes' : 'no';
echo $matchFound;
?>