Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > PHP > PHP Forum > ผมทำหน้าที่ดู รูปภาพที่ทำการอัพโหลดผ่านหน้าเว็บครับ แต่ผมอยากให้ภาพ แสดงเรียงไปทางซ้ายสัก 5 ภาพ หน้านึกแสดงสัก 20 ภาพครับ



 

ผมทำหน้าที่ดู รูปภาพที่ทำการอัพโหลดผ่านหน้าเว็บครับ แต่ผมอยากให้ภาพ แสดงเรียงไปทางซ้ายสัก 5 ภาพ หน้านึกแสดงสัก 20 ภาพครับ

 



Topic : 099301



โพสกระทู้ ( 545 )
บทความ ( 0 )



สถานะออฟไลน์




ผมทำหน้าที่ดู รูปภาพที่ทำการอัพโหลดผ่านหน้าเว็บครับ แต่ผมอยากให้ภาพ แสดงเรียงไปทางซ้ายสัก 5 ภาพ หน้านึกแสดงสัก 20 ภาพครับ แต่ตอนนี้ที่ทำตาม code จะเป็นการเรียงภาพลงมาเรื่อยๆ 20 ภาพครับ
Code (PHP)
<body background="pair/bg_admin.png">
<style type="text/css">
a:link {
	text-decoration: none;
	color: #000;
}
a:visited {
	text-decoration: none;
	color: #000;
}
a:hover {
	text-decoration: none;
	color: #000;
}
a:active {
	text-decoration: none;
	color: #000;
}
</style>

<?php
	function condb($strSQL)
	{
		//echo $strSQL;
		$db = mysql_connect("localhost", "beautyesy_usr", "Dl219XNR") or die("Opps some thing went wrong");
		mysql_select_db("beautyesy_db", $db) or die("Opps some thing went wrong");
		// mysql_select_db("kktk_fakfree", $db) or die("Opps some thing went wrong");
		$result=mysql_query($strSQL);
		echo mysql_error();
		mysql_close($db);
		return $result;
	}
		function mytitle($title)
	{
		echo "<h3><font color=black><center>".$title."</center></font><hr color='black' height='1px' width='100%'></h3>";
	}
	function gettotalrow($table, $where) {
		if ($where == "")
			$result=condb("select count(*) from ".$table."");
		else
			$result=condb("select count(*) from ".$table." ".$where);
		if(mysql_num_rows($result)) 
		{
			$row=mysql_fetch_array($result);
			return $row[0];
		}
		else
			return "0";
	} 
	function showmessage($redirect,$message) {
   	 	//message($message);
		if ($redirect=="") {
			echo "<center><strong><font color=black>".$message."</font></strong></center><br />";
			$_SESSION["message"] = $message;
		}	
		else {
            echo "<meta http-equiv=refresh content=1;URL=";
            echo $redirect;
            echo ">";
			$_SESSION["redirect_message"] = $message;
		}
	}

	function showerror($redirect,$message) {
		if ($redirect=="") {
			echo "<center><strong><font color=red>".$message."</font></strong></center>";
			$_SESSION["message"] = $message;
		}
		else {
            echo '<meta http-equiv=refresh content=1;URL='.$redirect.'>';
			$_SESSION["redirect_message"] = $message;
		}
 	}

		function getitem($field, $table, $where) {
		if ($where == "")
			$result=condb("select ".$field." from ".$table."");
		else
			$result=condb("select ".$field." from ".$table." ".$where);
		if(mysql_num_rows($result)) 
		{
			$row=mysql_fetch_array($result);
			return $row[0];
		}
		else
			return "0";
	} 


	
?>
<script>
function ConfirmDelete()
{
  var x = confirm("ต้องการลบรูปภาพนี้ ?");
  if (x)
      return true;
  else
    return false;
}
</script>

<?
	mytitle("แกลอรี่รูปภาพ");
?>
<?php

		$totalrow = gettotalrow("uploadimage","");
		$maxrowperpage = 20;

	
		if ($totalrow > $maxrowperpage)
		{	
			$totalpage = ceil($totalrow / $maxrowperpage);
			echo "<center> มีทั้งหมด ".$totalpage." หน้า (".$totalrow." ภาพ)   เลือกหน้าที่ต้องการ <br /><br />";
			for ($i=1;$i<=$totalpage;$i++)
			{
				?>
					<span class="art-button-wrapper"><span class="l"> </span><span class="r"> </span>
					<? 	if ($i == ($_GET["Limit"]+1))
							echo "&nbsp; ".$i." &nbsp;";
						else
							echo '<a class="art-button"  href="uploadimage_2.php?action=uploadimage&Limit='.($i-1).'">'.$i.'</a>';

					?>
					
                    </span> 
				<?
			}
		}

?>


	<table width="100%" border="3" cellpadding="0" cellspacing="0">
	
	<?
	
	
		
?>	
    <tr><td colspan=0><strong><? echo $title; ?></strong></td></tr>
      <tr
        <td background="pair/Footer.png" width="100%"><center>        ภาพ        </center></td> 
      </tr>
      <?php
		
		if (!$_GET["Limit"] || $_GET["Limit"]=="" ) !$_GET["Limit"]="0";
		$result=condb("select * from uploadimage order by id desc Limit ".($_GET["Limit"] * $maxrowperpage).", $maxrowperpage");
	
		if (mysql_num_rows($result)==0)
		{	echo("<tr><td colspan=3><center>ไม่พบข้อมูล</center></td></tr>");
		}
		else
		{
			$count=$_GET["Limit"] * $maxrowperpage;
			while ($row=mysql_fetch_array($result))
			{
				list($width, $height) = getimagesize("".getcwd()."/".$row["url"]."");
				if ($width > 100) $width=100;
	
 ?>
	<form id="frmEdit" method="post">
      <tr onmouseover="style.backgroundColor='#525252';" onmouseout="style.backgroundColor='';">
        <td><center><br>
			<?php echo "<img src='".$row["url"]."' width='".$width."'> <br /> URL: <a href='".$row["url"]."' target='_blank'>".$row["url"]."</a>"; ?>
        </center></td>
      </tr>
	 </form>
      <?php
			}
		}

	
			
		?>
		
    </table><br><br>
	<center><img src="pair/g_4.png" border="0"><a href="admin.php"><img src="pair/g_1.png" border="0"></a><a href="uploadimage.php"><img src="pair/g_3.png" border="0"></a><img src="pair/g_5.png" border="0"></center></center>
    </body>




Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-08-19 16:50:03 By : tangsupap View : 677 Reply : 5
 

 

No. 1



โพสกระทู้ ( 1,569 )
บทความ ( 2 )



สถานะออฟไลน์
Twitter Facebook Blogger

งงครับ
วาด layout คร่าวๆ ให้ดูหน่อยได้มั้ยครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-19 16:51:35 By : itpcc
 


 

No. 2



โพสกระทู้ ( 545 )
บทความ ( 0 )



สถานะออฟไลน์


การแสดงผมตาม code
1

การแสดงผลที่ต้องการ
2


ประวัติการแก้ไข
2013-08-19 16:59:42
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-19 16:58:03 By : tangsupap
 

 

No. 3

Guest


ตอบความคิดเห็นที่ : 2 เขียนโดย : tangsupap เมื่อวันที่ 2013-08-19 16:58:03
รายละเอียดของการตอบ ::
อาจจะพอช่วยได้ ลองปรับความกว้างดูน่ะให้มันเหมาะสมกับขนาดของภาพ

<form id="frmEdit" method="post" style="display:inline-block;width:250px;">
<tr onmouseover="style.backgroundColor='#525252';" onmouseout="style.backgroundColor='';">
<td><center><br>
<?php echo "<img src='".$row["url"]."' width='".$width."'> <br /> URL: <a href='".$row["url"]."' target='_blank'>".$row["url"]."</a>"; ?>
</center></td>
</tr>
</form>


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-19 17:51:53 By : ข้อมูลเพียบ
 


 

No. 4



โพสกระทู้ ( 1,569 )
บทความ ( 2 )



สถานะออฟไลน์
Twitter Facebook Blogger

Code (PHP)
else
		{
			$count=$_GET["Limit"] * $maxrowperpage;
                        $i = 0; $eachRow = 5;
                        ?>
                <tr>
<?php
			while ($row=mysql_fetch_array($result))
			{
				list($width, $height) = getimagesize("".getcwd()."/".$row["url"]."");
				if ($width > 100) $width=100;
	
 ?>
	<form id="frmEdit" method="post">
      
        <td onmouseover="style.backgroundColor='#525252';" onmouseout="style.backgroundColor='';"><center><br>
			<?php echo "<img src='".$row["url"]."' width='".$width."'> <br /> URL: <a href='".$row["url"]."' target='_blank'>".$row["url"]."</a>"; ?>
        </center></td></form>
       <?php $i++; if($i % $each == 0){ ?> </tr><tr> <?php } //bug ?>        
        </tr>
	 
      <?php
			} ?>
		}
		?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-19 18:00:59 By : itpcc
 


 

No. 5



โพสกระทู้ ( 545 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 4 เขียนโดย : itpcc เมื่อวันที่ 2013-08-19 18:00:59
รายละเอียดของการตอบ ::
ผลลองเอา code ไปใส่ดูครับ แบบนี้นะครับ
Code (PHP)
<body background="pair/bg_admin.png">
<style type="text/css">
a:link {
	text-decoration: none;
	color: #000;
}
a:visited {
	text-decoration: none;
	color: #000;
}
a:hover {
	text-decoration: none;
	color: #000;
}
a:active {
	text-decoration: none;
	color: #000;
}
</style>

<?php
	function condb($strSQL)
	{
		//echo $strSQL;
		$db = mysql_connect("localhost", "beautyesy_usr", "Dl219XNR") or die("Opps some thing went wrong");
		mysql_select_db("beautyesy_db", $db) or die("Opps some thing went wrong");
		// mysql_select_db("kktk_fakfree", $db) or die("Opps some thing went wrong");
		$result=mysql_query($strSQL);
		echo mysql_error();
		mysql_close($db);
		return $result;
	}
		function mytitle($title)
	{
		echo "<h3><font color=black><center>".$title."</center></font><hr color='black' height='1px' width='100%'></h3>";
	}
	function gettotalrow($table, $where) {
		if ($where == "")
			$result=condb("select count(*) from ".$table."");
		else
			$result=condb("select count(*) from ".$table." ".$where);
		if(mysql_num_rows($result)) 
		{
			$row=mysql_fetch_array($result);
			return $row[0];
		}
		else
			return "0";
	} 
	function showmessage($redirect,$message) {
   	 	//message($message);
		if ($redirect=="") {
			echo "<center><strong><font color=black>".$message."</font></strong></center><br />";
			$_SESSION["message"] = $message;
		}	
		else {
            echo "<meta http-equiv=refresh content=1;URL=";
            echo $redirect;
            echo ">";
			$_SESSION["redirect_message"] = $message;
		}
	}

	function showerror($redirect,$message) {
		if ($redirect=="") {
			echo "<center><strong><font color=red>".$message."</font></strong></center>";
			$_SESSION["message"] = $message;
		}
		else {
            echo '<meta http-equiv=refresh content=1;URL='.$redirect.'>';
			$_SESSION["redirect_message"] = $message;
		}
 	}

		function getitem($field, $table, $where) {
		if ($where == "")
			$result=condb("select ".$field." from ".$table."");
		else
			$result=condb("select ".$field." from ".$table." ".$where);
		if(mysql_num_rows($result)) 
		{
			$row=mysql_fetch_array($result);
			return $row[0];
		}
		else
			return "0";
	} 


	
?>
<script>
function ConfirmDelete()
{
  var x = confirm("ต้องการลบรูปภาพนี้ ?");
  if (x)
      return true;
  else
    return false;
}
</script>

<?
	mytitle("แกลอรี่รูปภาพ");
?>
<?php

		$totalrow = gettotalrow("uploadimage","");
		$maxrowperpage = 20;

	
		if ($totalrow > $maxrowperpage)
		{	
			$totalpage = ceil($totalrow / $maxrowperpage);
			echo "<center> มีทั้งหมด ".$totalpage." หน้า (".$totalrow." ภาพ)   เลือกหน้าที่ต้องการ <br /><br />";
			for ($i=1;$i<=$totalpage;$i++)
			{
				?>
					<span class="art-button-wrapper"><span class="l"> </span><span class="r"> </span>
					<? 	if ($i == ($_GET["Limit"]+1))
							echo "&nbsp; ".$i." &nbsp;";
						else
							echo '<a class="art-button"  href="uploadimage_2.php?action=uploadimage&Limit='.($i-1).'">'.$i.'</a>';

					?>
					
                    </span> 
				<?
			}
		}

?>


	<table width="100%" border="0" cellpadding="0" cellspacing="0">
	
	<?		
?>	
    <tr><td colspan=0><strong><? echo $title; ?></strong></td></tr>
      <?php
		
		if (!$_GET["Limit"] || $_GET["Limit"]=="" ) !$_GET["Limit"]="0";
		$result=condb("select * from uploadimage order by id desc Limit ".($_GET["Limit"] * $maxrowperpage).", $maxrowperpage");
	
		if (mysql_num_rows($result)==0)
		{	echo("<tr><td colspan=3><center>ไม่พบข้อมูล</center></td></tr>");
		}
		else
		{
			$count=$_GET["Limit"] * $maxrowperpage;
                        $i = 0; $eachRow = 5;
                        ?>
                <tr>
<?php
			while ($row=mysql_fetch_array($result))
			{
				list($width, $height) = getimagesize("".getcwd()."/".$row["url"]."");
				if ($width > 100) $width=100;
	
 ?>
	<form id="frmEdit" method="post">
      
        <td onmouseover="style.backgroundColor='#525252';" onmouseout="style.backgroundColor='';"><center><br>
			<?php echo "<img src='".$row["url"]."' width='".$width."'> <br /> URL: <a href='".$row["url"]."' target='_blank'>".$row["url"]."</a>"; ?>
        </center></td></form>
       <?php $i++; if($i % $each == 0){ ?> </tr><tr> <?php } //bug ?>        
        </tr>
	      <?php
     
			} 
		}
		?>		
    </table><br><br>
	<center><img src="pair/g_4.png" border="0"><a href="admin.php"><img src="pair/g_1.png" border="0"></a><a href="uploadimage.php"><img src="pair/g_3.png" border="0"></a><img src="pair/g_5.png" border="0"></center></center>
    </body>


มันมี ERROR แบบนี้ครับ แล้วมันก็ยังเรียงลงมาอยู่เลยครับ
Code (SQL)
Warning: Division by zero in /home/beautyesy/domains/beautyesy.com/public_html/uploadimage_2.php on line 169




ประวัติการแก้ไข
2013-08-20 10:31:25
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-20 10:21:43 By : tangsupap
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ผมทำหน้าที่ดู รูปภาพที่ทำการอัพโหลดผ่านหน้าเว็บครับ แต่ผมอยากให้ภาพ แสดงเรียงไปทางซ้ายสัก 5 ภาพ หน้านึกแสดงสัก 20 ภาพครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่