Ayuda en php soy nuevo y quiero saber como hacer un autocompletar con php y mysql

15 views
Skip to first unread message

Davis Diaz

unread,
Aug 26, 2015, 4:21:39 PM8/26/15
to Grupo de programadores PHP de Barcelona
Ayuda en php soy nuevo y quiero saber como hacer un auto completar con php y mysql al momento tengo algo asi que no me funciona.


if(!isset($_REQUEST['term']))
exit();
require('cnx.php');
$term = 
$rs = mysql_query('
SELECT id, name FROM Sheet1
WHERE name
LIKE "'.ucfirst($_REQUEST['term']).'%" 
ORDER BY id ASC 
LIMIT 0,10', $dblink
);
$data = array();
while($row = mysql_fetch_array($rs, MYSQL_ASSOC)){
$data[] = array(
'label' => $row['id'],
'value' => $row['name'],
);
}


function buscarUsuario()
{
    
    global $data;
    echo json_encode($data);
    
}




if(!empty($_POST['evento']))
{
    if($_POST['evento']=="buscarUsuario")
    { 
               buscarUsuario();
    }
    
}
Reply all
Reply to author
Forward
0 new messages