|
|
|
syntax error, unexpected mysqli_set_charset (T_STRING) in ...... line 14 ครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
header("content-type:text/javascript;charset=utf-8");
define('HOST', 'localhost');
define('USER', 'root');
define('PASS', 'password');
define('DB', 'example');
if($_SERVER['REQUEST_METHOD'] == 'GET'){
$status = $_GET['status'];
$con = mysqli_connect(HOST, USER, PASS, DB) or die('Unable to Connect')
mysqli_set_charset($con, "utf8");
$sql = "SELECT * FROM content WHERE status='" . $status . "'";
$r = mysqli_query($con,$sql);
$result = array();
while($row = mysqli_fetch_array($r)){
array_push($result, array("comment" => $row['comment']));
}
echo json_encode(array('result' => $result));
mysqli_close($con);
}
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2018-07-20 02:31:02 |
By :
psowatt |
View :
836 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$con = mysqli_connect(HOST, USER, PASS, DB) or die('Unable to Connect');
|
|
|
|
|
Date :
2018-07-20 07:02:32 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบพระคุณมากๆเลยครับ ผมมือใหม่น่ะครับ เส้นผมบังภูเขาอีกแล้ว
|
|
|
|
|
Date :
2018-07-20 11:21:11 |
By :
psowatt |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|