我需要您的帮助来编辑我的脚本以使其输出结果 WHERE title = function(search) 如果我输入:test,它将打印出以 test 作为标题的结果。
搜索.js:
$('form').submit(function() {
var form_data = ($(this).serialize());
window.location.hash = form_data.replace('=','/');
return false;
});
(function() {
window.App = {
Models: {},
Collections: {},
Views: {},
Router: {}
};
App.Router = Backbone.Router.extend({
routes: {
'': 'index',
'search/:search': 'search',
'*other': 'default'
},
index: function() {
$(document.body).append("");
},
search: function(search) {
$('#result').load('search.php');
}
});
new App.Router();
Backbone.history.start();
})();
搜索.php
$query = "SELECT title FROM media WHERE title=";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
echo $row['title'];