Fwd: Re: [PHP-DB] mysql_num_rows, resource id #

From: Date: Thu, 27 Mar 2008 14:43:21 +0000
Subject: Fwd: Re: [PHP-DB] mysql_num_rows, resource id #
Groups: php.db 
Request: Send a blank email to php-db+get-44834@lists.php.net to get a copy of this message
This much is working: <?PHP ini_set('error_reporting',E_All); DEFINE ("host","localhost"); DEFINE ("user","root"); DEFINE ("password","password"); DEFINE ("database","questions"); $connection=mysql_connect(host,user,password) or die ('Could not connect' . mysql_error() ); $dbConnect=mysql_select_db('questions'); if (!$dbConnect) {die ('Could not connect to database' . mysql_error() );} $result = mysql_query("Select answer from answers where studentID='A123456789'") or die(mysql_error()); $rows = mysql_num_rows($result); echo $rows . "\n"; $answer = mysql_fetch_row($result); foreach($answer as $a) { echo $a; } ?> The output is 1 1 which is correct. One small step at a time, hopefully forward. Richard.

« previous php.db (#44834) next »