View Full Version : trying to use shadowbox with PHP

06-08-2010, 10:51 PM
I have made a database in mysql which has information such as href and image src, i want this to then be pulled from the database via PHP and loaded into my html, however im having problems with this and have no idea what to do next, here is my code:

$con = mysql_connect("localhost","user","password");
if (!$con)
die('Could not connect: ' . mysql_error());

mysql_select_db("adamscarter", $con);

$sql = mysql_query("SHOW TABLES")or die(mysql_error());

while($fetch = mysql_fetch_array($sql))
$sql2 = mysql_query("select * from " . $fetch[0] . "ORDER BY id ASC")or die(mysql_error());

while($row = mysql_fetch_array($sql2))
$href = $row['href'].
$width = $row['width'].
$height = $row['height'].
$title = $row['title'].
$src = $row['src'].

?><div id="block"><div id="image"><a href="<?php $href ?>" rel=shadowbox;width=<?php $width ?> ;height= <?php $height ?> ; title="<?php $title ?>" ><img border="0" src="<?php $src ?>" ></a></div></div><?php


thanks in advance! :)

06-09-2010, 02:18 AM
try this
<div id="block"><div id="image"><a href="<?php echo $href ?>" rel=shadowbox;width=<?php echo $width ?> height= <?php $height ?> title="<?php echo $title ?>" ><img border="0" src="<?php echo $src ?>" ></a></div></div>

06-09-2010, 11:47 AM
thanks for reply, but i still get an error "Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\adamscarter\portfolio.php on line 88" :confused:

06-09-2010, 10:50 PM
ive managed to solve it, by basically redoing the code, there must have been a fault in my database or code. thanks for replies! :)