Jump to content

Recommended Posts

Okay, I show some of the code here. I think I have already made an image tag like you sad?

 

<body bgcolor="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<?
$output[] = "<h1>Movies</h1>";
$sql = "select * from movies where Produkt='movie'";
$result = $db->query($sql);
while ($row = $result->fetch()) {
	$output[] = "<a href='$row[billedeElFilm]' target='_blank'><img src='$row[billedeElFilm]' width='150' height='100' border='10' /></a>";
}
$output[] = "<h1>Brochurer</h1>";
$sql = "select * from movies where Produkt='brochure'";
$result = $db->query($sql);
while ($row = $result->fetch()) {
	$output[] = "<a href='$row[billedeElFilm]' target='_blank'><img src='$row[billedeElFilm]' width='150' height='100' border='10' /></a>";
}
echo join('',$output);
?>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/133823-is-this-possibly/#findComment-696504
Share on other sites

Try something like

<body bgcolor="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<?php
   $output[] = "<h1>Movies</h1>";
   $sql = "select * from movies where Produkt='movie'";
   $result = $db->query($sql) or die(mysql_error());
   while ($row = $result->fetch()) {
      $output[] = "<a href='".$row['BilledeElFilm']."' target='_blank'><img src='".$row['BilledeElFilm']."' width='150' height='100' border='10' /></a>";
   }
   $output[] = "<h1>Brochurer</h1>";
   $sql = "select * from movies where Produkt='brochure'";
   $result = $db->query($sql) or die(mysql_error());
   while ($row = $result->fetch()) {
      $output[] = "<a href='".$row['BilledeElFilm']."' target='_blank'><img src='".$row['BilledeElFilm']."' width='150' height='100' border='10' /></a>";
   }
   foreach($output as $out)
{
echo $out;
}
?>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/133823-is-this-possibly/#findComment-696515
Share on other sites

Try something like

<body bgcolor="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<?php
   $output[] = "<h1>Movies</h1>";
   $sql = "select * from movies where Produkt='movie'";
   $result = $db->query($sql) or die(mysql_error());
   while ($row = $result->fetch()) {
      $output[] = "<a href='".$row['BilledeElFilm']."' target='_blank'><img src='".$row['BilledeElFilm']."' width='150' height='100' border='10' /></a>";
   }
   $output[] = "<h1>Brochurer</h1>";
   $sql = "select * from movies where Produkt='brochure'";
   $result = $db->query($sql) or die(mysql_error());
   while ($row = $result->fetch()) {
      $output[] = "<a href='".$row['BilledeElFilm']."' target='_blank'><img src='".$row['BilledeElFilm']."' width='150' height='100' border='10' /></a>";
   }
   foreach($output as $out)
{
echo $out;
}
?>
</body>
</html>

 

The "$row['BilledeElFilm']" is just the pictures and when you click you will get it in big. What I want is when you click on the picture you get a "new page" where you only have this one picture and the rest of the informations from the tabel.

I don't think that's what you have explained here?

Link to comment
https://forums.phpfreaks.com/topic/133823-is-this-possibly/#findComment-696526
Share on other sites

You need to pass something to identify the particular image to a new page. If, as i would hope, you have a unique ID in your database table, then you might generate links like:

 

http://www.yoursite.com/viewimage.php?pic_id=323;

 

You would then do something like this in viewimage.php:

 

<?php
$pic_id = (int) $_GET['pic_id'];//int cast to prevent SQL injection
$sql = "SELECT * FROM yourtable WHERE id=$pic_id";
$result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR);
$row = mysql_fetch_assoc($result);
//print out information - a caption for example
echo 'Caption: '.$row['caption'];
?>

Link to comment
https://forums.phpfreaks.com/topic/133823-is-this-possibly/#findComment-696530
Share on other sites

You need to pass something to identify the particular image to a new page. If, as i would hope, you have a unique ID in your database table, then you might generate links like:

 

http://www.yoursite.com/viewimage.php?pic_id=323;

 

You would then do something like this in viewimage.php:

 

<?php
$pic_id = (int) $_GET['pic_id'];//int cast to prevent SQL injection
$sql = "SELECT * FROM yourtable WHERE id=$pic_id";
$result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR);
$row = mysql_fetch_assoc($result);
//print out information - a caption for example
echo 'Caption: '.$row['caption'];
?>

 

thank you very much! That works  :D

Link to comment
https://forums.phpfreaks.com/topic/133823-is-this-possibly/#findComment-696552
Share on other sites

But what can I write insted of the ID-number in the end of the url? Because there are more than one picture for every of this codes:

$output[] = "<a href='$row[billedeElFilm]' target='_blank'><img src='$row[billedeElFilm]' width='150' height='100' border='10' /></a>";

Link to comment
https://forums.phpfreaks.com/topic/133823-is-this-possibly/#findComment-696562
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.