ניסתי לעשות ככה:
PHP קוד:
class db{
var $db;
function connect($host, $username, $password, $db_name){
$this->db = mysql_connect($host,$username,$password)
or die("שגיאה");
mysql_select_db($db_name,$this->db)
or die("שגיאה");
}
function query($query)
{
$res = mysql_query("blabla");
return $res;
}
function fetch_rows()
{
global $res;
return mysql_fetch_array($res);
}
function num_rows()
{
global $res;
return mysql_num_rows($res);
}
}
$db = new db;
$db->connect("localhost","root","","ea2");
$db->query("select * from ibf_thanks");
$db->fetch_rows();
$db->num_rows();
while($row = $db->fetch_rows())
{
@$ida= $row['user_id'];
@$namea = $row['user_name'];
@$datea = $row['thank_date'];
echo <<<END
, <a href="index.php?showuser=$ida">$namea</a>
END;
}
זה השגיאה..
PHP קוד:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:program fileseasyphp1-8wwwtestindex.php on line 52
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:program fileseasyphp1-8wwwtestindex.php on line 57
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:program fileseasyphp1-8wwwtestindex.php on line 52