|
|
|
สอบถามเรื่อง php ลิ้งหน้าต่อไปแสดงเป็น หน้า1, 2, 3 ,4... |
|
|
|
|
|
|
|
ติด error เพราะอะไรค่ะ
|
|
|
|
|
Date :
2014-03-09 13:00:50 |
By :
joon |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
error ว่าอะไรล่ะครับ
|
|
|
|
|
Date :
2014-03-09 13:04:18 |
By :
itpcc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parse error: syntax error, unexpected $end in C:\AppServ\www\project\search.php ค่ะไม่รู้เพราะอะไร
|
|
|
|
|
Date :
2014-03-09 13:11:40 |
By :
joon |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<form name="frmSearch" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
<table width="400" border="1">
<tr>
<th>Keyword
<input name="txtKeyword" type="text" id="txtKeyword" value="<?=$_GET["txtKeyword"];?>">
<input type="submit" value="Search"></th>
</tr>
</table>
</form>
<?
if($_GET["txtKeyword"]!= " mm_name")
{
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("rmuttsocial");
mysql_query("SET NAMES utf8", $objConnect);
// Search By Name or Email
$strSQL = "SELECT * FROM tbl_member WHERE (mm_name LIKE '%".$_GET["txtKeyword"]."%' or type LIKE '%".$_GET["txtKeyword" ]."%')";
$objQuery = mysql_query($strSQL) or die ("Error 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 inid ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
?>
<table width="400" border="1">
<tr>
<th width="91"> <div align="center">ID</div></th>
<th width="98"> <div align="center">Name</div></th>
<th width="198"> <div align="center">Date</div></th>
<th width="97"> <div align="center">type</div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?=$objResult["mm_id"];?></div></td>
<td><div align="center"><?=$objResult["mm_name"];?></div></td>
<td><div align="center"><?=$objResult["bday"];?></div></td>
<td><div align="center"><?=$objResult["type"];?></div></td>
</tr>
<?
}
?>
</table>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page&txtKeyword=$_POST[txtKeyword]'><< Back</a> ";
}
for($i=1; $i<=$Num_Pages; $i++){
if($i != $Page)
{
echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i&txtKeyword=$_POST[txtKeyword]'>$i</a> ]";
}
else
{
echo "<b> $i </b>";
}
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page&txtKeyword=$_POST[txtKeyword]'>Next>></a> ";
}
}
?>
|
|
|
|
|
Date :
2014-03-09 13:38:01 |
By :
่joon |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ช่วยดูให้หน่อยค่ะ ว่าติดเพราะอะไร
|
|
|
|
|
Date :
2014-03-09 13:39:27 |
By :
joon |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$_POST[txtKeyword]
|
|
|
|
|
Date :
2014-03-09 18:44:56 |
By :
ผู้มาเยือน |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|