Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 19th, 2006, 12:52 PM   #1
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5 TecBrain is on a distinguished road
Displaying images

This is the code, not sure why its not working, I defined
$img = "<img src="images/">;
to be the path then i simply added to
print"<td width=48 bgcolor=#EEEEEE height=22 align=left  height=22 class=style5>$img$imgpath</td>";

Complete File:
<?
$query = "SELECT ID, countryname, currency, imgpath FROM countries order by ID"; 
$result = mysql_query($query);
$num_rows = mysql_num_rows( $result );
$img = "<img src="images/">;
while($row = mysql_fetch_array($result)) 
{

	$ID = $row["ID"];  
	$countryname = $row["countryname"];
   	$currency = $row["currency"];
   	$imgpath = $row["imgpath"];
	
	
	print"<tr>";
		print"<td width=48 bgcolor=#EEEEEE height=22 align=left  height=22 class=style5>$ID</td>";
		print"<td width=48 bgcolor=#EEEEEE height=22 align=left  height=22 class=style5>$countryname</td>";
		print"<td width=48 bgcolor=#EEEEEE height=22 align=left  height=22 class=style5>$currency</td>";
		print"<td width=48 bgcolor=#EEEEEE height=22 align=left  height=22 class=style5>$img$imgpath</td>";
		print"<td width=48 bgcolor=#EEEEEE align=center height=22 align=left  height=22 class=style5><div align=center >Edit</div></td>";
		print"<td width=48 bgcolor=#EEEEEE align=center height=22 align=left  height=22 class=style5><div align=center ><input type=checkbox name=cb[] value=ID></div></td>";
	print"</tr>";
	}
?>
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote
Old Feb 19th, 2006, 12:56 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
View your source code in the browser where you think you have a nice valid image path and specification. Then investigate concatenation.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 19th, 2006, 1:02 PM   #3
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5 TecBrain is on a distinguished road
Quote:
Originally Posted by DaWei
View your source code in the browser where you think you have a nice valid image path and specification. Then investigate concatenation.
Am running the site in my local host machine, what i was thinking is the following, having an images folder store the images in there, add the name of the image in my database, then view it by adding the path... is that right way of thinking...!!
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote
Old Feb 19th, 2006, 1:06 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Well, I think it would have stuck better if you had peeped at it, but consider this:
Print these adjacent to each other: $img$imgpath
you get this: <img src="images/"> up against whatever was in the DB. Probably something like this: <img src="images/">myImage.jpg.

Don't think that's what you're going to want.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Feb 19th, 2006, 1:11 PM   #5
TecBrain
Hobbyist Programmer
 
Join Date: Sep 2004
Location: Cyprus
Posts: 147
Rep Power: 5 TecBrain is on a distinguished road
	$imgpath = "<img src=\"images/$imgpath\">";


Works now...
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.
TecBrain is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:55 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC