Hello,
i am coding my own cms and im gettin the back end working and i have ran into some difficaulty.
On this page it says whats new http://www.jonathan-adams.co.uk/testcms
the articles listed below are being got from a mysql database. When you click on them it goes to another page to show the full article. here is the code
PHP Code:
<html>
<head> <title>DbConnector</title> </head>
<body>
<?php
require_once 'SystemComponent.php';
class DbConnector extends SystemComponent {
var $theQuery;
var $link;
//*** Function: DbConnector, Purpose: Connect to the database ***
function DbConnector(){
// Load settings from parent class
$settings = SystemComponent::getSettings();
// Get the main settings from the array we just loaded
$host = $settings['dbhost'];
$db = $settings['dbname'];
$user = $settings['dbusername'];
$pass = $settings['dbpassword'];
// Connect to the database
$this->link = mysql_connect($host, $user, $pass);
mysql_select_db($db);
register_shutdown_function(array(&$this, 'close'));
}
//*** Function: query, Purpose: Execute a database query ***
function query($query)
{
$this->theQuery = $query;
return mysql_query($query, $this->link);
}
//*** Function: fetchArray, Purpose: Get array of query results ***
function fetchArray($result)
{
return mysql_fetch_array($result);
}
//*** Function: close, Purpose: Close the connection ***
function close()
{
mysql_close($this->link);
}
}
?>
</body>
</html>
it says on the page
Quote:
|
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.tia/jonathanadams/jonathan-adams.co.uk/testcms/includes/DbConnector.php on line 46
|
this is the line that im having problems with.
PHP Code:
return mysql_fetch_array($result);
can anyone help me with my problem please.
|