Ver Mensaje Individual
  #5 (permalink)  
Antiguo 22/02/2012, 16:15
desoler
 
Fecha de Ingreso: agosto-2008
Ubicación: Miami, FL
Mensajes: 210
Antigüedad: 16 años, 2 meses
Puntos: 2
Respuesta: mostrar variable si tiene contenido

hola Chayly_vc, en realidad este es un archivo llamado mostrarresultados.php que va incluido dentro de un html. El código completo es el siguientes:

<?php

session_start();

//1. Crear conexión a la Base de Datos
$conexion = mysql_connect("localhost","","");
if (!$conexion) {
die("Fallo la conexión a la Base de Datos: " . mysql_error());
}
//2. Seleccionar la Base de Datos a utilizar
$seleccionar_bd = mysql_select_db("", $conexion);
if (!$seleccionar_bd) {
die("Fallo la selección de la Base de Datos: " . mysql_error());
}

// Con esto tenemos el total de autos en nuestra tabla 'autos'
$contador_datos_sql = 'select count(*) from datos' ;
$contador_datos_result = mysql_query($contador_datos_sql) ;
$total_datos = mysql_result($contador_datos_result, 0, 0) ;

// configuración de la clase
include('class.kpaginate.php') ; // incluimos la clase
$kp1 = new kpaginate ; // instanciamos la clase
$kp1->setTotalItems($total_datos) ; // OJO!, aquí ponemos el total de autos que conseguimos anteriormente
$kp1->setItemsPerPage(10) ; // 5 = cuantos autos queremos mostrar por página
$limit = $kp1->getLimit() ; // IMPORTANTE: Este metodo retorna un array con 2 valores, el primero es el límite inferior y el segundo el límite superior que debemos colocar en nuestra consulta, veamos...

$datos_sql = mysql_query("SELECT * FROM datos ORDER BY personalID DESC limit " . $limit[0] . ', ' . $limit[1]);

echo "
<table class='css3' id='mytable' cellspacing='0'>
<tr class='nobg'>
<th scope='col'><strong>Personal ID</strong</th>
<th scope='col'><strong>Date</strong></th>
<th scope='col'><strong>Client Information</strong></th>
<th scope='col'><strong>Vehicle Information</strong></th>
<th scope='col'><strong>Comment</th>
<th scope='col'><strong>Pickup/Dropoff</strong></th>
<th scope='col'><strong>Shipping On</strong></th>
<th scope='col'><strong>Pre/Quote</strong></th>
<th class='title' scope='col'>Pre/Quote</th>
<th class='title' scope='col'>Quote</th>
<th class='title' scope='col'>Email</th>
<th class='title' scope='col'>Archive</th>
<th class='title' scope='col'>Delete</th>
</tr>

";

while ($fila = mysql_fetch_array($datos_sql))
{
echo"
<tr class='spec' >
<td align=center>ID: ".$fila['personalID']."</td>
<td align=center>".$fila['fecha_registro']."</td>
<td>".$fila['first_name']." ".$fila['last_name']."<br />".$fila['phone']."<br />".$fila['email']."</td>
<td width='200px'>".$fila['year1']." ".$fila['make1']." ".$fila['model1']."<br />".$fila['vehicle_type_id1']." <strong>Runs?:</strong>(".$fila['vehicle_runs'].")<br />".$fila['vehicle_type_other1']."</td>
<td width='200px'>".$fila['comment']."</td>
<td><strong>From: </strong>".$fila['pickup_city']."-".$fila['zip_code_pickup']."<br />".$fila['pickup_state_code']."-".$fila['pickup_country_id']."<br /><strong>To: </strong>".$fila['dropoff_city']."-".$fila['zip_code_dropoff']."-".$fila['dropoff_state_code']."<br />".$fila['dropoff_country_id']." <a href='mapa.php?zip_code_pickup=".$fila['zip_code_pickup']."&pickup_city=".$fila['pickup_city']."&zip_code_dropoff=".$fila['zip_code_dropoff']."&dropoff_city=".$fila['dropoff_city']."' target=_blank >route map</a> / <a href='http://maps.google.com/maps?hl=en&tab=wl' target=_blank>map</a></td>
<td align=center>".$fila['estimated_ship_date']."</td>
<td align=center>$: ".$fila['estimado']."</td>
<td align=center><a href='formprequote.php?personalID=".$fila['personalID']."&first_name=".$fila['first_name']."&last_name=".$fila['last_name']."&phone=".$fila['phone']."&email=".$fila['email']."&year1=".$fila['year1']."&make1=".$fila['make1']."&model1=".$fila['model1']."&vehicle_type_id1=".$fila['vehicle_type_id1']."&vehicle_runs=".$fila['vehicle_runs']."&vehicle_type_other1=".$fila['vehicle_type_other1']."&comment=".$fila['comment']."&pickup_city=".$fila['pickup_city']."&zip_code_pickup=".$fila['zip_code_pickup']."&pickup_state_code=".$fila['pickup_state_code']."&pickup_country_id=".$fila['pickup_country_id']."&dropoff_city=".$fila['dropoff_city']."&zip_code_dropoff=".$fila['zip_code_dropoff']."&dropoff_state_code=".$fila['dropoff_state_code']."&dropoff_country_id=".$fila['dropoff_country_id']."&estimated_ship_date=".$fila['estimated_ship_date']."&estimado=".$fila['estimado']."'><img src='images/icon_pre_quote.png'></a></td>
<td align=center><a href='quote_spanish.php?personalID=".$fila['personalID']."&first_name=".$fila['first_name']."&last_name=".$fila['last_name']."&phone=".$fila['phone']."&email=".$fila['email']."&year1=".$fila['year1']."&make1=".$fila['make1']."&model1=".$fila['model1']."&vehicle_type_id1=".$fila['vehicle_type_id1']."&vehicle_runs=".$fila['vehicle_runs']."&vehicle_type_other1=".$fila['vehicle_type_other1']."&pickup_city=".$fila['pickup_city']."&zip_code_pickup=".$fila['zip_code_pickup']."&pickup_state_code=".$fila['pickup_state_code']."&pickup_country_id=".$fila['pickup_country_id']."&dropoff_city=".$fila['dropoff_city']."&zip_code_dropoff=".$fila['zip_code_dropoff']."&dropoff_state_code=".$fila['dropoff_state_code']."&dropoff_country_id=".$fila['dropoff_country_id']."&estimated_ship_date=".$fila['estimated_ship_date']."&estimado=".$fila['estimado']."' target=_blank><img src='images/icon_quote.png'></a></td>
<td align=center><a href='mostraremail.php?first_name=".$fila['first_name']."&last_name=".$fila['last_name']."&email=".$fila['email']."' target=_blank><img src='images/icon_email.png'></a></td>
<td align=center><a onclick='return archivar()' href='archive_leads.php?personalID=".$fila['personalID']."&first_name=".$fila['first_name']."&last_name=".$fila['last_name']."&phone=".$fila['phone']."&email=".$fila['email']."&year1=".$fila['year1']."&make1=".$fila['make1']."&model1=".$fila['model1']."&vehicle_type_id1=".$fila['vehicle_type_id1']."&vehicle_runs=".$fila['vehicle_runs']."&vehicle_type_other1=".$fila['vehicle_type_other1']."&comment=".$fila['comment']."&pickup_city=".$fila['pickup_city']."&zip_code_pickup=".$fila['zip_code_pickup']."&pickup_state_code=".$fila['pickup_state_code']."&pickup_country_id=".$fila['pickup_country_id']."&dropoff_city=".$fila['dropoff_city']."&zip_code_dropoff=".$fila['zip_code_dropoff']."&dropoff_state_code=".$fila['dropoff_state_code']."&dropoff_country_id=".$fila['dropoff_country_id']."&estimated_ship_date=".$fila['estimated_ship_date']."&estimado=".$fila['estimado']."'><img src='images/icon_archive_leads.png'></a></td>
<td align=center><a onclick='return eliminar()' href='eliminarregistro.php?personalID=".$fila['personalID']."&first_name=".$fila['first_name']."&last_name=".$fila['last_name']."&phone=".$fila['phone']."&email=".$fila['email']."&year1=".$fila['year1']."&make1=".$fila['make1']."&model1=".$fila['model1']."&vehicle_type_id1=".$fila['vehicle_type_id1']."&vehicle_runs=".$fila['vehicle_runs']."&vehicle_type_other1=".$fila['vehicle_type_other1']."&comment=".$fila['comment']."&pickup_city=".$fila['pickup_city']."&zip_code_pickup=".$fila['zip_code_pickup']."&pickup_state_code=".$fila['pickup_state_code']."&pickup_country_id=".$fila['pickup_country_id']."&dropoff_city=".$fila['dropoff_city']."&zip_code_dropoff=".$fila['zip_code_dropoff']."&dropoff_state_code=".$fila['dropoff_state_code']."&dropoff_country_id=".$fila['dropoff_country_id']."&estimated_ship_date=".$fila['estimated_ship_date']."&estimado=".$fila['estimado']."'><img src='images/icon_delete.png'></a></td>
</tr>
";
}
echo "</tabla>";
// Al final imprimimos la paginación, ya saben, los numeritos...
$kp1->paginate() ;

$_SESSION['personalID'] = $personalID;

mysql_close($conexion);

?>