|
|
|
แบ่งคอลัมน์ไม่ได้ซักที ใครรู้ช่วยบอกที ทำมานานแล้วไม้ได้สักทีจะส่งงานแล้วค่ะ |
|
|
|
|
|
|
|
Code (PHP)
<? include_once "connDB.php"; ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>SA AUTO</title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link href="../style/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
color: #FFFF00;
font-weight: bold;
}
.style2 {font-size: 18px}
.style6 {color: #FFFF00; font-weight: bold; font-size: 18px; }
body {
background-image: url(picture/b202.jpg);
}
-->
</style>
</head>
<body>
<script>
var nW,nH,oH,oW;
function zoomToggle(iWideSmall,iHighSmall,iWideLarge,iHighLarge,whichImage){
oW=whichImage.style.width;oH=whichImage.style.height;
if((oW==iWideLarge)||(oH==iHighLarge)){
nW=iWideSmall;nH=iHighSmall;}else{
nW=iWideLarge;nH=iHighLarge;}
whichImage.style.width=nW;whichImage.style.height=nH;
}
</script>
<center>
<div id="container">
<div id="content">
<? include "top.php";?>
<p>
<? if($submit=="" or $show=="OK"){?>
</p>
<center><form name="form1" method="post" action="admin.php?show=OK&strSearch=Y">
</form>
<?
if(!isset($start)){
$start = 0;
$page=1;
}
$limit = '10';
if($strSearch=="Y"){
$Qtotal = mysql_query("select * from categories Where ".$Search2." like '%".$Search."%' ");
}else{
$Qtotal = mysql_query("select * from categories");
}
$total = mysql_num_rows($Qtotal);
if($strSearch=="Y"){
$Query = mysql_query("select * from categories Where ".$Search2." like '%".$Search."%' order by id DESC LIMIT $start,$limit");
}else{
$Query= mysql_query("select * from categories order by id DESC LIMIT $start,$limit");
}
$totalp = mysql_num_rows($Query);
$xx=$totalp+$start;
$yy=$start+1;
echo "ข้อมูลที่ ".$yy." ถึงข้อมูลที่ ".$xx;
printf(" | จากทั้งหมด %d รายการ ",$total);
printf(" | หน้าที่ %d <br />",$page);
?>
<br></center>
<table width="90%" border="2" cellpadding="1" cellspacing="2" bordercolor="#000099">
<tr bgcolor="#999999" height="40" onMouseOver="this.style.backgroundColor='#CCFFCC'" onMouseOut="this.style.backgroundColor=''">
<td width="14%" bgcolor="#0033CC" ><div align="center" class="style1 style2">
<div align="center">บาร์โค้ดสินค้า</div>
</div></td>
<td width="10%" bgcolor="#0033CC" ><div align="center"><span class="style6">รหัสสินค้า</span></div></td>
<td width="65%" bgcolor="#0033CC" ><div align="center" class="style6">
<div align="center">รายละเอียดสินค้า</div>
</div></td>
<td width="11%" bgcolor="#0033CC" ><div align="center" class="style6">
<div align="center">รูปภาพ</div>
</div></td>
</tr>
<?
while($arr = mysql_fetch_array($Query)){
$autoid = $arr['id'];
$i++;
if($i%2==0){
$bg = "#CCCCCC";
}else{
$bg = "#FFFFFF";
}
?>
<tr bgcolor="<? echo $bg?>" onMouseOver="this.style.backgroundColor='#CCFFCC'" onMouseOut="this.style.backgroundColor=''" valign="top">
<td bgcolor="#FFFFCC"><? echo $arr['barcode_id'] ?></td>
<td bgcolor="#FFFFCC"><? echo $arr['product_id'] ?></td>
<td bgcolor="#FFFFCC"><? echo $arr['deception'] ?></td>
<td bgcolor="#FFFFCC"><div align="center"><font color="#005CA2">
<img border="0" src='admin/picture/product/<? echo $arr['photo_prd'] ?>' width='80' height='79' onclick="zoomToggle('70px','69px','350px','320px',this);">
</a>
</img></font></div></td>
</tr>
<? }?>
</table>
<? }?>
</div>
<div id="footer">
<? if($submit=="" or $show=="OK"){
$page = ceil($total/$limit);
for($i=1;$i<=$page;$i++){
if($_GET['page']==$i){
echo "[<a href='?start=".$limit*($i-1)."&page=$i&strSearch=$strSearch&Search=$Search&Search2=$Search2'><B>$i</B></A>]";
}else{
echo "[<a href='?start=".$limit*($i-1)."&page=$i&strSearch=$strSearch&Search=$Search&Search2=$Search2'>$i</A>]";
}}} ?>
</div>
</div>
</center>
</body>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2011-08-22 15:56:22 |
By :
mnmn |
View :
856 |
Reply :
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอรายละเอียดหน่อยครับ ว่าต้องการจะแบ่งยังไง กี่แถว กี่คอลัม
|
|
|
|
|
Date :
2011-08-22 16:04:17 |
By :
arm8957 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คุณอยากให้แสดงผลออกมา ซึ่งมาข้อมูลหลายเรคคอดใช่ไม๊ครับ(ผมเข้าใจถูกป่าว?) ถ้าใช่ก็ลองดูแบบนี้นะ
Code (PHP)
<? include_once "connDB.php"; ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>SA AUTO</title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link href="../style/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
color: #FFFF00;
font-weight: bold;
}
.style2 {font-size: 18px}
.style6 {color: #FFFF00; font-weight: bold; font-size: 18px; }
body {
background-image: url(picture/b202.jpg);
}
-->
</style>
</head>
<body>
<script>
var nW,nH,oH,oW;
function zoomToggle(iWideSmall,iHighSmall,iWideLarge,iHighLarge,whichImage){
oW=whichImage.style.width;oH=whichImage.style.height;
if((oW==iWideLarge)||(oH==iHighLarge)){
nW=iWideSmall;nH=iHighSmall;}else{
nW=iWideLarge;nH=iHighLarge;}
whichImage.style.width=nW;whichImage.style.height=nH;
}
</script>
<center>
<div id="container">
<div id="content">
<? include "top.php";?>
<p>
<? if($submit=="" or $show=="OK"){?>
</p>
<center><form name="form1" method="post" action="admin.php?show=OK&strSearch=Y">
</form>
<?
if(!isset($start)){
$start = 0;
$page=1;
}
$limit = '10';
if($strSearch=="Y"){
$Qtotal = mysql_query("select * from categories Where ".$Search2." like '%".$Search."%' ");
}else{
$Qtotal = mysql_query("select * from categories");
}
$total = mysql_num_rows($Qtotal);
if($strSearch=="Y"){
$Query = mysql_query("select * from categories Where ".$Search2." like '%".$Search."%' order by id DESC LIMIT $start,$limit");
}else{
$Query= mysql_query("select * from categories order by id DESC LIMIT $start,$limit");
}
$totalp = mysql_num_rows($Query);
$xx=$totalp+$start;
$yy=$start+1;
echo "ข้อมูลที่ ".$yy." ถึงข้อมูลที่ ".$xx;
printf(" | จากทั้งหมด %d รายการ ",$total);
printf(" | หน้าที่ %d <br />",$page);
?>
<br></center>
<table width="90%" border="2" cellpadding="1" cellspacing="2" bordercolor="#000099">
<tr bgcolor="#999999" height="40" onMouseOver="this.style.backgroundColor='#CCFFCC'" onMouseOut="this.style.backgroundColor=''">
<td width="14%" bgcolor="#0033CC" ><div align="center" class="style1 style2">
<div align="center">บาร์โค้ดสินค้า</div>
</div></td>
<td width="10%" bgcolor="#0033CC" ><div align="center"><span class="style6">รหัสสินค้า</span></div></td>
<td width="65%" bgcolor="#0033CC" ><div align="center" class="style6">
<div align="center">รายละเอียดสินค้า</div>
</div></td>
<td width="11%" bgcolor="#0033CC" ><div align="center" class="style6">
<div align="center">รูปภาพ</div>
</div></td>
</tr>
<?PHP
$i=1;//แก้ตรงนี้
while($arr = mysql_fetch_array($Query)){
$autoid = $arr['id'];
if($i%2==0){
$bg = "#CCCCCC";
}else{
$bg = "#FFFFFF";
}
?>
<tr bgcolor="<? echo $bg?>" onMouseOver="this.style.backgroundColor='#CCFFCC'" onMouseOut="this.style.backgroundColor=''" valign="top">
<td bgcolor="#FFFFCC"><? echo $arr['barcode_id'] ?></td>
<td bgcolor="#FFFFCC"><? echo $arr['product_id'] ?></td>
<td bgcolor="#FFFFCC"><? echo $arr['deception'] ?></td>
<td bgcolor="#FFFFCC"><div align="center"><font color="#005CA2">
<img border="0" src='admin/picture/product/<? echo $arr['photo_prd'] ?>' width='80' height='79' onclick="zoomToggle('70px','69px','350px','320px',this);">
</a>
</img></font></div></td>
</tr>
<?PHP $i++; } //และก็ให้ค่า $i เพิ่มทีละ 1 ?>
</table>
<? }?>
</div>
<div id="footer">
<? if($submit=="" or $show=="OK"){
$page = ceil($total/$limit);
for($i=1;$i<=$page;$i++){
if($_GET['page']==$i){
echo "[<a href='?start=".$limit*($i-1)."&page=$i&strSearch=$strSearch&Search=$Search&Search2=$Search2'><B>$i</B></A>]";
}else{
echo "[<a href='?start=".$limit*($i-1)."&page=$i&strSearch=$strSearch&Search=$Search&Search2=$Search2'>$i</A>]";
}}} ?>
</div>
</div>
</center>
</body>
|
|
|
|
|
Date :
2011-08-22 16:10:28 |
By :
arm8957 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จากโค๊ดที่คุณเขียนมันน่าจะไม่ใช่ 2 คอลัมน์5 แถว นะครับ
เอาครับ 5 คอลัมน์ 2 แถว
Code (PHP)
<? include_once "connDB.php"; ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>SA AUTO</title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<link href="../style/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
color: #FFFF00;
font-weight: bold;
}
.style2 {font-size: 18px}
.style6 {color: #FFFF00; font-weight: bold; font-size: 18px; }
body {
background-image: url(picture/b202.jpg);
}
-->
</style>
</head>
<body>
<script>
var nW,nH,oH,oW;
function zoomToggle(iWideSmall,iHighSmall,iWideLarge,iHighLarge,whichImage){
oW=whichImage.style.width;oH=whichImage.style.height;
if((oW==iWideLarge)||(oH==iHighLarge)){
nW=iWideSmall;nH=iHighSmall;}else{
nW=iWideLarge;nH=iHighLarge;}
whichImage.style.width=nW;whichImage.style.height=nH;
}
</script>
<center>
<div id="container">
<div id="content">
<? include "top.php";?>
<p>
<? if($submit=="" or $show=="OK"){?>
</p>
<center><form name="form1" method="post" action="admin.php?show=OK&strSearch=Y">
</form>
<?
if(!isset($start)){
$start = 0;
$page=1;
}
$limit = '10';
if($strSearch=="Y"){
$Qtotal = mysql_query("select * from categories Where ".$Search2." like '%".$Search."%' ");
}else{
$Qtotal = mysql_query("select * from categories");
}
$total = mysql_num_rows($Qtotal);
if($strSearch=="Y"){
$Query = mysql_query("select * from categories Where ".$Search2." like '%".$Search."%' order by id DESC LIMIT $start,$limit");
}else{
$Query= mysql_query("select * from categories order by id DESC LIMIT $start,$limit");
}
$totalp = mysql_num_rows($Query);
$xx=$totalp+$start;
$yy=$start+1;
echo "ข้อมูลที่ ".$yy." ถึงข้อมูลที่ ".$xx;
printf(" | จากทั้งหมด %d รายการ ",$total);
printf(" | หน้าที่ %d <br />",$page);
?>
<br></center>
<table border="2" cellpadding="1" cellspacing="2" bordercolor="#000099">
<tr bgcolor="#999999" height="40" onMouseOver="this.style.backgroundColor='#CCFFCC'" onMouseOut="this.style.backgroundColor=''">
<td width="111" bgcolor="#0033CC" ><div align="center" class="style1 style2">
<div align="center">บาร์โค้ดสินค้า</div>
</div></td>
<td width="81" bgcolor="#0033CC" ><div align="center"><span class="style6">รหัสสินค้า</span></div></td>
<td width="609" bgcolor="#0033CC" ><div align="center" class="style6">
<div align="center">รายละเอียดสินค้า</div>
</div></td>
<td width="90" bgcolor="#0033CC" ><div align="center" class="style6"><div align="center">รูปภาพ</div></div></td>
<td width="35">เพิ่มให้ละ</td>
</tr>
<?
$i=1;
while($arr = mysql_fetch_array($Query)){
$autoid = $arr['id'];
if($i%2==0){
$bg = "#CCCCCC";
}else{
$bg = "#FFFFFF";
}
?>
<tr bgcolor="<? echo $bg?>" onMouseOver="this.style.backgroundColor='#CCFFCC'" onMouseOut="this.style.backgroundColor=''" valign="top">
<td bgcolor="#FFFFCC"><? echo $arr['barcode_id'] ?></td>
<td bgcolor="#FFFFCC"><? echo $arr['product_id'] ?></td>
<td bgcolor="#FFFFCC"><? echo $arr['deception'] ?></td>
<td bgcolor="#FFFFCC"><div align="center"><font color="#005CA2"><img border="0" src='admin/picture/product/<? echo $arr['photo_prd'] ?>' width='80' height='79' onclick="zoomToggle('70px','69px','350px','320px',this);"/></font></div></td>
<td>เพิ่มให้ละ</td>
</tr>
<? $i++; }?>
</table>
<? }?>
</div>
<div id="footer">
<? if($submit=="" or $show=="OK"){
$page = ceil($total/$limit);
for($i=1;$i<=$page;$i++){
if($_GET['page']==$i){
echo "[<a href='?start=".$limit*($i-1)."&page=$i&strSearch=$strSearch&Search=$Search&Search2=$Search2'><B>$i</B></A>]";
}else{
echo "[<a href='?start=".$limit*($i-1)."&page=$i&strSearch=$strSearch&Search=$Search&Search2=$Search2'>$i</A>]";
}}} ?>
</div>
</div>
</center>
</body>
|
ประวัติการแก้ไข 2011-08-22 16:18:12
|
|
|
|
Date :
2011-08-22 16:16:55 |
By :
arm8957 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อ๋อ ถ้าลักษณะนั้น น่าจะใช้ div น่ะครับ ถ้าใช้ table จะจัดการยากหน่อยครับ
|
|
|
|
|
Date :
2011-08-22 16:29:03 |
By :
arm8957 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ผมไม่มีหรอกครับ แต่พอแสดงให้เป็นตัวอย่างได้ประมาณนี้ครับ (การแสดงผลนะ)
Code (PHP)
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div style="width:300px; float:left; border:1px #333 solid;">
<div style="width:150px; float:left">ใส่รูปภาพ<img src="file:///D|/AppServ/www/public_html/img/icon/กกก.png" width="128" height="128" alt="" /></div>
<div style="width:120px; float:right">
<p>ชื่อสินค้า</p>
<p>รายละเอียด</p>
</div>
<div style="width:110px; float:right; margin-top:50px; clear:both;">อ่านต่อ</div>
</div>
</body>
</html>
|
|
|
|
|
Date :
2011-08-22 16:40:54 |
By :
arm8957 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ค่ะขอบคุณมากนะคะ จะลองทำดู
|
|
|
|
|
Date :
2011-08-22 16:46:05 |
By :
mnmn |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้ายังไม่ได้ตามนี้น่คครับ
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die(mysql_error());
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM gallery";
$objQuery = mysql_query($strSQL);
echo"<table border=\"1\" cellspacing=\"1\" cellpadding=\"1\"><tr>";
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
echo "<td>";
$intRows++;
?>
<center>
<img src="thaicreate/<?=$objResult["Picture"];?>"><br>
<?=$objResult["GalleryName"];?>
<br>
</center>
<?
echo"</td>";
if(($intRows)%2==0)
{
echo"</tr>";
}
}
echo"</tr></table>";
?>
</body>
</html>
<?
mysql_close($objConnect);
?>
Go to : PHP MySQL Multiple Column
Go to : PHP MySQL Multiple Column
|
|
|
|
|
Date :
2011-08-22 22:38:04 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|