hey guys i have a pictur gallery made in php and i can't figure out how to make the images show like a picture galley instead of horizontal or verticlal?
like when you use an echo (picture)
they show like
pic pic pic pic pic
or if you add a br tag
pic
pic
pic
pic
i need pic pic pic pic
pic pic pic pic
thx!
images like a gallery
Moderators: egami, macek, gesf
Please post the code so that we can help.
this is my lates version it works but not completly.the page numbering is mest up i i see a litle line next to the pic?
[php]
<?php // Connects to your Database
mysql_connect("localhost", "techker_techker", "techker") or die(mysql_error()) ;
mysql_select_db("techker_softcore") or die(mysql_error()) ;
$QQQ = mysql_query("SELECT * FROM softcore WHERE type='sketch'");
if (!$QQQ) die(mysql_error());
// Get the total number of rows
$total_items = mysql_num_rows($QQQ);
// Get the page limit & page
$limit = $_GET['limit'];
$page = $_GET['page'];
// Do default setting
if((!$limit) || (is_numeric($limit) == false) || ($limit < 1) || ($limit > 5)) {
$limit = 50; //default
}
// Do default setting
if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_items)) {
$page = 1; //default
}
// Calculate the number to page to display
$total_pages = ceil($total_items / $limit);
$set_limit = $page * $limit - ($limit);
$QQQ1 = mysql_query("SELECT * FROM softcore WHERE type='sketch'");
if(!$QQQ1) die(mysql_error());
$err = mysql_num_rows($QQQ1);
//if($err == 0) die("No matches met your criteria.");
// Let user decide how many result to show in each page
// echo "Results per page: ";
//echo "<a href='list_store.php?limit=2&page=1'>2</a> |
//<a href='list_store.php?limit=5&page=1'>5</a> |
//<a href='list_store.php?limit=10&page=1'>10</a>";
//Count Message
$count = 1;
//to loop the results into the table rows code goes here
//while($FFF = mysql_fetch_assoc($QQQ1)) {
?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> SOFTCORE</title>
<style type="text/css">
<!--
body {
background-image: url(images/sketches_15.gif);
background-color: #000000;
}
-->
</style></head>
<body>
<div align="left"><? echo '<table><tr>';
$cnt = 0;
while ($row = mysql_fetch_assoc($QQQ1)) {
echo '<td><a href="/admin/pic_view.php?id='. $row['id'] .'" target="_blank" >
<img src="/admin/art/'. $row['thumb'] .'" border="0" alt="" />
</a></td>'; // output the img tag
$cnt++; // increase count, as we have added a pic now
if (($cnt %
== 0) {
// if $cnt modulus 4 equals 0, we have added 4 pictures,
// and makes a new line/row
echo '</tr><tr>'; // echo end of row
for ($cell = 0; $cell < ($cnt %
; $cell++) {
echo '<td> </td>';
}
// end the table
echo '</tr></table>';
}
}?>
</div>
<div align="left">
<?php
$prev_page = $page - 1;
if($prev_page >= 1) {
echo(" <a href=pic_galleryS.php?limit=$limit&page=$prev_page><b>Prev</b></a>");
}
for($i = 1; $i <= $total_pages; $i++){
if($i == $page){
echo($i." ");
}else{
echo("<a href=\"pic_galleryS.php?limit=$limit&page=$i\">$i</a> ");
}
}
$next_page = $page + 1;
if($next_page <= $total_pages) {
echo("</b><a href=pic_galleryS.php?limit=$limit&page=$next_page><b>Next</b></a> ");
}
//dbDisconnect($conn2);
?>
</div>
</td>
</tr>
</table>
</p>
</div>
</body>
</html>
[/php]
see it for your self and thx for the help!
http://www.softcoredesign.com/sketches.html
[php]
<?php // Connects to your Database
mysql_connect("localhost", "techker_techker", "techker") or die(mysql_error()) ;
mysql_select_db("techker_softcore") or die(mysql_error()) ;
$QQQ = mysql_query("SELECT * FROM softcore WHERE type='sketch'");
if (!$QQQ) die(mysql_error());
// Get the total number of rows
$total_items = mysql_num_rows($QQQ);
// Get the page limit & page
$limit = $_GET['limit'];
$page = $_GET['page'];
// Do default setting
if((!$limit) || (is_numeric($limit) == false) || ($limit < 1) || ($limit > 5)) {
$limit = 50; //default
}
// Do default setting
if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_items)) {
$page = 1; //default
}
// Calculate the number to page to display
$total_pages = ceil($total_items / $limit);
$set_limit = $page * $limit - ($limit);
$QQQ1 = mysql_query("SELECT * FROM softcore WHERE type='sketch'");
if(!$QQQ1) die(mysql_error());
$err = mysql_num_rows($QQQ1);
//if($err == 0) die("No matches met your criteria.");
// Let user decide how many result to show in each page
// echo "Results per page: ";
//echo "<a href='list_store.php?limit=2&page=1'>2</a> |
//<a href='list_store.php?limit=5&page=1'>5</a> |
//<a href='list_store.php?limit=10&page=1'>10</a>";
//Count Message
$count = 1;
//to loop the results into the table rows code goes here
//while($FFF = mysql_fetch_assoc($QQQ1)) {
?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> SOFTCORE</title>
<style type="text/css">
<!--
body {
background-image: url(images/sketches_15.gif);
background-color: #000000;
}
-->
</style></head>
<body>
<div align="left"><? echo '<table><tr>';
$cnt = 0;
while ($row = mysql_fetch_assoc($QQQ1)) {
echo '<td><a href="/admin/pic_view.php?id='. $row['id'] .'" target="_blank" >
<img src="/admin/art/'. $row['thumb'] .'" border="0" alt="" />
</a></td>'; // output the img tag
$cnt++; // increase count, as we have added a pic now
if (($cnt %

// if $cnt modulus 4 equals 0, we have added 4 pictures,
// and makes a new line/row
echo '</tr><tr>'; // echo end of row
for ($cell = 0; $cell < ($cnt %

echo '<td> </td>';
}
// end the table
echo '</tr></table>';
}
}?>
</div>
<div align="left">
<?php
$prev_page = $page - 1;
if($prev_page >= 1) {
echo(" <a href=pic_galleryS.php?limit=$limit&page=$prev_page><b>Prev</b></a>");
}
for($i = 1; $i <= $total_pages; $i++){
if($i == $page){
echo($i." ");
}else{
echo("<a href=\"pic_galleryS.php?limit=$limit&page=$i\">$i</a> ");
}
}
$next_page = $page + 1;
if($next_page <= $total_pages) {
echo("</b><a href=pic_galleryS.php?limit=$limit&page=$next_page><b>Next</b></a> ");
}
//dbDisconnect($conn2);
?>
</div>
</td>
</tr>
</table>
</p>
</div>
</body>
</html>
[/php]
see it for your self and thx for the help!
http://www.softcoredesign.com/sketches.html
- WebOutGateway
- php-forum Fan User
- Posts: 65
- Joined: Mon Jun 13, 2011 9:25 pm
- Location: Pasig City, Philippines
- Contact:
Cascading Style Sheets, or CSS, gives color and life to a website. It is how you want your content or output to be displayed.
There are three (3) types of CSS:
1. Internal which is defined under your <head> section and will only be used within that web page;
ex.
2. Inline which is defined in your HTML tags to style a every particular element;
ex.
and
3. External which is in a separate file with the .css extension, defined under your <head> section. This is the one you will link to your web page/s.
ex.
I hope this helps. Thank you.
Source: http://www.expression-web-tutorial.com/ ... -GPjuOSyAk
For more of CSS: http://www.w3schools.com/css/default.asp
There are three (3) types of CSS:
1. Internal which is defined under your <head> section and will only be used within that web page;
ex.
Code: Select all
<head>
<style type="text/css">
#video-gallery{
width: 350px;
padding: 12px;
margin: 15px auto;
}
</style>
</head>
ex.
Code: Select all
<p style= "font-size: 14px; color: purple;"></p>
3. External which is in a separate file with the .css extension, defined under your <head> section. This is the one you will link to your web page/s.
ex.
Code: Select all
<link rel="stylesheet" type="text/css" href="main.css" >
Source: http://www.expression-web-tutorial.com/ ... -GPjuOSyAk
For more of CSS: http://www.w3schools.com/css/default.asp