• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ayuda con formato PDF

#2
[eluser]Tim Brownlaw[/eluser]
Hola y bienvenido al mundo de PHP y CodeIgniter Smile
Puede usar https://translate.google.com si usted no entiende Inglés

This might help... ( I have not tested this, so there might be a few mistakes)
I have kept this simple without adding any error checking but I have added in some comments where you would need to take some action depending upon the outcome.

Your Model is

Code:
function seleccionar($tabla=NULL, $columna=NULL, $valor=NULL){
if($tabla != NULL AND $columna != NULL AND $valor != NULL)
{
   $row = $this->db->from($tabla)->where($columna, $valor)->get()->row();
   // Test if $row does not have a result and return false
}
else
  return false;  // Missing Parameters
}

Your Controller should be...

Code:
function formato_baja($id=0) {
  if ($id == 0) {
    redirect('personal', 'refresh');
    exit(0);
  }
  $this->data['fecha_baja'] =
      $this->cdc_model->seleccionar('comisionista_baja', 'id_comisionista_baja',$id);
// Need to know what to do if $this->data['fecha_baja'] is FALSE

So $this->data['echa_baja'] will be an object of an array.

If you pass $this->data['fecha_baja'] to your view you will need to access the elements using something like
$fecha_baja->id etc.

As an example ( as I do not know the other field names you want to display from the database row)
The Simple, One entry from the database, view.
Code:
<td colspan="1">Fecha de baja:</td>
      <td colspan="3"><div class="info">&lt;?php echo $fecha_baja->id;?&gt;</div></td>
  </tr>

There are various ways to create a table of all the values... but see if this part works first!

You haven't shown how you are displaying the actual view... One thing you would need to do is to check the return from the model in the controller to determine the output... as I have indicated above.



Messages In This Thread
ayuda con formato PDF - by El Forum - 08-12-2014, 05:12 PM
ayuda con formato PDF - by El Forum - 08-12-2014, 07:32 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.