Welcome Guest, Not a member yet? Register   Sign In
codeigniter issue using UNION SQL operator in developing an jquery-ui autocomplete function
#2

[eluser]danmontgomery[/eluser]
First, you can't assign a value to a function. This will never work:

Code:
$term=$this->input->post('term')='Ma';

Other than that, the forum's syntax highlighting in your code should immediately point out what the problem is. You need to escape your single quotes or use double quotes.

Code:
'SELECT subject FROM items WHERE subject LIKE \'Ma%\' UNION ALL SELECT first_name FROM accounts WHERE first_name LIKE \'Ma%\' UNION ALL SELECT description FROM items WHERE description LIKE \'Ma%\''
//or
"SELECT subject FROM items WHERE subject LIKE 'Ma%' UNION ALL SELECT first_name FROM accounts WHERE first_name LIKE 'Ma%' UNION ALL SELECT description FROM items WHERE description LIKE 'Ma%'"


Messages In This Thread
codeigniter issue using UNION SQL operator in developing an jquery-ui autocomplete function - by El Forum - 04-20-2011, 05:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB