0

I have stored the values 'A1, A4' in an array using implode() function - and I want to check if one of those values is already stored in the field Seats in the database flights_booked but so far I can't even the query to run without getting Notice: Array to string conversion error. Below is what I've done so far:

    $str = 'A1, A4';

$myArray = explode(',', $str);

print_r($myArray);

require '../configure.php';
require '../connectdb.php';


$database = 'users';

$db_found = new mysqli(DB_SERVER, DB_USER, DB_PASS, $database );

$query = "SELECT Seats FROM flights_booked WHERE Seats IN ('$myArray')";

$result = mysqli_query($conn, $query);

if($result) {
    
    echo "Success";
} else {
    echo "Fail";
}

0 Answers0