I have the following code:
$result = mysqli_query($con, "SELECT * FROM da_questions");
while($row = mysqli_fetch_array($result))
{
}
mysqli_close($con);
which selects everything from the table da_questions. Now this is in a file called config.php which file is required in all my pages of my website. Now I want to do the following on my external pages... let's say index.php
<?php foreach($results as $question): ?>
<p><?php echo $question['question_title']; ?></p>
<br />
<p><?php echo $question['question_text']; ?></p>
<br />
<?php endforeach; ?>
My file outlay is like shown below:
index.php
config/
config.php
How can I do this?
$results = array(); while($row = mysqli_fetch_array($reult)) { $results[] = $row; }$results = $result->fetch_all(MYSQLI_ASSOC)$resultson index.php?