|
 |
|
ขอรบกวนหน่อยครับไม่รู้จะตั้งเงื่อนไขยังไง นึกไม่ออกเลยครับ คือว่าผมดึงรูปออกมาจากฐานข้อมูล แล้วอยากให้มันเรียง แถวละ 3 รูป นะครับ |
|
 |
|
|
 |
 |
|
ขอรบกวนหน่อยครับไม่รู้จะตั้งเงื่อนไขยังไง นึกไม่ออกเลยครับ คือว่าผมดึงรูปออกมาจากฐานข้อมูล แล้วอยากให้มันเรียง แถวละ 3 รูป นะครับ
ขอคำชี้แนะหน่อยนะครับ
รูปที่1 รูปที่2 รูปที่3
รูปที่4 รูปที่5 รูปที่6
รูปที่7
inser.php
Code (PHP)
<HTML>
<HEAD>
<title>FileInser</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
</HEAD>
<BODY>
<?php
mysql_connect("localhost","root","test") or die ("ไม่สามารถติดต่อ database ได้");
mysql_select_db("project") or die ("ไม่พบ $dbname"); //mysql_select_db จะเป็นการเรียก databas;
mysql_query("SET NAMES UTF8");
if($_FILES["File"]["name"]=="" || $_POST["Name"]=="" || $_POST["Detail"]==""){
echo "ข้อมูลสินค้าไม่ครบ";
echo "<br><a href=Fromupfile.html>กลับไปแก้ไข<br></a>";
}
else{
copy($_FILES["File"]["tmp_name"],"Fileimage/".$_FILES["File"]["name"]) ;
echo "อัพโหลด".$_POST["Name"]."เรียบร้อย";
$sql = "INSERT INTO fileimage ";
$sql .="(Name,FileName,Detail)
VALUES
('".$_POST["Name"]."','".$_FILES["File"]["name"]."','".$_POST["Detail"]."')";
$query = mysql_query($sql);
}
?>
<a href="fileselect.php">viewfile</a>
</BODY>
</HTML>
fileselect.php
Code (PHP)
<HTML>
<HEAD>
<title>selectupfile</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
</HEAD>
<BODY>
<?php
mysql_connect("localhost","root","test") or die ("ไม่สามารถติดต่อ database ได้");
mysql_select_db("project") or die ("ไม่พบ $dbname"); //mysql_select_db จะเป็นการเรียก databas;
mysql_query("SET NAMES UTF8");
$sql = "SELECT * FROM fileimage";
$query = mysql_query ($sql) or die ("ติดต่อตางราง [".$sql."] ไม่ได้");
$result = mysql_fetch_array($query);
?>
<table border="1">
<?php
while(){
}
?>
</table>
</BODY>
</HTML>
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2011-09-06 16:42:00 |
By :
เกียรติศักดิ์ |
View :
794 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จะกลับบ้านแล้วแต่อยากช่วย - -!
while
กำหนดค่าคงที่
echo $result["ชื่อ fieldรูป"]
ค่าคงที่ ++
if ค่าคงที่ =3
print <br>
ค่าคงที่ = 0; //reset ค่าคงที่
end if
end while
ถ้าทำ table ลองไปดัดแปลงเป็น <tr> ดูนะคะ
|
 |
 |
 |
 |
Date :
2011-09-06 17:35:24 |
By :
daisyme |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากครับพี่ๆ.. 
|
 |
 |
 |
 |
Date :
2011-09-07 04:45:29 |
By :
เกียรติศักดิ์ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|