I am working with autocomplete in concat 3 rows I need one result from 3 rows and for that I use CONCAT...when I insert any word not show me nothing in results..
in fiddle works very well: autocomplete with CONCAT in fiddle here is the auto.php:
<?
include_once('../include/config.php');
if (isset($_GET['term'])){
$return_arr = array();
try{
$stmt = $conn->prepare("
SELECT * FROM MEDICAMENTOS WHERE CONCAT(presentacion, ' ', laboratorio,' ',p_activo) LIKE :term");
while($row = $stmt->fetch()){
$return_arr[] = $row['medicamento1'];
}
echo json_encode($return_arr);
}
catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
}
?>
I need to know also how can I have an autocomplete with 9 inputs more.. here is my script in index.php:
<label><b>Medicamento :</b></label><input type="text" class="input-block-level" value="" name="medicamento1" id="med"/>
<table>
<tr class="hide"><td><input type="text" class="input-block-level" value="" name="medicamento2" id="med"/></td></tr>
<tr class="hide"><td><input type="text" class="input-block-level" value="" name="medicamento3" id="med"/></td></tr>
<tr class="hide"><td><input type="text" class="input-block-level" value="" name="medicamento4" id="med"/></td></tr>
<tr class="hide"><td><input type="text" class="input-block-level" value="" name="medicamento5" id="med"/></td></tr>
<tr class="hide"><td><input type="text" class="input-block-level" value="" name="medicamento6" id="med"/></td></tr>
<tr class="hide"><td><input type="text" class="input-block-level" value="" name="medicamento7" id="med"/></td></tr>
<tr class="hide"><td><input type="text" class="input-block-level" value="" name="medicamento8" id="med"/></td></tr>
<tr class="hide"><td><input type="text" class="input-block-level" value="" name="medicamento9" id="med"/></td></tr>
<tr class="hide"><td><input type="text" class="input-block-level" value="" name="medicamento10" id="med"/></td></tr>
</table>