This my dbconnect.class.php
<?php
class Connect
{
//public $error;
public $db;
public function __construct()
{
$link = mysql_connect("localhost","root","1");
$db = mysql_select_db("tarih",$link);
$this->db = $db;
}
}
$connect = new Connect();
$connect = $connect->db;
?>
And this is main php file (header.class.php)
<?php
require_once ('dbconnect.class.php');
class Header extends Connect
{
public $headers = array();
public function __construct()
{
/*
* Bu sınıf sayfaların header bilgilerini işler.
*/
}
public function sayfaHeader($sayfa = true)
{
$sql = "SELECT * FROM header WHERE id='" . $sayfa . "'";
$query = mysql_query($sql,$connect) or mysql_error();
echo $sql;
}
}
$header = new Header();
echo $header->sayfaHeader();
?>
But when i run this code I see this error:
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in C:\AppServ\www\ilk\class\header.class.php on line 16
What is the problem?