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
image gallery script problem!
Old 11-03-2007, 07:40 AM image gallery script problem!
digitalfusion's Avatar
Skilled Talker

Posts: 73
Name: Martin
Location: Fife, Scotland
Trades: 0
Hi,

I'm creating a script which allows users to login and view and manage online gallery's of photos for storage etc... but i need to know how to display the results of the gallery image query in a table of 3 coloumns by however many rows how is it possible to do that so it knows how many rows to put in and where it needs to start a new row.

i was thinking along the lines of mysql_num_rows to get the number of records there is in the database under the galleryid and then divide it by three to get the number of rows required but how would i translate the number of rows to get it to display this.

Regards,
Martin
__________________
---------------------------------------------------

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
digitalfusion is offline
Reply With Quote
View Public Profile Visit digitalfusion's homepage!
 
 
Register now for full access!
Old 11-03-2007, 09:28 AM Re: image gallery script problem!
maxxximus's Avatar
Extreme Talker

Posts: 219
Name: Rob
Location: UK
Trades: 0
You really need to steer clear of using tables if possible.
I would display it as a unordered list <ul> and use css to style it similar to a table.

Below is a rough and ready bit of code that will display your photos as a 3 column grid 650px wide and will display as many photos as the recordset contains using the do while loop. Adjust to your own needs.

Code:
// establish a connection 
// query your database

<!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>
<style type="text/css">
ul {
list-style:none;
width: 650px;
}

li{float:left;
border:1px solid black;
}

li img {
width:180px;
height:135px;
padding:10px;

}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body><ul><?php do {?>

<li><img src="<?php echo $row['imageURL'] ;

?>" /></li>

<?php }
while($row = mysql_fetch_assoc($result));?></ul>
</body>

</html>
<?php
mysql_free_result($result);
?>
maxxximus is offline
Reply With Quote
View Public Profile
 
Old 11-04-2007, 07:22 PM Re: image gallery script problem!
digitalfusion's Avatar
Skilled Talker

Posts: 73
Name: Martin
Location: Fife, Scotland
Trades: 0
Quote:
Originally Posted by maxxximus View Post
You really need to steer clear of using tables if possible.
I would display it as a unordered list <ul> and use css to style it similar to a table.

Below is a rough and ready bit of code that will display your photos as a 3 column grid 650px wide and will display as many photos as the recordset contains using the do while loop. Adjust to your own needs.

Code:
// establish a connection 
// query your database
 
<!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>
<style type="text/css">
ul {
list-style:none;
width: 650px;
}
 
li{float:left;
border:1px solid black;
}
 
li img {
width:180px;
height:135px;
padding:10px;
 
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
 
<body><ul><?php do {?>
 
<li><img src="<?php echo $row['imageURL'] ;
 
?>" /></li>
 
<?php }
while($row = mysql_fetch_assoc($result));?></ul>
</body>
 
</html>
<?php
mysql_free_result($result);
?>
Thanks for your help i tried your solution and it works well thank you very much!

Regards,
Martin
__________________
---------------------------------------------------

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
digitalfusion is offline
Reply With Quote
View Public Profile Visit digitalfusion's homepage!
 
Reply     « Reply to image gallery script problem!
 

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.24156 seconds with 12 queries