Spend time with smart people. Watching them solve problems and how they think will give you something to work towards.

Author Topic: help loop  (Read 66 times)

silverkortex1985

  • Prospective Webgeek
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 143
    • View Profile
help loop
« on: July 28, 2010, 03:39:00 PM »
guy help po panu po ba ma i view itong image na ito nang naka table tapos grid style.

Code: [Select]
                                <?php $thumbs_dir "images/upload_img/";
$dir opendir($thumbs_dir);
$action=$_GET[action];
$file=$_GET[imageid];
if ($action == "delete"){ 
unlink($thumbs_dir.$file);
}
if($_POST['submit']){
$_FILES['uploaded_image']['tmp_name'];
if ($_FILES["file"]["error"] > 0){
echo "Error: " $_FILES["file"]["error"] . "<br />";
}
move_uploaded_file($_FILES["file"]["tmp_name"], "/images/deleted_img/" $_FILES["file"]["name"]);
}
while ($file readdir($dir)){
if ($file != "." && $file != ".." ){
echo "

<a href=\"$thumbs_dir$file\" class=\"highslide\" onclick=\"return hs.expand(this)\">
<img src='$thumbs_dir$file' width=\"140\" height=\"80\" alt=\"$file\"/><br />$file</a>
<a href=\"logo.php?imageid=$file&action=delete\">
<img src=\"images/menu/icon-16-logout.png\" title=\"delete\" /></a><br /><br />

"
;
}
}
?>

Logged
team work :
is very important for you to learn, what others idea and what others can share to you.

napz

  • Prospective Webgeek
  • ***
  • Offline Offline
  • Posts: 131
    • View Profile
Re: help loop
« Reply #1 on: July 28, 2010, 06:07:03 PM »
<table>
ngaun d2 mo gawin loop mo
<start ng loop>

 <TR> <td> image image </td> <td> image image </td>  </TR>

<END NG LOOP>
</TABLE>
Logged

Jason

  • Administrator
  • Web Enthusiast
  • *****
  • Offline Offline
  • Gender: Male
  • Posts: 511
  • Systems and Web Developer
    • View Profile
    • WWW
Re: help loop
« Reply #2 on: July 28, 2010, 11:47:44 PM »
This would display it in a 5 column table

Code: [Select]
                                <?php $thumbs_dir "images/upload_img/";
$dir opendir($thumbs_dir);
$action=$_GET[action];
$file=$_GET[imageid];
if ($action == "delete"){ 
unlink($thumbs_dir.$file);
}
if($_POST['submit']){
$_FILES['uploaded_image']['tmp_name'];
if ($_FILES["file"]["error"] > 0){
echo "Error: " $_FILES["file"]["error"] . "<br />";
}
move_uploaded_file($_FILES["file"]["tmp_name"], "/images/deleted_img/" $_FILES["file"]["name"]);
}
//counter
$counter=0;
//initialize table and row... you can also put your th tags here
echo '<table><tr>';
while ($file readdir($dir)){
if ($file != "." && $file != ".." ){
//increment counter
$counter++;
echo "
<td>

<a href=\"$thumbs_dir$file\" class=\"highslide\" onclick=\"return hs.expand(this)\">
<img src='$thumbs_dir$file' width=\"140\" height=\"80\" alt=\"$file\"/><br />$file</a>
<a href=\"logo.php?imageid=$file&action=delete\">
<img src=\"images/menu/icon-16-logout.png\" title=\"delete\" /></a><br /><br />

</td>

//end row it reached 5 column "
;
if(
$counter==5) {
echo
'</tr><tr>';
$counter=0;
}
}
}
//end row and table
echo '</tr></table>';
?>



check out the commented codes


pasensya na po hirap ng walang code coloring... didnt test the code din po... pero somehow i hope you get the idea...

silverkortex1985

  • Prospective Webgeek
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 143
    • View Profile
Re: help loop
« Reply #3 on: July 29, 2010, 02:37:40 PM »
OH MY GOD YOUR MY SAVIOR JASON THANK YOU SO MUCH!!! working perfectly
Logged
team work :
is very important for you to learn, what others idea and what others can share to you.
 



WebGeek Philippines © Copyright 2009-2010 - Privacy Policy
The WebGeek Philippines is a Community for Filipino WebGeeks, Web Developers Webmasters, Web Designers, Internet Marketers & Freelancers.
Powered by SMF 2.0 RC1 | SMF © 2006–2009, Simple Machines LLC