Why is my php script not returning any variables?
<p>I've been trying for a while to add a 'load more' button to a php script.</p>

<p>I've got a rather complicated MYSQL query here that does work but I am now trying to use with prepared statements and just output two variables.</p>

<p>Whilst the script <em>does</em> return the expected number of results it's not actually echoing out any variables. I suspect the problem lies in the foreach loops... In the console response I can see this:</p>

<pre><code>&lt;li&gt;-&lt;/li&gt;&lt;li&gt;-&lt;/li&gt;&lt;li&gt;-&lt;/li&gt;
</code></pre>

<p>The script</p>

<pre><code>//get current starting point of records
$position = (($page_number-1) * $item_per_page);

//fetch records 
$results = $mysqli-&gt;prepare("SELECT up.id,up.file,up.title,p.user_name,p.user_id, GROUP_CONCAT(CONCAT(cp.user_id,'~',cp.user_name) SEPARATOR '|') AS tagGroup
FROM tbl_uploads up
LEFT JOIN tbl_users p ON up.user_id = p.user_id
LEFT JOIN tbl_collab c ON up.file = c.file
LEFT JOIN tbl_users cp ON cp.user_id = c.collab_userid
GROUP BY up.file ORDER BY up.id LIMIT ?, ?");

//bind parameters for markers
$results-&gt;bind_param("dd", $position, $item_per_page); 
$results-&gt;execute(); //Execute prepared Query
$results-&gt;bind_result($title, $file); //bind variables to prepared statement

//output results from database

while($row = $results-&gt;fetch()){ //fetch values

$titles =  explode (",", $row['title']);
$files = explode (",", $row['file']);

foreach($titles as $title) {
foreach($files as $file) {
    echo '&lt;li&gt;'.$title.'-'.$file.'&lt;/li&gt;';   
}
}
}
</code></pre>

<p>Here's an example of the out put from phpadmin.
<a href="https://i.stack.imgur.com/sCWr8.png" rel="nofollow"><img src="https://i.stack.imgur.com/sCWr8.png" alt="enter image description here"></a></p>