Here are the three Files
db.inc.php
<?php
class db
{
var $dblink;
var $theQuery;
function db()
{
$dbname = 'readysetcollege';
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
//Connect to the Data Base
$dbcnx = mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error());
$this->dblink = $dbcnx;
mysql_select_db('readysetcollege') or die(mysql_error());
register_shutdown_function(array(&$this, 'close'));
}
function query($query)
{
$this->theQuery = $query;
return mysql_query($query) or die(mysql_error());
}
function getQuery()
{
return $this->theQuery;
}
function num_of_rows($results)
{
return mysql_num_rows($results) or die(mysql_error());
}
function num_of_feilds($results)
{
return mysql_num_fields($results);
}
function affected_rows($results)
{
return mysql_affected_rows($results);
}
function fetch_array($results)
{
return mysql_fetch_array($results);
}
function fetch_objects($results)
{
return mysql_fetch_object($results);
}
function close()
{
mysql_close($this->dblink);
}
}
?>
randomTestominal.php
<?php
/**
* Class ranLetter
*
* @author vbabiy
* @package Randmon Testominal
*
*/
require_once('class.inc.php');
class ranLetter extends db {
var $idNumbers;
var $letters;
var $min;
var $max;
function ranLetter($min = '1',$max = '10')
{
$this->min = '1';
$this->max = '100';
$num1 = rand($min,$max);
$num2 = rand($min,$max);
$num3 = rand($min,$max);
while(($num1 == $num2) or ($num1 == $num3) or ($num2 == $num3)){
$num1 = rand($min,$max);
$num2 = rand($min,$max);
$num3 = rand($min,$max);
}
$this->idNumbers = array($num1,$num2,$num3);
}
function getLetters() {
$letters = '';
db::db();
foreach ($this->idNumbers as $key => $value){
$sql = "Select * From testimonial Where'$value' = testimonial.testimonial_id ";
$results = db::query($sql);
$row = db::fetch_array($results);
$letters .= "<tr><td bordercolor =\"f4bc05\"><font color=\"white\">
".$row['testimonial_text']."<br/>
<em>".$row['testimonial_name'].", ".strtoupper($row['testimonial_state'])."</em></font></td></tr>";
$this->letters = $letters;
}
}
function printLetters($width = '100%', $border = '1',$bgcolor = '##006699') {
$output = '<table width='.$width.' border='.$border.' cellspacing="2" cellpadding="2" bgcolor='.$bgcolor.'>';
$output .= $this->letters;
$output .= '</table>';
return $output;
}
}
?>
And test.php
<?php
include_once('class.inc.php');
include(e_BASE."randomTestominal.php");
$ran = new ranLetter();
$ran->getLetters();
$ran->printLetters();
?>
when i try to run test i get these erros:
<br />
<b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>C:\InetPub\htdocs\new_ReadySetCollege.com\includes\db.inc.php</b> on line <b>52</b><br />
<br />
<b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>C:\InetPub\htdocs\new_ReadySetCollege.com\includes\db.inc.php</b> on line <b>52</b><br />
<br />
<b>Warning</b>: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in <b>C:\InetPub\htdocs\new_ReadySetCollege.com\includes\db.inc.php</b> on line <b>52</b><br />
Is there some thing wrong with my DB Class??
I cant find whats going wrong...
Thanks For any help