|
|
|
คือจะโชว์รูปจากเดต้าเบสอ่าค่ะ ใช้ภาษาphp แต่รันรูปไม่ขึ้นเรย มันขึ้นเปนไอคอมรูปแทนอ่า ไม่รุ้ทำไมอ่ะค่ะ ใครรู้ช่วยหน่อยน๊าค๊า |
|
|
|
|
|
|
|
Code (PHP)
<body>
<div>
<? include('menubar.php'); ?>
</div>
<? include('onlineshop.inc.php');?>
<table width="1000" align="center" border="1">
<tr>
<td align="left"> <? include('sidemenu.php');?>
<table id="cart" bgcolor="#FF0066">
<tr> <td> <script> readCart(); </script> </td></tr>
</table>
</td>
<td>
<table width="100%" border="0">
<tr> <td width="30%"> </td>
<td width="50%"> </td>
<td> </td>
</tr>
<?php include("paging.inc.php");
$current_page=1;
if(isset($_GET['page']))
{
$current_page=$_GET['page'];
}
$rows_per_page = 9;
$start_row = paging_start_row($current_page,$rows_per_page);
$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM product LIMIT $start_row, $rows_per_page;";
$result=mysql_query($sql);
$found_rows=mysql_query("SELECT FOUND_ROWS();");
$total_rows=mysql_result($found_rows,0,0);
$total_pages = paging_total_pages($total_rows, $rows_per_page);
if($total_rows==0){
echo "<caption><b> no result </b></caption>";
}
else {
$stop_row = paging_stop_row($start_row, $rows_per_page, $total_rows);
echo "<caption><b> product no.". ($start_row +1) . "-" . "$stop_row from total $total_rows </b></caption>";
}
$count=0;
echo "<table border=0 align=center >";
while($objResult = mysql_fetch_array($result))
{
$PID = $objResult['Product_Id'];
$Pname = $objResult['Product_Name'];
$Pdesc1 = $objResult['Product_Des'];
$Pdesc = substr($Pdesc1,0,80). "..." ;
$Pprice = $objResult['Product_Prices'];
$Ppic = $objResult['Product_Pict']; // เก็บ path รูป
if($count==0)
{
echo "<tr> <td width=220><div id=product> <img align=center width=65 src=$Ppic?Product_Id=$PID> </div>"; // เอาารูปมาโชตรงนี้ แต่มันไม่ขึ้นอ่ะค่ะ
echo "<div id=product> <br> $Pname </div>";
echo "<div id=product> <br> $Pdesc </div>";
echo "<div id=product> <br> $Pprice </div>";
echo "<div id=product> <br> <input type=button value='add to cart' > </div>";
echo "</td>";
$count++;
}
else if($count==1)
{
echo "<td width=220> <div id=product> <img width=65 src=$Ppic?Product_Id=$PID> </div>";
echo "<div id=product> <br> $Pname </div>";
echo "<div id=product> <br> $Pdesc </div>";
echo "<div id=product> <br> $Pprice </div>";
echo "<div id=product> <br> <input type=button value='add to cart' > </div>";
echo "</td>";
$count++;
}
else if($count==2)
{
echo "<td width=220> <div> <img width=65 src=$Ppic?Product_Id=$PID> </div>";
echo "<div> <br> $Pname </div>";
echo "<div> <br> $Pdesc </div>";
echo "<div> <br> $Pprice </div>";
echo "<div> <br> <input type=button value='add to cart' > </div>";
echo "</td>";
echo "</tr>";
$count=0;
}
} echo "</table>";
?>
<p align="right"> <br />
<?php
$page_range=5;
$qry_str="";
//$total_pages = paging_total_pages($total_rows, $rows_per_page);
$pagenum = paging_pagenum($current_page, $total_pages, $page_range, $qry_str);
?>
<?
echo "page:" . $pagenum;
?>
</p>
</table>
</td>
</tr>
</table>
<div>
<? include('footer.php'); ?>
</div>
</body>
คือไม่รู้ว่าลืมหรือเขียนตรงไหนผิดไปหรือขาดไปรึเปล่าอ่าค่ะ
ใครหาเจอบอกหน่อยค่าาา
Tag : PHP, MySQL, HTML/CSS
|
|
|
|
|
|
Date :
2011-10-19 21:43:54 |
By :
gellarjung |
View :
893 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<img align=center width=65 src=$Ppic?Product_Id=$PID>
Path ใช้แบบนี้เหรอครับ
Code (PHP)
<img align=center width=65 src=$Ppic>
echo $Ppic; มันได้ค่าเป็นอะไรครับ
|
|
|
|
|
Date :
2011-10-20 06:20:10 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|