calling from database

From: Date: Sat, 05 Aug 2000 04:16:31 +0000
Subject: calling from database
Groups: php.general 
Request: Send a blank email to php-general+get-10235@lists.php.net to get a copy of this message
hello - i'm having a problem calling information from the mysql database i set up. i'll paste the code and some urls at the bottom that document the problem.. but the main problem is thus: i have the loops working correctly, it's bringing up the parts of the loop that isn't called from the database, but the bits from the db aren't showing. here's the code: $table_name = "news"; $dbname = "slide_away"; $id_link = @mysql_connect("localhost","",""); if (! $id_link) { echo '<html><head><title>Error</title></head><body>'; echo 'Connection to PHP has failed.'; echo '</body></html>'; 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 bit for ($iindex = 0; $iindex < $number_of_records; $iindex++) { $record = @mysql_fetch_object($result2); echo "$record->date_shown : $record->update_headline <br>"; } the page can be found at http://www.factory201.com/sa/groove.php3 any help is greatly appreciated - owen factory201.com/sardonic/ - life without care factory201.com/ - the factory is being retooled slide-away.com/ - reopens 9.1.00 (maybe..) i love life, that is my greatest weakness. i love it so much i cannot imagine what is not life. - albert camus, the fall. to make friends you genuinely have to like everybody. oh well, i guess i'm fucked then, aren't i? - thom yorke aim: oasisfan15 icq: 8310562

« previous php.general (#10235) next »