Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How do you insert MySQL images into HTML table?
Old 03-17-2005, 04:46 AM How do you insert MySQL images into HTML table?
csj
Junior Talker

Posts: 2
Trades: 0
Hi

I am desperate for help!

I have a php page which displays
small images (90 X 90 pixels). This info is extracted rows from a MySQL table based on a specific query.
When I display it I want the image to display and underneath that I want the title of the image.

The problem i have is that when it displays it runs horizantally across the screen with no breaks.

I need to find out how I can display this in an HTML table, so that there are only 4 images and then the next row starts.

Please, please,please help me just a bit, to get me started...
csj is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-17-2005, 09:19 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
In your script you will need to have a loop somehwere that keeps a counter of how many images have been output so far. In between image you will echo "</td><td>" to finsh the cell and start the next one. When the counter hits a certain number of your choice, you reset the counter to zero, and echo "</td></tr><tr><td>" which will start a new table row.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 03-17-2005, 01:30 PM
paid2surf's Avatar
Skilled Talker

Posts: 59
Location: WI
Trades: 0
Somthing like......
(note; not tested)

<table>


PHP:
--------------------------------------------------------------------------------

$lines = 0;
for ($i=0; $i<$totalimages; $i++) {
if ($lines == 0) {
print '<tr>';
}

print '<td><img src="image.jpg"></td>';

$lines++;

if ($lines == 4) {
print '</tr>';
$lines = 0;
}
}

--------------------------------------------------------------------------------


</table>
paid2surf is offline
Reply With Quote
View Public Profile Visit paid2surf's homepage!
 
Reply     « Reply to How do you insert MySQL images into HTML table?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12155 seconds with 12 queries