I'm new to using Temporary Tables in PHP/MySQL. I wrote a very simple test script just to see if it would work, but the SELECT query is giving me a mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given error on the last line, and I'm not sure why.
$dbc is the database connection, which I'm not having any trouble with. Also, this is obviously on MySQL 5 using mysqli queries.
Any help would be greatly appreciated.
$query_createtemptable = "CREATE TEMPORARY TABLE everything (everything_id INT UNSIGNED NOT NULL AUTO_INCREMENT, movietitle VARCHAR(255), person_name VARCHAR(255))"; $result_createtemptable = mysqli_query($dbc, $query_createtemptable); $query_insertintotable = "INSERT INTO everything (movietitle, person_name) VALUES ('The Shawshank Redemption', 'Tim Robbins')"; $result_insertintotable = mysqli_query($dbc, $query_insertintotable); $query_selecttemptable = "SELECT movietitle, person_name FROM everything"; $result_selecttemptable = mysqli_query($dbc, $query_selecttemptable); $row_selecttemptable = mysqli_fetch_array($result_selecttemptable);
If I echo $row_selecttemptable from above, shouldn't it give me 'The Shawshank Redemption'?