Hi there,
I have this query, which outputs the records properly in PhpMyAdmin.
But when using this query inside my PHP code, the result is incomplete.
Instead of retrieving the expected 15 results, I only get the first one twice.
Also, I don't get any errors.
<?php
$get_files = "SELECT `id` FROM `files` WHERE `category` = 'W';";
include_once('connection.inc.php');
$con = mysql_connect(MYSQL_SERVER, MYSQL_USERNAME, MYSQL_PASSWORD) or die ("Connection failed: " . mysql_error());
$dbname = "myDB";
$select_db = mysql_select_db($dbname, $con) or die ("Can't open database: " . mysql_error());
$result_files = mysql_query($get_files) or die ("Query failed: " . mysql_error());
$files = mysql_fetch_array($result_files);
$W_files = "'".implode("', '", $files)."'";
// echo $W_files; outputs the first number twice, instead of the expected 15 different ones
$get_checklist = "SELECT * FROM `checklist` WHERE `id` IN ($W_files) ORDER BY `id` ASC;";
$result_checklist = mysql_query($get_checklist) or die ("Query failed: " . mysql_error());
// .... code for displaying
?>