hello,..

i have problem with my script, my goals to display image from my query result.
i created picture database contain id, name & link (data contain link to picture folder localhost/nseries/A2-1C1-1B.png)

on my query display i created dynamic link to picture but when i click the link nothing show up

i've tried different script but nothing comes out only blank screen

php script i've tried

<?php
$q=$_GET["id"];

$con = mysql_connect('localhost', 'sigit_p', 'h4ngg401');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("kdplnseries", $con);

$query = "SELECT link FROM asmmanual WHERE id = '".$q."'";

$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo "<img src=\"". $row['link'] ."\" alt=\"\" />";
?>

also

<?php
$q=$_GET["id"];

$con = mysql_connect('localhost', 'sigit_p', 'h4ngg401');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("kdplnseries", $con);

$data = mysql_query("SELECT * FROM asmmanual WHERE id = '".$q."'");

while($result = mysql_fetch_array( $data ))
  {
  echo '<img src="'.$q.'" width="312" height="50" alt="'.$q.'"(83 bytes)" />';
  }  

mysql_close($con);
?> 

please help solve my problem ,...

thanks

Make sure you have proper src to show image in browser.
Your src can be relative or absolute.

1) http://localhost/nseries/A2-1C1-1B.png

OR

2) nseries/A2-1C1-1B.png (considering php page running this code is placed beside nseries folder.)

goto the view source of your browser and check wheather the image path is correct or not in source.

page source came out empty ,..nothing,.blank,..no script

Check what is the path coming from your database.

Try like this and paste your output on the screen

echo $row['link']; exit;
echo "<img src='". $row['link'] ."' alt='' />";

do you mean like this

<?php
$q=$_GET["id"];

$con = mysql_connect('localhost', 'sigit_p', 'h4ngg401');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("kdplnseries", $con);

$query = "SELECT link FROM asmmanual WHERE id = '".$q."'";

$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo $row['link']; exit;
echo "<img src='". $row['link'] ."' alt='' />";

?> 

result still blank,..

Try this code:

echo $query = "SELECT link FROM asmmanual WHERE id = '".$q."'"; exit;

You will see one quesy in browser, copy that query and run it in your mysql query window.
Post what is your query output.

if i insert you code

<?php
$q=$_GET["id"];

$con = mysql_connect('localhost', 'sigit_p', 'h4ngg401');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("kdplnseries", $con);

echo $query = "SELECT link FROM asmmanual WHERE id = '".$q."'"; exit;

$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
echo $row['link']; exit;
echo "<img src='". $row['link'] ."' alt='' />";

?> 

my query output will be

SELECT link FROM asmmanual WHERE id = 'A2-1C1-1B'

is it right or wrong ???,... sorry i'm still new in php

thanks

$q=$_GET['id'];
$con = mysql_connect('localhost', 'sigit_p', 'h4ngg401');
 if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
 mysql_select_db("kdplnseries", $con);

//end of your conn.
 $query = mysql_query("SELECT link FROM asmmanual WHERE id = '$q' LIMIT 1") or die(mysql_error());
while($imglink = mysql_fetch_assoc($query){
 echo '<a href="'.$imglink['link'].'" target="_blank"><img src="'.$imglink['link'].'" alt="" /></a>';
}
 ?>

I think something like that should help you out, if you still don't get the right img , go and check exact path of the image if part is broken or need to be edit to be the correct one .

Regards
Rimo

result still empty page,..blank,..

can you give me example for displaying image from database which contain link to image,.. ????

previously i found tutorial for displaying image but database type using BLOB, in some people opinion BLOB is not recomended for storing large image file.

thank you

after i recheck database and edit some error from Rimotevst the problem solved,
thanks to you all and specially for Rimotevst
and the code goes like this

<?php
$q=$_GET['id'];
$con = mysql_connect('localhost', 'sigit_p', 'h4ngg401');
 if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }
 mysql_select_db("kdplnseries", $con);
    //end of your conn.
$query = mysql_query("SELECT link FROM asmmanual WHERE id = '$q' LIMIT 1") or die(mysql_error());
while($imglink = mysql_fetch_assoc($query))
 {
 echo '<a href="'.$imglink['link'].'" target="_blank"><img src="'.$imglink['link'].'" alt="" /></a>';
 }
?>