I'm using CONCAT
to combine multiple columns,
SELECT CONCAT(col1, ' - ', col2) AS result
FROM table
WHERE col1 LIKE '%apple%' OR
col2 LIKE '%apple%'
ORDER BY col1 ASC
And then return it as json data.
while ($row = mysql_fetch_array($query)) {
$data[] = $row['result'];
}
echo json_encode($data);
Question: How can I separate the data into its individual field when I read it in jQuery? Is it better (more efficient) to send it separately?
<script>
$(function() {
$( "#AllWord" ).autocomplete({
source: 'search_apple.php'
});
});
</script>