<?php
$conexion=mysql_connect("xxx","xxx","xxx");
mysql_select_db("xxx",$conexion);
mysql_query("SET NAMES 'utf8'",$conexion);
//$name = $_POST['value'];
$name="paco";
$datos="SELECT Apellido, Direccion FROM datos where Nombre='".$name."'";
$B_BUSCAR= mysql_query ($datos,$conexion);
$rawdata = array();
$i=0;
while($row = mysql_fetch_array($B_BUSCAR)){
$rawdata[$i] = $row;
$i++;
}
echo json_encode($rawdata));
?>
<?php
$conexion=mysql_connect("xxx","xxx","xxx");
mysql_select_db("xxx",$conexion);
mysql_query("SET NAMES 'utf8'",$conexion);
function search(){
//$name = $_POST['value'];
$name="paco";
$datos="SELECT Apellido, Direccion FROM datos where Nombre='".$name."'";
$B_BUSCAR= mysql_query ($datos,$conexion);
$rawdata = array();
$i=0;
while($row = mysql_fetch_array($B_BUSCAR)){
$rawdata[$i] = $row;
$i++;
}
echo json_encode($rawdata));
}//cierra funcion search
search();
?>