JSON data returned to the client
echo $request. ' ('. Json_encode ($demoData). ') ';
Close the database
Exit
?>
2 page HTML
<title><br/></title>
View the next 10 articles
3book.js
/**
* Example of client-server data interaction
*
*
*/
/**
* Server Address
*/
var bookhost = "http://localhost:1000/server.php?jsoncallback=?";
/**
* JS End base64 instantiation
*/
var b64 = new Base64 ();
/**
* Network Request transfer function
*
* @param {Object} URL server request address
* @param {Object} callback callback function
*/
function XmlHttp (url,callback) {
if (url = = ") {
Uexwindow.alert (' parameter error ', ' request address cannot be empty! ', ' return ');
}else{
$.getjson (Url,callback);
}
}
/**
* Get a list of posts
*/
function Getbooklist () {
Uexwindow.toast ("1", "5", "Data Loading ...", "0");
var url = bookhost;
XmlHttp (url,showlist);
}
/**
* Callback function to process the post data returned by the server side, displayed on the client
* JSON data returned by @param {Object} items server Side
*/
function Showlist (items) {
var forumobj = $ ("#book_list");
Forumobj.html (");
for (var i in items) {
var item = Items[i];
var tr = ';
var trheader = ';
var trtitle = ' +b64.decode (item.subject) + ';
var trotherinfo = ' ' +b64.decode (item.dateline) + ' +b64.decode (item.author) + '';
var trfooter = ';
tr = Trheader+trtitle+trotherinfo+trfooter;
Forumobj.append (TR);
}
Uexwindow.closetoast ();
}
Prompt error
Parse error:syntax error, unexpected '] ', expecting t_string or t_variable or t_num_string in D:\WWW\server.php on line 1 7
Solving!!!
The result I want to show is
------to solve the idea----------------------
First place:
$sql = "Select Id,bookname,pubdate,author from Td_book where tid=". $Id. ";
The last is a double quotation mark, which is obviously not grammatical, because except in quotation marks, the quotation marks must appear in pairs.
Now that you've turned his partner away, he's going to make you cry.
Second place:
' Tid ' = '$row [' Id '] ',
Single and double quotes in single quotes must be escaped, or PHP will not know what to enclose in quotation marks
The variables in single quotes are not valued, and obviously you don't meet the business requirements.
------to solve the idea----------------------
$query = mysql_query ($sql) or Die (Mysql_error ());
You see what's wrong.
------to solve the idea----------------------
No database selected No databases selected
You don't see the use of the mysq_select_db function in your config.php.
------to solve the idea----------------------
You did not choose the database, less mysql_select_db ("Tyshichang"); This sentence.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.