/    Sign up×
Community /Pin to ProfileBookmark

display data problem

Hi,

I want to display a mysql table using php. I have 1 table where 1 field is the url location of an image to load, and another is the image description.

I am trying to display the images in a table where 1 row has an image in each cell and the cell beneath has the description for the above image.

Sounds easy enough but I try to display a images on a row then below then descriptions on the next row.

Is there an easy way to do this, or do you have to go through each cell print images, and then store the text to display and then disoplay another row for each above cell (image).

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@scousesheriffNov 14.2006 — Something along these lines should get what I think you are after:
[code=php]
$result = mysql_query("select url, desc from table");
echo "<table>";
while($row = mysql_fetch_array($result)){
echo "<tr><td><img src="".$row['url'].""/></td></tr>";
echo "<tr><td>".$row['desc']."</td></tr>";
}
echo "</table>";
[/code]
Copy linkTweet thisAlerts:
@jagguyauthorNov 14.2006 — Thanks for the reply .

I can already display an image and text below the image in a table as I want, after posting my thread. The php script is on a html page with nav bar on top and left, so each php script will be embedded with this.

q)My problem is really displaying data from a drop down list eg display table1 or table 2 etc and doing this efficiently. Having to display say 20 records per page then going to another page would require a post to another page with assciated nav bar on top and side ( messy). I think maybe php-self might be worth a look here.

q)having to edit a record where I would goto another page to modify say text description or delete and image and then have another confirmation page.

I can do this my way but whether my way is the most efficient way is another mater.
×

Success!

Help @jagguy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...