 |
|
|
 |
 |
|
เอา code มาดูครับ
|
 |
 |
 |
 |
Date :
2011-07-09 11:56:47 |
By :
grandraftz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?
$objConnect = mssql_connect("localhost","sa","") or die("Error Connect to Database");
$objDB = mssql_select_db("csmiledbdem");
$strSQL = "SELECT * FROM cschequein ORDER BY CHEQUENO ASC";
$objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mssql_num_rows($objQuery);
$Per_Page = 50; // 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;
}
$Page_End = $Per_Page * $Page;
IF ($Page_End > $Num_Rows)
{
$Page_End = $Num_Rows;
}
?>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">CustomerID </div></th>
</tr>
<?
for($i=$Page_Start;$i<$Page_End;$i++)
{
?>
<tr>
<td><div align="center"><?=mssql_result($objQuery,$i,"CHEQUENO");?></div></td>
</tr>
<?
}
?>
</table>
<br>
Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page :
<?
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</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'>Next>></a> ";
}
mssql_close($objConnect);
?>
|
 |
 |
 |
 |
Date :
2011-07-09 13:23:33 |
By :
zuzagirll |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$objConnect = mssql_connect("localhost","sa","") or die("Error Connect to Database");
เปลี่ยนเป็น
$objConnect = mssql_connect("ชื่อเครื่อง(ผมเดาว่าคุณไม่ได้ใช้ Express และเดาว่าคงไม่ได้เปลี่ยน instant name)","sa","(password ไม่มีจริงหรอ)") or die("Error Connect to Database");
|
 |
 |
 |
 |
Date :
2011-07-09 13:39:55 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?
$objConnect = mssql_connect("192.168.88.4","sa","114487") or die("Error Connect to Database");
$objDB = mssql_select_db("csmiledbdem");
$strSQL = "SELECT * FROM cschequein ORDER BY CHEQUENO ASC";
$objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
ใส่เปน ip server ก้อไม่ได้ค่ะ
|
 |
 |
 |
 |
Date :
2011-07-09 13:47:38 |
By :
zuzagirll |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แล้วค่ะ ขอบคุนนะค่ะ
|
 |
 |
 |
 |
Date :
2011-07-09 13:54:13 |
By :
zuzagirll |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้ยังไง ช่วยบอกด้วยครับ คนอื่นเจอปัญหาเดียวกันจะได้แก้ตาม เพราะมันมีหลายสาเหตุ
|
 |
 |
 |
 |
Date :
2011-07-09 13:57:50 |
By :
PlaKriM |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
หายไปล่ะ 
|
 |
 |
 |
 |
Date :
2011-07-09 22:43:10 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|