Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用PDO自动完成mysql concat_Php_Mysql_Pdo_Jquery Autocomplete - Fatal编程技术网

Php 使用PDO自动完成mysql concat

Php 使用PDO自动完成mysql concat,php,mysql,pdo,jquery-autocomplete,Php,Mysql,Pdo,Jquery Autocomplete,我正在使用concat 3行中的autocomplete 我需要从3行中得到一个结果,为此我使用CONCAT…当我插入任何单词时,结果中不显示任何内容 在小提琴作品非常好: 下面是auto.php: <? include_once('../include/config.php'); if (isset($_GET['term'])){ $return_arr = array(); try{ $stmt = $conn->prepare(" SELECT * FROM MED

我正在使用concat 3行中的autocomplete 我需要从3行中得到一个结果,为此我使用CONCAT…当我插入任何单词时,结果中不显示任何内容

在小提琴作品非常好: 下面是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();
    }
}
?>
我还需要知道我如何能有一个自动完成9个输入更多。。以下是我在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>

我已经做了…我改成mysqli。我发现了一个非常有用且简短的教程来做这件事……对于将来需要它的人,这是一个页面:


致以最诚挚的问候。

在学习mysql和jquery之前,为什么不先学习基本的PHP呢?一步一步地学习会更少痛苦,更有成效。