 |
ช่วยทีคับ Parse error: syntax error, unexpected T_STRING |
|
 |
|
|
 |
 |
|
พยายามหาแล้วแแต่ไม่เจอครับ แฮะ ๆ น่าจะ Syntax ผิดซะทีครับ
|
 |
 |
 |
 |
Date :
2015-03-02 07:47:04 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผิดตรงนี้ครับ
Code (PHP)
?>
<?xml version="1.0" encoding="windows-874" ?>
แก้เป็น
Code (PHP)
?>
<?='<'?>?xml version="1.0" encoding="windows-874" ?<?='>'?>
ปล. ตัวแปรโค๊ดมัน สับสน tag ปิด/เปิด xml กับ php <? ?>
|
ประวัติการแก้ไข 2015-03-02 08:06:15
 |
 |
 |
 |
Date :
2015-03-02 08:02:36 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณพี่ Chaidhanan มากครับ ผมก็หายุเหมือนกัน น่าจะผ่านละ ตอนนี้
|
 |
 |
 |
 |
Date :
2015-03-02 20:16:56 |
By :
kom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เพื่ออนาคตที่สดใส คุณควรปิด php short tag open ด้วยครับ แล้วใช้แต่ <?php ... ?> หรือ <?=... ?>
|
 |
 |
 |
 |
Date :
2015-03-03 01:47:27 |
By :
mr.v |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2015-03-03 06:54:58 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พอแก้แล้วดัน Error ที่นี่อ่ะงับ
Warning: sqlsrv_close() expects parameter 1 to be resource, boolean given in C:\AppServ\www\wpy\InGame\NoticeRSS_functions.php on line 21
Code (PHP)
<?php
// Checks whether the sqlsrv driver is installed and dies if not.
function checkSqlsrvDriverInstalledOrDie() {
if(!function_exists('sqlsrv_connect'))
die('This software requires <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=80E44913-24B4-4113-8807-CAAE6CF2CA05">Microsoft\'s SQL Server Driver for PHP</a>.<br />
The old mssql and odbc drivers are not fully compatible with SQL Server 2008.');
}
// Opens a new database connection and returns the handle
function getDbConnection($toDatabase) {
global $__sql_srv, $__sql_user, $__sql_pass;
$connectionInfo = array('UID' => $__sql_user, 'PWD' => $__sql_pass, 'Database' => $toDatabase);
$conn = sqlsrv_connect($__sql_srv, $connectionInfo);
return $conn;
}
// Closes a database connection
function closeDbConnection($conn) {
sqlsrv_close($conn);
}
// Generates a "ver" value for the output notice to determine
// whether it needs to be updated or not.
function getLatestVerForGuild($guild, $conn) {
if($conn) {
$sQuery = "SELECT TOP 1 [EditDate] FROM Pangya_Guild_Notice WHERE [Guild_Id] = (?) AND [Valid] = (?) AND [Published] = (?) ORDER BY [EditDate] DESC";
$sParams = array(&$guild, 1, 1);
$stmt = sqlsrv_prepare($conn, $sQuery, $sParams);
$retVal = sqlsrv_execute($stmt);
if(sqlsrv_has_rows($stmt) && $retVal == 1) {
sqlsrv_fetch($stmt);
$latestDt = sqlsrv_get_field($stmt, 0);
sqlsrv_free_stmt($stmt);
return $latestDt->getTimestamp();
} else {
die();
}
}
die('No connection to database.');
}
function getNoticesForGuild($guild, $conn) {
if($conn) {
$sQuery = "SELECT TOP 10 * FROM Pangya_Guild_Notice WHERE [Guild_Id] = (?) AND [Valid] = (?) AND [Published] = (?) ORDER BY [EditDate] DESC";
$sParams = array(&$guild, 1, 1);
$stmt = sqlsrv_prepare($conn, $sQuery, $sParams);
$retVal = sqlsrv_execute($stmt);
if(sqlsrv_has_rows($stmt)) {
$results = array();
while($notice = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) {
$results[] = $notice;
}
sqlsrv_free_stmt($stmt);
return $results;
} else {
die();
}
}
}
?>
|
 |
 |
 |
 |
Date :
2015-03-06 21:00:26 |
By :
thanakhornza |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เริ่มจากบันทัด 16 จาก topic แรก ควรเช็คก่อนว่า connect ได้หรือไม่
16.$web_conn = getDbConnection($__sql_db_web);
โดย ใน function getDbConnection( ) จาก คห 6 ควรตรวจสอบ การ connect ด้วย
Code (PHP)
function getDbConnection($toDatabase) {
global $__sql_srv, $__sql_user, $__sql_pass;
$connectionInfo = array('UID' => $__sql_user, 'PWD' => $__sql_pass, 'Database' => $toDatabase);
$conn = sqlsrv_connect($__sql_srv, $connectionInfo);
if( $conn ) {
return $conn;
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
}
และ เปลี่ยน การเขียน function เป็น class จะง่ายกว่า
แต่ โดยรวมแล้ว ไม่จำเป็น ต้องเขียน funtion หรือ class ขึ้นมาให้เพื่อควบคุม sqlsrv เลยครับ
function และ class ของ PHP เกี่ยวกับ SqlSrv มันก็สมบูรณ์อยู่แล้ว
ต้องไปอ้อม โลกทำไมครับ
ปล. จะตั้ง Server game เถื่อนหรือไงครับ 55555
|
 |
 |
 |
 |
Date :
2015-03-06 21:56:04 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เป็นสคริปของเว็บเกมส์แหละครับ พอดีผมได้มาฟรี เลยจะลองเอามาโมตกแต่งเพิ่มเติมดูครับ แต่ส่วนตัวผมไม่มีความรู้เรื่อง php งูๆปลา ๆ เลยออกมาเป็นอย่างที่เห็นนี่แหละคับ
ขอบคุณมากนะครับ ถ้าไม่ได้พี่ Chaidhanan ผมคงแก้ปัญหาไม่ได้
|
 |
 |
 |
 |
Date :
2015-03-06 22:02:39 |
By :
thanakhornza |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|