No data being found
| From: | Roddie Grant | Date: | Tue, 21 Jan 2003 14:45:31 +0000 |
| Subject: | No data being found | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132410@lists.php.net to get a copy of this message | ||
I have a small site in development which takes details of coming church
services from a MySQL database. This bit is at the bottom of
http://www.rugbyurc.org.uk/spirit/spirit_intro.php
(hosted by an ISP) and
works fine.
I've just got OSX working on my Mac and want to get the site running on that
so that I can develop it further. I am using the code below (this is a much
reduced version of what's on the live site), but getting no data. Nor am I
getting any error message.
I can access and use the database from Terminal. I can also get the data
from the same query using Lasso (a middleware program similar to php), so I
know the data is there to be found.
Any suggestions about why the data is not showing up in the browser with php
will be much appreciated.
<table border="0">
<?php
$userName='xxx';
$pswd='yyy';
error_reporting(E_ALL);
require_once('DB.php');
$db = DB::connect("Mysql://$userName:$pswd@127.0.0.1/rurcdb");
if (DB::iserror($db)) {
die($db->getMessage());
}
$sql = "SELECT speaker
FROM rurcdb.diary";
$q = $db->query($sql);
if (DB::iserror($q)){
die($q->getMessage());
}
while ($q->fetchInto($row)){
echo "<tr><td>".($row[0])."</td></tr>";
}
?>
</table>
Roddie Grant
roddie@myword.co.uk