โดย rag2club » 12/08/2007 2:08 am
พอดีผมเขียน สคริปไม่ค่อยเป็นอะครับพอแก้เป็นนิดหน่อย
สมมุด odbc ใช้สรคิป แบบนี้
วิธีเขียน php + mssql จาเขียนยังไงครับช่วยแปลไห้นิสนึง *-*
<center><?
$dbname = rxjhgame;
$dbuser = Foguzz; // user ของ sql
$dbpass = 1234; // Password ของ sql
$count= 1;
$connect=odbc_connect("$dbname","$dbuser","$dbpass");
$result=odbc_exec($connect,"SELECT TOP 10 FLD_LEVEL, FLD_NAME, FLD_MONEY FROM TBL_Char ORDER BY FLD_LEVEL DESC");
echo "<table border='1' style='border ashed thin'>";
echo "<tr> <th></th>
<th> Level</th>
<th> Name</th>
<th> Money</th>
</tr>";
// keeps getting the next row until there are no more to get
if ($count<11){
while($row = odbc_fetch_row( $result )) {
$lvl = odbc_result($result, 1);
$user = odbc_result($result, 2);
$money = odbc_result($result, 3);
echo "<tr><td >";
echo $count++;
echo "</td><td >";
echo $lvl;
echo "</td><td >";
echo $user;
echo "</td><td>";
echo $money;
}
}
echo "</table>";
?></center>
พอดีผมเขียน สคริปไม่ค่อยเป็นอะครับพอแก้เป็นนิดหน่อย
สมมุด odbc ใช้สรคิป แบบนี้
วิธีเขียน php + mssql จาเขียนยังไงครับช่วยแปลไห้นิสนึง *-*
[quote]<center><?
$dbname = rxjhgame;
$dbuser = Foguzz; // user ของ sql
$dbpass = 1234; // Password ของ sql
$count= 1;
$connect=odbc_connect("$dbname","$dbuser","$dbpass");
$result=odbc_exec($connect,"SELECT TOP 10 FLD_LEVEL, FLD_NAME, FLD_MONEY FROM TBL_Char ORDER BY FLD_LEVEL DESC");
echo "<table border='1' style='border ashed thin'>";
echo "<tr> <th></th>
<th> Level</th>
<th> Name</th>
<th> Money</th>
</tr>";
// keeps getting the next row until there are no more to get
if ($count<11){
while($row = odbc_fetch_row( $result )) {
$lvl = odbc_result($result, 1);
$user = odbc_result($result, 2);
$money = odbc_result($result, 3);
echo "<tr><td >";
echo $count++;
echo "</td><td >";
echo $lvl;
echo "</td><td >";
echo $user;
echo "</td><td>";
echo $money;
}
}
echo "</table>";
?></center>[/quote]