My query goes like this:
$result=@mysql_query('SELECT * FROM langtbl');
if (!$result) {
exit ('<p>Error performing query : ' . mysql_error() . '</p>');
}
Then I want to display the results like this:
$i=0; echo "<p>\n";
while ($row = mysql_fetch_array($result)) {
$languages[$row['langtbl_id']] = $row['langname'];
echo 'langid : ' . $row['langtbl_id'] . ' -> ' . $row['langname'] . ' with code ' . $row['langcode'];
echo ' <a href="' . $_SERVER['PHP_SELF'] . '?edit=' . $row['langtbl_id'] . '">edit</a> | ';
echo ' <a href ="'. $_SERVER['PHP_SELF'] . '?delete=' . $row['langtbl_id'] . '">delete</a> || ';
echo "\n";
$i++;
}
echo "</p>\n";
if ($i<1) {
echo '<center><span class="text">There are no languages in the database.</span></center><br />';
} else {
echo '<center><span class="text">There are ' . $i . ' languages in the database.</span></center><br />';
}
The query does not show an error, but every time $result has zero rows. In PHPMyAdmin langtbl is shown to contain rows so I don't know why they don't turn up in the $result variable. What am I missing?
The query is called from an include - could this have something to do with it? (But I thought include variables had global scope).
Oh yes, and I'm using EasyPHP...
Please, any help for this coding newb...