Jump to content

Trying to get PHP&MySQL with Lightbox JScript working


tehwolf

Recommended Posts

As title says, im trying to get the LightboxV2 Script to work. I've got a database with stored info (title, author, link and screenshot) about some projects, and a php script displaying those info in a table via mysql_fetch_object() which does work. I haven't saved the screenshots in a BLOB, just the http-link to them. The actual problem is that when clicking the image it opens in a new window instead of the Lightbox appearing, which is not really good.

 

My Code:

<?php include "include/config.php"; ?>
<html>
<head>
<title><?php echo $pagetitle; ?></title>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://tehwolf.te.funpic.de/js/prototype.js"></script>
<script type="text/javascript" src="http://tehwolf.te.funpic.de/js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="http://tehwolf.te.funpic.de/js/lightbox.js"></script>
</head>
<body>
<?php
$verbindung = mysql_connect($mysql_host, $mysql_user, $mysql_password)
or die("Verbindung zur Datenbank konnte nicht hergestellt werden");
mysql_select_db($mysql_database) or die ("Datenbank konnte nicht ausgewählt werden");

?>

<table border="1" cellpadding="0" cellspacing="0">
        <tr>
          <th>Titel:</th>
<?php
$anf1 = "SELECT title FROM style WHERE id='1'";
$erg1 = mysql_query($anf1);
while($row1 = mysql_fetch_object($erg1))
         {
          echo "<th>".$row1->title."</th>";
         }
?>
          </tr>
          <tr><td>Autor:</td>
<?php
$anf2 = "SELECT autor FROM style WHERE id='1'";
$erg2 = mysql_query($anf2);
while($row2 = mysql_fetch_object($erg2))
         {
          echo "<td>".$row2->autor."</td>";
         }
?>
          </tr>
          <tr><td>Screenshot:</td>
<?php
$anf3 = "SELECT screen FROM style WHERE id='1'";
$erg3 = mysql_query($anf3);
while($row3 = mysql_fetch_object($erg3))
         {
          echo "<td><a href=".$row3->screen." rel='lightbox'>Screenshot</a></td>";
         }
?>
          </tr>
          <tr><td>Link:</td>

<?php
$anf4 = "SELECT link FROM style WHERE id='1'";
$erg4 = mysql_query($anf4);
while($row4 = mysql_fetch_object($erg4))
         {
          echo "<td>".$row4->link."</td>";
          }
?>
          </tr>


</table>

<br />
<br />
<br />

</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.