Fwd: Re: [PHP-DB] mysql_num_rows, resource id #
[email protected] (Richard Dunne)
| Newsgroups | php.db |
|---|---|
| Message-ID | <[email protected]> |
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.
(unnamed)
(message/rfc822, 3.5 KB) - not displayed