Welcome Guest, Not a member yet? Register   Sign In
Sale syntax error, unexpected '}', expecting end of file al hacer un select
#1

(This post was last modified: 10-07-2018, 04:20 AM by ciadmin.)

*non-english redacted* unexpected '}'
*non-english redacted*

Code:
<html>
<head>
   <meta charset="UTF-8">
       <TITLE></TITLE>
       <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0">        
       <!-- <link rel="stylesheet" type="text/css" href="<?php /*echo base_url();*/ ?>/css/estilos.css">
        <link rel="stylesheet" type="text/css" href="http://localhost/CesdeCodeIgniter/application/views/css/estilos.css"> -->
       <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>/css/bootstrap.min.css">

       <style type="text/css">
           body{
               margin:0;  
               color:#6a6f8c;  
               font:600 16px/18px 'Open Sans',sans-serif;
           }

           html {
               height: 100%;
           }
       </style>    
</head>

<body>
   <br>
       <div class="container-fluid">
           <br>
           <div class="row">
               <div class="col-md-10">
                   <ul class="nav nav-pills">
                       <li role="presentation" ><a href="http://localhost/CesdeCodeIgniter/index.php/cliente/mostrarInicio">Inicio</a></li>
                       <li role="presentation" class="active"><a href="http://localhost/CesdeCodeIgniter/index.php/cliente/mostrarDatos/cliente">Ingresar Cliente </a></li>
                       <li role="presentation" ><a href="http://localhost/CesdeCodeIgniter/index.php/cliente/buscarCliente">Buscar Cliente </a></li>
                       <li role="presentation"><a href="cuentaxcliente.php">Cuenta Cliente</a></li>
                       <li role="presentation"><a href="transaccuenta.php">Transación Cuenta</a></li>
                       <li role="presentation"><a href="http://localhost/CesdeCodeIgniter/index.php/transaccion/IngresarTransaccion">Ingresar Tipo de Transacción</a></li>
                       <li role="presentation"><a href="http://localhost/CesdeCodeIgniter/index.php/transaccion/BuscarTransaccion">Buscar Tipo de Transacción</a></li>
                       <li role="presentation"><a href="http://localhost/CesdeCodeIgniter/index.php/cliente/login">Login</a></li>

                   </ul>
               </div>
           </div>
       </div>

   <br><br>    



   <?php
       foreach ($clientes->result() as $c) { ?>
           <ul>
               <li><?php= $c->Nombre ?></li>
           </ul>

       <?php } ?>  
   <br>    


   <script type="text/javascript" src="http://localhost/CesdeCodeIgniter/js/jquery-3.2.1.min.js"></script>
   <script type="text/javascript" src="http://localhost/CesdeCodeIgniter/js/bootstrap.min.js"></script>            

</body>
</html>


main_model


Code:
<?php  
class Main_model extends CI_Model  
{  
   public function __construct() {
       //llamamos al constructor de la clase padre
       parent::__construct();

       //cargamos la base de datos
       $this->load->database();
   }      

   public function insertar($datos){
     $this->db->insert('tbl_cliente', array('DocIdent'=>$datos['documentoDeIdentidad'],
       'Nombre'=>$datos['nombre'],
       'Apellido'=>$datos['apellido'],
       'Direccion'=>$datos['direccion'],
       'Telefono'=>$datos['telefono'],
       'Estado'=>$datos['estado'],
       'FechaIngreso'=>$datos['fechaIngreso'],
       'Password'=>$datos['password']
     ));
    }

    public function obtenerClientes(){
       $query = $this->db->get('tbl_cliente');

        if($query->num_rows()>0){            
           return $query;            
       }else{
           return false;
       }
    }

cliente_buscar (el controlador)
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

   class cliente_buscar extends CI_Controller{
       function __construct(){
           parent::__construct();
           $this->load->helper(array('form', 'url'));
           $this->load->library('form_validation');
           $this->load->database();
           //llamo o incluyo el modelo
           $this->load->model('main_model');

       }

       function listado(){
           $data['clientes'] = $this->main_model->obtenerClientes();
           $this->load->view('formulario_buscar_cliente', $data);
       }He intentado con
<?php echo $c->Nombre; ?>
Reply
#2

@jhonhernandez300,

Why don't you kick out the generated SQL statement so that you can see how the query looks and if it is correct.
Reply
#3

This worked for me
<table border="1">
<?php foreach($ver as $fila){ ?> <tr> <td> <?=$fila->DocIdent;?> </td> <td> <?=$fila->Nombre;?> </td> <td> <?=$fila->Apellido;?> </td> <td> <?=$fila->Direccion;?> </td> <td> <?=$fila->Telefono;?> </td> </tr> <?php } ?>
</table>
Reply




Theme © iAndrew 2016 - Forum software by © MyBB