Hello, I have done a PHP project and on my localhost it is working perfectly but when I uploaded it on my webspace the CMS part of my website did not work as it is supposed to.
The strange thing is that the client side of the website is working correctly not like the admin part of the website(CMS).
The error given is:Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a5800815/public_html/draw/datagrid.php on line 48
The code for datagrid.php is:
<?php
class datagrid
{
public $dataset;
public $name;
public $fields;
public $altClass;
public $itemID;
public $oClass;
//public $noClass;
public $buffer;
function __construct($name, $dataset)
{
$this->name = $name;
$this->dataset = $dataset;
}
function datablind()
{
echo '<table name="'.$this->name.'" id="'.$this->name.'" class="'.$this->altClass.'">';
echo "<tr>";
foreach($this->fields as $field => $value) {
echo "<th>" . $field . "</th>";
}
echo "</tr>";
$count = 1;
while($record = mysql_fetch_assoc($this->dataset))
{
/*if (isset($this->noClass['set']))
{*/
$count=$count+1;
if (($count % 2)==0)
{
echo '<tr class="'.$this->altClass.'">';
foreach($record as $field => $value)
{
if (in_array($field, $this->fields))
{
/*if (in_array('image',$this->fields))
{
echo '<td><img src="../uploads/' .$value . '"</td>';
}
else*/
{
echo '<td>' . $value . '</td>';
}
}
}
echo '<td><a href="?id='. $record['ID'] .'">Select</a></td>';
echo '<td><a href="?updateid='. $record['ID'] .'">Update</a></td>';
echo '<td><a href="?deleteid='. $record['ID'] .'">Delete</a></td>';
echo "</tr>";
}
else
{
echo '<tr class="'.$this->oClass.'">';
foreach($record as $field => $value)
{
if (in_array($field, $this->fields))
{
/*if (in_array('image',array_keys($record)))
{
echo '<td><img src="../uploads/' .$value . '"</td>';
}
else*/
{
echo '<td>' . $value . '</td>';
}
}
}
echo '<td><a href="?id='. $record['ID'] .'">Select</a></td>';
echo '<td><a href="?updateid='. $record['ID'] .'">Update</a></td>';
echo '<td><a href="?deleteid='. $record['ID'] .'">Delete</a></td>';
echo "</tr>";
}
}
echo "</table>";
//$row = mysql_fetch_assoc($this->buffer);
//print_r($row);
}
}
?>
Would someone be so kind to help me out this problem as I am new to PHP?
Thanks in advance Marius