here is my attempted to make the image gallery dynamic and gets its categories and images from a data base
<?php require "ws_e/db_connect.php"; ?>
<div class="photo">
<ul class="topic">
<?
// loop though categorys
$query = "SELECT * FROM category ORDER BY order";
$result = $mysqli->query($query);
while($row = $result->fetch_array(MYSQLI_ASSOC))
{
// get id
$id = $row['id'];
?>
<li><a class="set" href="#Portraits"><? echo $row['name'];?><!--[if gte IE 7]><!--></a><!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<?
// loop though images
$_imagequery = "SELECT * FROM image WHERE categoryID = '$id' ORDER BY order";
$image_result = $mysqli->query($image_query);
while($image_row = $image_result->fetch_array(MYSQLI_ASSOC))
{
?>
<li><a href="lbox/portrait1.jpg"><img src="images/<? echo $image_row['extension']; ?>" alt="" title="" /></a></li>
<? } ?>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
</li>
<? } ?>
<br class="clear" />
</div>
my problem is this error
Fatal error: Call to a member function fetch_array() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/ksnowdonV2/lightbox.php on line 10
the gallery i am trying to add is located at http://www.cssplay.c...ox.html#flower8
any help greatly appreciated
thanks dale
my db_connect is
<?
$mysqli = new mysqli("localhost", "root", "", "ksnowdonv3");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
?>

New Topic/Question
Reply



MultiQuote




|