Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/11/2014, 11:07
Avatar de asassa
asassa
 
Fecha de Ingreso: julio-2008
Ubicación: En el DF ectuoso
Mensajes: 240
Antigüedad: 15 años, 9 meses
Puntos: 0
Pregunta isset comparación

hola estoy haciendo un buscado pero necesito deplegar desde un inicio el valor contenido de la base de datos.

pero como hay que hacen envio de datos primero para que envie los resultados.
Como puedo hacer para que desde un principio pueda mostrar X datos.
Código PHP:
require_once 'Connection.simple.php';
    
$conn dbConnect();
    
$OK true// We use this to verify the status of the update.
    // If 'buscar' is in the array $_POST proceed to make the query.
    
if (isset($_GET['name'])) {
        
// Create the query
        
$data "%".$_GET['name']."%";
        
$sql 'SELECT * FROM employee WHERE name like ?';
        
// we have to tell the PDO that we are going to send values to the query
        
$stmt $conn->prepare($sql);
        
// Now we execute the query passing an array toe execute();
        
$results $stmt->execute(array($data));
        
// Extract the values from $result
        
$rows $stmt->fetchAll();
        
$error $stmt->errorInfo();
        
//echo $error[2];
    
}
    
// If there are no records.
    
if(empty($rows)) {
        echo 
"<tr>";
            echo 
"<td colspan='4'>There were not records</td>";
        echo 
"</tr>";
    }
    else {
        foreach (
$rows as $row) {
            echo 
"<tr>";
                echo 
"<td>".$row['employee_id']."</td>";
                echo 
"<td>".$row['name']."</td>";
                echo 
"<td>".$row['email']."</td>";
                echo 
"<td>".$row['telephone']."</td>";
            echo 
"</tr>";
        }
    }
?> 
Asta donde entiendo es por el isset.