Foros del Web » Programando para Internet » PHP »

Juntar nombre y apellidos en un solo registro.

Estas en el tema de Juntar nombre y apellidos en un solo registro. en el foro de PHP en Foros del Web. Por favor, me puede decir alguien como puedo juntar en los codigos el nombre y el apellido? Código: $datos = array(); while($row = mysql_fetch_array($query)) { ...
  #1 (permalink)  
Antiguo 12/09/2012, 09:44
Avatar de satjaen  
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 7 meses
Puntos: 10
Juntar nombre y apellidos en un solo registro.

Por favor, me puede decir alguien como puedo juntar en los codigos el nombre y el apellido?



Código:
$datos = array();
	
	while($row = mysql_fetch_array($query))
	{
		$datos[] = array(
			'nu_usuario'          => $row['nu_usuario'],
			'telefono'          => $row['telefono'],
			'nombre'      => $row['nombre'],
			'apellidos'       => $row['apellidos'],
			'poblacion'        => $row['poblacion']
		);
	}
	// convertimos el array de datos a formato json
	echo json_encode($datos);
}


Código:
function filtrar()
{	
	$.ajax({
		data: $("#frm_filtro").serialize()+ordenar,
		type: "POST",
		dataType: "json",
		url: "ajax.php?action=listar",
			success: function(data){
				var html ='' ;
				if(data.length > 0){
					$.each(data, function(i,item){
						html += '<tr>'
						    html += '<td>'+item.nu_usuario+'</td>'
							html += '<td>'+item.telefono+'</td>'
							html += '<td>'+item.nombre+'</td>'
							html += '<td>'+item.apellidos+'</td>'
							html += '<td>'+item.poblacion+'</td>'
						html += '</tr>';
															
					});					
				}
				if(html == '') html = '<tr><td colspan="4" align="center">No se encontraron registros..</td></tr>'
				$("#data tbody").html(html);
			}
	  });
  #2 (permalink)  
Antiguo 12/09/2012, 10:08
Colaborador
 
Fecha de Ingreso: mayo-2008
Ubicación: $MX['VZ']['Xalapa']
Mensajes: 3.005
Antigüedad: 15 años, 11 meses
Puntos: 528
Respuesta: Juntar nombre y apellidos en un solo registro.

Supongo que así.

html += '<td>'+item.telefono+'</td>'
html += '<td>'+item.nombre+' '+item.apellidos+'</td>'

Etiquetas: html, juntar, mysql, nombre, registro, usuarios
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:01.