Hi all, I’ve hit a brick wall and been banging my head off of it all day. Just one of those mental blocks I guess.
Anyway, I’m trying to do exactly as described in the title. Here’s my code so far…
// Get the page file names from database
function page_file_names()
{
$connection = db_connect();
$query = ("SELECT page_file FROM pages");
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
$row['page_file'];// How can I turn this bit into an array?
}
}
Now, if I did as below, great I get a nice list of all the values from that column, but it I try return $row[‘page_file’]; it only gives back the first iteration.
while($row = mysql_fetch_array($result)){
echo $row['page_file'].'<br />';
}
EDIT: Doh! I just sussed it out after finally posting for help. I knew that would happen!
// Get the page file names from database
function page_file_names()
{
$connection = db_connect();
$query = ("SELECT page_file FROM pages");
$result = mysql_query($query);
$column_array = array();
while($row = mysql_fetch_array($result)){
array_push($column_array, $row['page_file']);
}
return $column_array;
}