no fetch

From: Date: Tue, 24 Apr 2001 14:25:15 +0000
Subject: no fetch
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-50087@lists.php.net to get a copy of this message
Hello everybody, I'm just starting out with php4 and I can use some help. Below is a script I wrote. The dbase connections are allright (i have tested them) , but the final result is 'no fetch'. so something goes wrong in 'mysql_fetch_row' but I don't understand what. Any of you have an idea? Thanx. W. Enserink <?php $global_dbh = mysql_connect($hostname, $user, $password); if(!$global_dbh) die("no dbase connection"); $a = mysql_select_db('pdd', $global_dbh); if(!$a) die("no dbase selection"); function display_db_table($tablename, $connection) { $query_string = "select * from $tablename"; print ("querystring = $query_string<BR>"); $result_id = mysql_query($query_string, $connection); print("result_id = $result_id<BR>"); $column_count = mysql_num_fields($result_id); print("column_count = $column_count<BR>"); print("<TABLE BORDER=1>\n"); while ($row = mysql_fetch_row($result_id)); { if(!$row) die ("no fetch"); print "row = $row[1]"; print("<tr align = left valign = top>"); for ($column_num = 0; $column_num < $column_count; $column_num++) print("<TD>$row[$column_num] $column_num</td>\n"); print("</tr>\n"); } print("</table>\n"); } ?> <html> <body> <table><tr><td> <?php display_db_table("test", $global_dbh); ?> </TD></TR></TABLE> </body> </html> ------------------------- Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl info@pdd.nl -------------------------

« previous php.general (#50087) next »