Ver Mensaje Individual
  #8 (permalink)  
Antiguo 06/03/2008, 09:35
barto3x
 
Fecha de Ingreso: enero-2008
Mensajes: 33
Antigüedad: 16 años, 3 meses
Puntos: 0
Re: consulta mysql y mostrar por pantalla

<html>

<head>
<title> Actualizacion Exitosa - UNIVERSIA CHILE </title>

<!-- Enlazando hoja de estilo básica -->
<link href="css/estilo.css" rel="stylesheet" rev="stylesheet" type="text/css">

</head>

<body>

<p><a href="html/facturas.html"> Facturas </a></p>
<p>-------------</p>

<p>Opciones</p>

<ol>
<li><a href="php/factura_formulario.php"> Recepcion </a></li>

<li><a href="php/factura_codificacion.php"> Codificacion </a></li>

<li><a href="php/factura_despacho.php"> Despacho </a></li>

<li><a href="php/facturas_busqueda.php"> Buscar </a></li>
</ol>

</center>

</form>

</body>

</html>


<?php

// LLAMANDO AL MODULO DE CONEXION
include("../php/modulo_conexion.php");

// ESTABLECIENDO LA CONEXION
$cnn = mysql_connect($servidor,$usuario,$password);
if(!isset($cnn)){
die ("Error de conexión: ").mysql_error();
}

// SELECCIONANDO LA BASE DE DATOS
mysql_select_db($database,$cnn);

//$sql = "SELECT * FROM facturas ORDER BY fact_fech_ingr";

$sql_final = "SELECT facturas.fact_nume, facturas.proveedores_prove_rut, facturas.cuentas_cuen_codi,
facturas.fact_fech_ingr, facturas.fact_desc, facturas.fact_monto, facturas.fact_fech_envi,
roles.rol_desc
FROM facturas, asignacion, roles
WHERE facturas.fact_nume = asignacion.facturas_fact_nume
AND asignacion.roles_rol_codi = roles.rol_codi ";

$resultado = mysql_query($sql_final,$cnn);
echo mysql_error();

// codigo responsable
$codigo_resp = 0;
$responsable = 0;

$contador = 0;

$facturas = array();

// DEFINIENDO UNA TABLA PARA MOSTRAR LOS DATOS LAS FACTURAS
echo "<center>";
echo "<table border='2' bgcolor='#e3e4fa'>\n";
echo "<tr> \n";
echo "<td><b>Número de Factura</b></td> \n";
echo "<td><b>Rut del Proveedor</b></td> \n";
echo "<td><b>Código de Cuenta Contable</b></td> \n";
echo "<td><b>Fecha de Ingreso</b></td> \n";
echo "<td><b>Descripción</b></td> \n";
echo "<td><b>Monto</b></td> \n";
echo "<td><b>Fecha de Envío</td></b> \n";
echo "<td><b>Responsable de Gasto</td></b> \n";
echo "<td><b>Responsable de entrega</td></b> \n";
echo "</tr> \n";
echo "</center>";

while($row = mysql_fetch_array($resultado)){

// CAMBIANDO EL FORMATO DE LA FECHA DE AAAA-MM-DD a DD-MM-AAAA
$f1 = substr($row["fact_fech_ingr"],0,4);
$f2 = substr($row["fact_fech_ingr"],5,2);
$f3 = substr($row["fact_fech_ingr"],8,2);
$fecha_ingreso = $f3."-".$f2."-".$f1;

// COMPROBANDO SI EL CODIGO DE CUENTA Y LA FECHA DE ENVIO
// TIENEN VALOR NULL. DE SER ASI, MUESTRA UN MENSAJE
// DE QUE NO ESTÁ INGRESADO EL DATO.
if($row['cuentas_cuen_codi'] == NULL){
$row['cuentas_cuen_codi'] = "<b> No Ingresada </b>";
}

if($row['fact_fech_envi'] == NULL or $row['fact_fech_envi'] == "0000-00-00"){
$row['fact_fech_envi'] = "<b> No Ingresada <b>";
}

?>

<html>
<head>

<title> Consulta de Facturas - UNIVERSIA CHILE </title>

<!-- ENLAZANDO HOJAS DE ESTILO -->
<link href="css/estilo_tablas.css" rel="stylesheet" rev="stylesheet" type="text/css">

<!-- LLAMADA A LAS FUNCIONES JAVASCRIPT -->
<script src="../js/validar_codificacion.js" type="text/javascript"></script>

</head>

<body>

<form id="f" method="post">

<center>

<!-- CONTINUACION TABLA -->
<tr>
<td class="estilo1" > <?php echo $row['fact_nume']; ?> </td>
<td class="estilo1" > <?php echo $row['proveedores_prove_rut']; ?> </td>
<td class="estilo1" > <?php echo $row['cuentas_cuen_codi']; ?> </td>
<td class="estilo1" > <?php echo $fecha_ingreso ?> </td>
<td class="estilo1" > <?php echo $row['fact_desc']; ?> </td>
<td class="estilo1" > <?php echo "$ ".$row['fact_monto']; ?> </td>
<td class="estilo1" > <?php echo $row['fact_fech_envi']; ?> </td>
<td class="estilo1" > <?php echo $row['rol_desc']; ?> </td>
<td class="estilo1" > <?php echo $row['rol_desc']; ?> </td>
</tr>

<?php
//} // FIN WHILE RESPONSABLES
} // FIN WHILE FACTURAS
mysql_close($cnn);
?>

</table>

<br>

</center>

</form>

</body>

</html>

en la tabla asignacion estos son los campos:
asig_codi - facturas_fact_nume - roles_rol_codi - rol_entr - rol_gast

en la tabla me asigna el numero de factura, y el codigo del rol. si es un responsable de entrega ingresa un 1 si es un responsable de gasto es un 1
pero el problema es que me muestra los responsable de entrega y de gasto en la misma columna. lo que deseo es mostrar en columnas separadas el responsable de entrega y el de gasto.

gracias por los consejos. espero tu ayuda