I want to link an object from a MySQL-Query inside a php-table but my code doesn't seem to work and I think it is just a problem of punctuation.
When I want to change this:
echo '<img src="'.$row['small'].'" border="0" alt="'.$row['name']." height="150px" width="150px"></img>";(which is working BTW) to this:
echo "<a href="content/details.php?kategorie='.$kategorie.'&id='.$zeile['id'].'" target="_blank" onclick="return popup(this.href);"><img src=\"" . $row['small'] . "\" border=0 alt=\"" . $row['name'] . "\" height=150px width=150px></img></a>" ;everything is vanished suddenly.
My inspiration for the code came from here: http://www.dreaminco...-results-colum/
This is the complete code:
<?php
$db_link = mysql_connect ( localhost,
*censored user*,
*censored PW* );
$db_sel = mysql_select_db( *dbname* )
or die("Auswahl der Datenbank fehlgeschlagen");
$kategorie = $_GET['kategorie'];
$seite = $_GET['seite'];
$next_page = $seite + 1;
if ( $next_page == 22)
{
$next_page = 1;
}
$prev_page = $seite - 1;
if ( $prev_page == 0)
{
$prev_page = 21;
}
$sql = "SELECT id, seite, small, big, beschreibung, preis FROM $kategorie WHERE seite='$seite'";
$db_erg = mysql_query( $sql );
if ( ! $db_erg )
{
die('Ungültige Abfrage: ' . mysql_error());
}
?>
<div id="gallerie">
<?php
$query = "SELECT * FROM $kategorie WHERE seite = '$seite' ";
$result = mysql_query($query) or die(mysql_error());
$tableCount = 0;
$tableRowOpen = false;
while($row = mysql_fetch_assoc($result)) {
if($tableCount == 0){
echo "<tr>";
$tableRowOpen = true;
}
echo "<td>";
echo '<img src="'.$row['small'].'" border="0" alt="'.$row['name']." height="150px" width="150px"></img>";
echo "</td>";
if($tableCount + 1 == 3){
$tableCount = 0;
echo "</tr>";
$tableRowOpen = false;
}
else{
$tableCount++;
}
}
if($tableRowOpen){
echo "</tr>";
}
?>
Thank you so much for helping!

New Topic/Question
Reply


MultiQuote




|