472,980 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,980 software developers and data experts.

Simple question on retrieving and displaying images.

Newbie question.

I have a database for displaying the names of bed and breakfasts
searched for by the town they are in as below.
<?php
$result = @mysql_query ("SELECT name FROM site01_details WHERE
town='$townsearch' AND code='sleep'");
while ($row = mysql_fetch_array($result))
{ echo '<p>' . $row['name'] . '</p>'; }

?>

I want to also insert an image (of the premises for example) for each
bed and breakfast found.

Assuming a code in each database entry is actually the exact image
name, and all are stored in /images, and all of JPG format and fixed
size, how can I insert the image for each search result found.

Many thanks

Alec

Aug 31 '05 #1
6 1523
<comp.lang.php , Alec , aj****@aol.com>
<11*********************@f14g2000cwb.googlegroups. com>
<31 Aug 2005 05:23:00 -0700>
I want to also insert an image (of the premises for example) for each
bed and breakfast found.

Assuming a code in each database entry is actually the exact image
name, and all are stored in /images, and all of JPG format and fixed
size, how can I insert the image for each search result found.


Add some "blah.jpg" text to each entry I assume .

$poo="blah.jpg";

<a href="images/<?php print $poo; ?>"></a>

<td><?php print $poo; ?></td>

etc

But wont you need 2 images if you also want to use a thumbnail on the
found entrys .
--
www.phpguestbook.co.uk
Aug 31 '05 #2
PHPGB

To be honest I was just going to include one thumbnail image that would
be enough for the visitor to get an idea. After that they would have to
click on a link to the appropriate website for more.

Will try your other suggestion now...

Cheers

Alec

Aug 31 '05 #3
OK I have now tried the following.

With $photoname set to the row result for the image

<img src="images/<?php print $photoname ?>; border="0"/>

And that works OK. What I need is to have the same statement within PHP

Have tried the following from within PHP

echo '<img src="images/' . print $photoname . '" border="0"/>';

but this has problems. Sorry beginners question I know, but...

Thanks

Alec

Aug 31 '05 #4

Alec wrote (in part):
Have tried the following from within PHP
echo '<img src="images/' . print $photoname . '" border="0"/>';
but this has problems. Sorry beginners question I know, but...


If you're already within the php tags "<?php ?>", you don't need the
'print', since you're already withing an echo statement.

echo '<img src="images/' . $photoname . '" border="0"/>';

Ken

Aug 31 '05 #5
<comp.lang.php , Alec , aj****@aol.com>
<11**********************@g14g2000cwa.googlegroups .com>
<31 Aug 2005 08:49:03 -0700>
<img src="images/<?php print $photoname ?>; border="0"/>

And that works OK. What I need is to have the same statement within PHP

Have tried the following from within PHP

echo '<img src="images/' . print $photoname . '" border="0"/>';

but this has problems. Sorry beginners question I know, but...


You could try removing the "" quotes .
--
www.phpguestbook.co.uk
Aug 31 '05 #6
Ken

Many many thanks...

Alec

Aug 31 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Woodmon | last post by:
I'm observing issue with linked images not displaying in either Firefox 1.5b2 or IE6 when running on Win XP (they display fine in either browser on W2k). Example problem HTML is: <a...
3
by: Dalan | last post by:
At first I was not certain what could cause Access 97 from displaying most jpeg images, but not all. After further testing, it seemed that all original images of less than 275 pixels per inch or...
1
by: Roman Kagan | last post by:
Hi everyone, I am successful in retrieving the image from the table (.TIF), however, the retrieved file does not work. It looks like an image file - extension, size and all, but the image is not...
2
by: pmud | last post by:
Hi, I am designing a simple ASP.NET web page. I have an image button. What I want to do is: when the cursor is over the image button, a drop down meny should display. This menu should have tabs...
1
by: David Lozzi | last post by:
Hello, I'm wondering whats the best method to use for displaying several photos' thumbnails. One method I know is to dynamically resize the photo at the time the page is loaded. What does this...
7
by: Sirplaya | last post by:
I am retrieving images that I stored in SQL Server on my web pages in C#. I have no problem with the images displaying, however, I am trying to wrap the image with an <A HREF ..." and each time I...
5
by: Tom | last post by:
VS 2003/C# Have a axWebBrowser control that will not render images. Originally our app was just launching IE7 to display an HTML page. The bitmap images were not displaying - path was correct...
1
by: san123456789 | last post by:
Hi, Im using a MS SQL server to store images... Im creating a windows form application using C#. I need to store and retrieve images from the database. This is my code to store images: ...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.