paradoxblue
Gawd
- Joined
- Jan 4, 2006
- Messages
- 591
this is my php viewdata page. I am getting an error and I can not figure out why.
Mind you it was once used for 3 rows and I added a 4th.
the submit functions work fine as the data shows in my phpmyadmin page.
heres the error
heres the code for the page.. im at a loss,, been working for 2 days trying to figure out wth is up.
Mind you it was once used for 3 rows and I added a 4th.
the submit functions work fine as the data shows in my phpmyadmin page.
heres the error
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/.findus/takcollect/collection/Games/viewdata.php on line 38
heres the code for the page.. im at a loss,, been working for 2 days trying to figure out wth is up.
<?php
class database
{
private $db_handle;
private $user_name;
private $password;
private $data_base;
private $host_name;
private $sql;
private $results;
function __construct($host="mysql.collection.takagari.com",$user,$passwd)
{
$this->db_handle = mysql_connect($host,$user,$passwd);
}
function dbSelect($db)
{
$this->data_base = $db;
if(!mysql_select_db($this->data_base, $this->db_handle))
{
error_log(mysql_error(), 3, "/phplog.err");
die("Error connecting to Database");
}
}
function executeSql($sql_stmt)
{
$this->sql = $sql_stmt;
$this->result = mysql_query($this->sql);
}
function outputGenerate()
{
echo "<table cellspacing='0' cellpadding='0' width='0' border='1'>\n<tr>";
echo "<tr><td width=\"400\">Number</td><td width=\"100\">Game</td><td width=\"400\">Link</td><td width=\"100\">Console</td></tr><tr>";
while($record = mysql_fetch_object($this->result))
{
echo "<td width='400'>".$record->number."</td>";
echo "<td width='100'>".$record->game."</td>";
echo "<td width='400'>".$record->link."</td>";
echo "<td width='100'>".$record->console."</td>";
echo "</tr><tr></tr><tr>";
}
echo "</tr></table>";
}
}
$host='mysql.collection.takagari.com';
$user = "takcollect";
$passwd = "*****";
$db = "games";
$sql = "SELECT * FROM games ORDER BY games";
$dbObject = new database($host,$user,$passwd);
$dbObject->dbSelect($db);
$dbObject->executeSql($sql);
$dbObject->outputGenerate();
?>