Hello i am try to you a db Class and i keep getting this error:
Here is the DB Class:
<?php
class mysql_db
{
var $dblink;
function mysql_db()
{
$this->dblink = mysql_connect('localhost','root','') or die(mysql_error());
mysql_select_db('hotels') or die(mysql_error());
}
function query($query)
{
return mysql_query($query) or die(mysql_error());
}
function fetchArray($results)
{
return mysql_fetch_array($results) or die(mysql_error());
}
}
?>
When i call it this way:
<?php
include('includes/db.inc.php');
$db = new mysql_db();
$sql = 'SELECT * FROM travel_checklist';
$a = $db->query($sql);
var_dump($a);
$row =mysql_fetch_array($a);
var_dump($row);
?>
for the first time it does a Var dump it says it a bool not no a resourse call any idea why...
this is what it dispalys:
Content-type: text/html
X-Powered-By: PHP/4.3.11
Set-Cookie: ZDEDebuggerPresent=php,phtml,php3; path=/
bool(true)
<br />
<b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>C:\InetPub\htdocs\Hotel\test.php</b> on line <b>8</b><br />
NULL