Hi There
I'm a newcomer to php trying to develop a basic photo album. I have created a simple template in htm, and am trying to use php to show 15 thumbnails per page. However, I am experiencing the error message: "Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/fhlinux177/e/equinefocus.co.uk/user/htdocs/personal/gallery.php on line 26"
$db = mysql_connect($hostname, $username, $password) or die ("Unable to connect to MySQL");
$sql = "SELECT url, thumb, ref, info FROM others LIMIT 15";
$result = mysql_query($sql, $db);
$table_template = file_get_contents($_SERVER['DOCUMENT_ROOT'].'/style/gallery_template.htm');
while ($data = mysql_fetch_assoc($result)) {
$mytable = $table_template;
foreach ($data as $key => $value) {
$mytable = str_replace("[".strtoupper($key)."]", $value, $mytable);
}
}
?>
LINE 26 is while ($data = mysql_fetch_assoc($result)) {
Can anyone point me in the right direction with this problem, please? What is causing it, and how can I correct it?