Ben foillowing PHP kodu var, ama işe alınamıyor?
This is the main PHP file:
function get_data() {
$query = 'SELECT title, article FROM submissions';
$result = mysql_query($query);
$i = 0;
while ($row = mysql_fetch_assoc($result)) {
++$i;
$row['i'] = $i;
$row['title'] = limittext($row['title'], 15);
}
return $row; //perhaps because $row is not return all?
}
$data = get_data();
require('template/data.inc.php');
?>
ve bu şablon / data.inc.php olduğunu:
<?php
foreach ($data as $value):
echo $data['i'].'<br>';
echo $data['title'].'<br>';
echo $data['article'].'<br>';
endforeach;
?>
template / data.inc.php gibi çıktı bir şey içindir:
1 How to get your site on Google?
Text...
2 Secrets of SEO Revealed
Text...
Benim tahminim () foreach içinde desteklenen bir biçimde dizi () get_data dönen değil mi? - Onun şu anda bir hata veriyor gibi.