|
|
|
ช่วยดูโค้ดหน่อยค่ะ พอดีว่าทำบน localhost ก็รันได้ปกติ แต่ว่าขึ้นโฮสต์จริง มันรันไม่ได้ |
|
|
|
|
|
|
|
คือว่าจะเป็นโค้ด แสดงข้อมูลสินค้าน่ะค่ะ ตอนที่เรียกออกมาแสดงได้ก็ปกติดี แต่ว่าตอนที่จะแสดงรายละเอียดโดยลิงก์จากรูปภาพนี่ พอคลิกไปมันก็ไปหน้าที่ต้องการให้ แต่ว่าข้อมูลไม่ออกค่ะ
โค้ดแสดงข้อมูลสินค้า ก่อนรายละเอียด
โดยการจะคลิกดูรายละเอียดต้องคลิกผ่านรูปภาพ
Code (PHP)
<html>
<head>
<title>:: .. ::</title>
<style type="text/css">
<!--
.style12 {font-size: 10}
.style33 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style34 {color: #0000CC; font-family: Verdana, Arial, Helvetica, sans-serif;}
.style35 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
.style49 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
color: #0000CC;
}
.style55 {font-size: 12px}
.style56 {color: #FF0000; font-size: 12px; }
.style57 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #0000CC; }
-->
</style>
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874"></head>
<body>
<p align="center"><img src="images/hotssale.gif" width="338" height="75"></p>
<div align="left">
<?
$strSQL = "SELECT * FROM product where ps_id=1";
$objQuery = mysql_query($strSQL);
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page = 2; // Per Page
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" order by pro_id ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
echo"<table border=\"0\" cellspacing=\"1\" cellpadding=\"1\"><tr>";
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
echo "<td>";
$intRows++;
?>
<table width="217" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="217"><table width="217" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="88"><a href="showdetail2.php?pro_id= <?=$objResult["pro_id"];?>"><img src="images/<?=$objResult["pro_image"];?>" width=88 height="88" border="0"</a></td>
<td width="147" valign="top"><span class="style12"></span>
<table width="175" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="96"><div align="right" class="style49 style55">»ÃÐàÀ·ÊÔ¹¤éÒ : </div></td>
<td width="79"><div align="left" class="style56"><span class="style33">
<?=$objResult["pro_id"];?>
</span></div></td>
</tr>
<tr>
<td><div align="right" class="style57">ª×èÍÊÔ¹¤éÒ : </div></td>
<td><div align="left" class="style56"><span class="style33">
<?=substr($objResult['pro_title'], 0,10)?>...
</span></div></td>
</tr>
<tr>
<td><div align="right" class="style57"></div></td>
<td><span class="style55"><U><span class="style34"><a href="#" onClick="MM_openBrWindow('showdetail2.php?pro_id=<?=$objResult["pro_id"];?>','ข่าวสาร','width=500,height=600')"><U>´ÙÃÒÂÅÐàÍÕ´</a></span></span></td>
</tr>
<tr>
<td colspan="2"><div align="right" class="style55"></div></td>
</tr>
</table>
<p> </p></td>
</tr>
</table></td>
</tr>
</table><center>
<div align="center"><br>
<span class="style35">
<?
echo"</td>";
if(($intRows)%2==0)
{
echo"</tr>";
}
}
echo"</tr></table>";
?>
<br>
<span class="style12"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> แสดงข้อมูล
<?= $intRows;?>
/
<?= $Num_Rows;?>
รายการ แสดงทั้งหมด :
<?=$Page;?>
/
<?=$Num_Pages;?>
˹éÒ :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'>????????</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>????</a> ";
}
?>
</span></span>
</div></center>
</body>
</html>
โค้ดหน้ารายละเอียดที่ไม่มีอะไรจากฐานข้อมูลแสดงออกมา
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=windows-874" />
<title><?php echo $site_name; ?></title>
<style type="text/css">
<!--
.style12 {font-size: 10}
.style19 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #0000CC; }
.style21 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
.style22 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bold;
color: #FFFFFF;
}
-->
</style>
</head>
<body>
<?
include("connect.php");
$sql="select * from product where pro_id like '$pro_id'";
$objResult=mysql_query($sql);
if($objResult){
$objResult=mysql_fetch_array($objResult);
}
?>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="265" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="265" valign="top"><div align="center"><span class="style12"></span> <img src="images/<?=$objResult["pro_image"];?>" width="250" height="300"/> <br />
<br />
</div>
<table width="408" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="21" colspan="2" bgcolor="#9999FF"><div align="center" class="style22">ÃÒÂÅÐàÍÕ´ÊÔ¹¤éÒ</div></td>
</tr>
<tr>
<td width="120"><div align="right"><span class="style19">ÃËÑÊÊÔ¹¤éÒ :</span></div></td>
<td width="288"><span class="style21">
<?=$objResult["pro_id"];?>
</span></td>
</tr>
<tr>
<td width="120"><div align="right"><span class="style19">ª×èÍÊÔ¹¤éÒ :</span></div></td>
<td width="288"><span class="style21">
<?=$objResult["pro_title"];?>
</span></td>
</tr>
<tr>
<td height="47" valign="top"><div align="right"><span class="style19">ÃÒÂÅÐàÍÕ´ :</span></div></td>
<td valign="top"><table width="288" height="87" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="500" valign="top"><table border="0" cellspacing="0" cellpadding="0" width="282" height="84">
<tr>
<td width="282" valign="top"><span class="style21">
<?=$objResult["pro_detail"];?>
</span></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<p>
<div align='center'><a href='javascript:window.close();'>[»Ô´Ë¹éÒ¹Õé]</a></div>
</p></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2012-08-14 19:36:41 |
By :
myminthom |
View :
793 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|