alright, i'm having some major headaches with this one. i'm pretty new to php, but i can't find a problem with this code. when the page is loaded, the php is running the loop correctly, but it's not calling the information from the mysql database properly. http://www.factory201.com/sa/groove.php3 shows the page (the colons in the news headline section should have information on either side)
here is the relevant code:
<?php
$table_name = "news";
$dbname = "slide_away";
$id_link = @mysql_connect("localhost","","");
if (! $id_link) {
echo '<head><title>Error</title></head><body>';
echo 'Connection to PHP has failed.';
echo '</body>';
exit();
}
$str_sql_all = "
select count(*) as number_of_records
from $table_name
";
$result =
mysql_db_query($dbname, $str_sql_all, $id_link);
$record = @mysql_fetch_object($result);
$number_of_records = $record->number_of_records;
$number_records_to_display = 8;
$initial_record = $number_of_records;
$sort_field = 'key_news';
$sort_direction = 'DESC';
$str_sql = "
select *
from $table_name
order by $sort_field $sort_direction
limit $initial_record, $number_records_to_display
";
$result2 = mysql_db_query($dbname, $str_sql, $id_link);
$number_of_records_on_current_page =
@mysql_num_rows($result2);
?>
and the loop code:
<?php
for ($iindex = 0; $iindex < $number_of_records; $iindex++) {
$record = mysql_fetch_array($result2);
echo "$record[date_shown] : $record[update_headline] <br>";
}
?>
help is greatly appreciated
owen