Problem with fetching table to array
- by jasmine
I have writed this function:
function news_array()
{
$sql = "SELECT * FROM content WHERE home=1";
$query = mysql_query($sql);
$i = 0;
while($row = mysql_fetch_array($query)){
$row_array[$i] =
array(
TITLE => $row['title'],
ABSTRACTT => $row['abstract'],
BODY => $row['body'],
ID => $row['conID']
);
$i++;
}
return $row_array;
}
When using this function like this:
<?php
$row_array = news_array();
for($i = 0 ; $i < count($row_array) ; $i++){
echo $row_array[$i][TITLE];
}
?>
There no output in html. What is wrong in my function?
Thanks in advance