RE: [PHP-DB] Can't use field names in print

From: Date: Mon, 14 Jan 2002 02:19:19 +0000
Subject: RE: [PHP-DB] Can't use field names in print
Groups: php.db 
Request: Send a blank email to php-db+get-15740@lists.php.net to get a copy of this message
you need to use the *_fetch_array() functions i.e. if you are using MySQL $SQL = "something"; // build SQL query $result = mysql_query($SQL); // execute query, save all results in $result $firstResult = mysql_fetch_array($result); // create an array containing each returned record // subsequent calls to mysql_fetch_array($result) will get each record HTH Beau PS please excuse email butchering my single-line comments :) // -----Original Message----- // From: planomax [mailto:planomax@yahoo.com] // Sent: Monday, 14 January 2002 10:13 AM // To: php-db@lists.php.net // Subject: [PHP-DB] Can't use field names in print // // // To output each row, this works: // // print("$row[0] - $row[1] - $row[2]<br>"); // // But using the table's field names, I don't see anything: // // $ID=$row["ID"]; // $test1=$row["test1"]; // $test2=$row["test2"]; // print ("$ID - $test1 - $test2<br>"); // // I'm used to using Cold Fusion and want to learn PHP. Any // help would be // appreciated. Thanks. // Pete // // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net // For additional commands, e-mail: php-db-help@lists.php.net // To contact the list administrators, e-mail: // php-list-admin@lists.php.net //

« previous php.db (#15740) next »