It will be easier to explain with the following code (this is incorrect, by the way):
$selectGenre_sql = 'SELECT genreID FROM genres WHERE dbGenre = ?';
if ($stmt->prepare($selectGenre_sql)) {
$stmt->bind_param('s', $genre);
$stmt->bind_result($genres);
$stmt->execute();
$genre = array();
while ($stmt->fetch()) {
$genre[] = $genres;
}
}
The above code gets the value from 'genreID' when 'dbGenre' is equal to '$ genre'. And then save the results in an array. But I do not work. What for? I think because "$ genre" is an array, so I need to loop around it to get a different value from "genreID" every time.
$ genre is an enumerated array containing movie genres, for example:
[0] => Action [1] => Adventure [2] => Fantasy
I need to compare the value (for example, "Action")
The 'genres' table contains two columns: genreID (INT) and dbGenre (VARCHAR)
genreID ( ).... .. dbGenre Action, genreID 1, $genre, genreID 1
?? , , , . !!