我正在使用现有数据库,该数据库在数据库中分隔了名字和姓氏.我需要创建一个函数,它将获取一个搜索输入并返回结果.说我的数据库有像....
nameFirst nameLast
Joe Smith
Joe Jones
Joe Brown
Run Code Online (Sandbox Code Playgroud)
我怎么能使用MySql获取一个搜索输入,就是说'Joe Smith'然后得到他的行?但是,如果我只在搜索字段中放入'Joe',那么将它们全部归还?我是否需要用空格来爆炸?谢谢!
我过去一直在努力解决的问题就是阻止API/AJAX继续,直到你收到你的回复为止.目前我正在使用Facebook API.我需要从调用中获得响应然后返回它,但发生的事情是我的函数在我从API调用得到响应之前返回.我知道为什么会发生这种情况,我无法弄清楚如何防止它!这是我的代码......
function makeCall(){
var finalresponse = "";
var body = 'Test post';
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
finalresponse = response.error;
} else {
finalresponse = 'Post ID: ' + response.id;
}
});
return finalresponse;
}
Run Code Online (Sandbox Code Playgroud)
// -----编辑
我注意到有人建议这样的事......
function makeCall(){
var finalresponse = "";
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
finalresponse = response.error;
return finalresponse;
} else {
finalresponse = 'Post ID: ' + …Run Code Online (Sandbox Code Playgroud) 我正在构建一个基本上显示3个表单的小应用程序......第一个是可选的,第二个不是,第三个不是.我希望每个表单都是一个单独的URL(控制器).在阅读CodeIgniter form_validation的文档时,表单似乎只能提交给自己进行验证.如果是这样的话,表格会一直显示在同一页面上......他基本上就是我所拥有的...并评论了我想做的事情......
class Index extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
//load front page that contains first form...
$content['title'] = 'Home';
$content['view'] = 'pages/index';
$this->load->view('template/default',$content);
}
function step_two()
{
//recieve information from front page. validate form. If validation is
//successful continue to step_two(url) if it fails redirect
//to front page with error...
$this->form_validation->set_rules('serial', 'Serial Number', 'required');
if ($this->form_validation->run() == FALSE)
{
//return to front page...
}else{
//do necessary work and load step_two view
}
}
} …Run Code Online (Sandbox Code Playgroud) 所以这是一个我以前从未见过的奇怪的奇怪之一.当我用一个没有逃脱的惊叹号时,我得到了一个非常奇怪的信息......
git commit -am "New stuff!"
Run Code Online (Sandbox Code Playgroud)
结果是......
git commit -am "New stuff"why dont you go back to Philadelphia?"
>
Run Code Online (Sandbox Code Playgroud)
我有一个自定义的bash配置文件,但我无法弄清楚为什么它给了我这个该死的消息以及我如何找到它并更改/删除它.
php ×2
ajax ×1
api ×1
asynchronous ×1
codeigniter ×1
git ×1
javascript ×1
jquery ×1
macos ×1
mysql ×1
terminal ×1
validation ×1