Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

only image path displays

images php coding issues or problems here.

Moderators: macek, egami, gesf

only image path displays

Postby Helix » Sat May 07, 2011 5:35 pm

Whats up forum. First time here with maybe a newb question.
I have a gallery of pics and when you click a pic you get sent to this page.(the one I pasted) Problem is I can't get the image to display. I know it's a GET function or img src="" but I can't get it right. This is my output.
Name: gewqrgf photo: uploads/EmptyTwo.png state: wfe

This page is a template for all photos when clicked. I want to drag the info of the pic selected and the comments that come along with it (not included yet) but could use some advice on that too. Does that make sense?
Thanks



Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>What do you know about.......</title>
</head>

<body>
<?php
$hostname='.';
$username='.';
$password='.!';
$dbname='.';
$usertable='.';

mysql_connect('.', ''', ''!') or die(mysql_error());
mysql_select_db("'") or die(mysql_error());

$result = mysql_query("SELECT * FROM photo")
or die(mysql_error()); 

// store the record of the "example" table into $row
$row = mysql_fetch_array( $result );
 

echo "Name: ".$row['name'];
echo " photo: ".$row['photopath'];
echo " state: ".$row['state'];
?>

<?php
 
//$photopath = mysql_real_escape_string($_REQUEST['photpath']);
//$name = mysql_real_escape_string($_REQUEST['name']);
//$state = mysql_real_escape_string($_REQUEST['state']);

?>


</body>
</html>
Helix
New php-forum User
New php-forum User
 
Posts: 1
Joined: Sat May 07, 2011 5:31 pm

Re: only image path displays

Postby webinfopedia » Wed May 25, 2011 10:37 am

Hello Helix
On this case while you clicking a image in gallery which leads to the photo displaying page along with comments. So you have to pass an value to this page in URL like below
Code: Select all
<a href="phototemplate.php?photoid=1"><img src="image.jpg" /></a>

In phototemplate.php page get the value from URL and write an query to fetch the image as well as comments
Code: Select all
$query="SELECT * FROM photo where id=".$_REQUEST['photoid']."";

Hope this help you..For more details you can visit http://www.webinfopedia.com
Thank You
User avatar
webinfopedia
New php-forum User
New php-forum User
 
Posts: 84
Joined: Sat May 21, 2011 10:26 pm

Re: only image path displays

Postby ravisoni6262 » Mon Jun 13, 2011 4:55 am

well this is a easy task you need to display image info along with comment associated with it make url for the image template page and pass some id DB unique info along with that will help you getting info from the DB.
I think this will help.
If have any problem on PHP kindly make a visit at php-mechanic.blogspot.com.
ravisoni6262
New php-forum User
New php-forum User
 
Posts: 13
Joined: Mon Jun 13, 2011 4:08 am


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.