I am having problems with autocomplete. All the suggestions are coming out as one line. Eg ANOTHERTESTTEST instead of ANOTHER TEST the Test underneath.
This is in company.php to get the selection
- if (trim($Msg) == "") {
- $term = StrippedChars($_GET['term']);
- $sqlstring = "SELECT * FROM companies where name like '%" . $term . "%'";
- if (!($result = @ mysqli_query($connection, $sqlstring))) {
- $Msg = "An error has occured when selecting the records from the Database";
- }
- if (empty($Msg)) {
- if ($result->num_rows > 0){
- while ($row = mysqli_fetch_array($result)) {
- $name = StrippedChars(Substr(trim($row['name']),0,255));
- $results['data'] .= $name;
- }
- }
- }
- }
- if (trim($Msg) == "") {
- echo json_encode($results);
- }
- else {
- $results['data'] = $Msg;
- echo json_encode($results);
- }
This is my autocomplete
- $("#company_name").autocomplete({
- source: "company.php",
- MinLength: 1,
- });
Thanks