Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/10/2015, 00:37
ErickJohan
 
Fecha de Ingreso: julio-2015
Ubicación: Tarapoto
Mensajes: 10
Antigüedad: 8 años, 10 meses
Puntos: 0
Información Error al mostrar el id

Hola tengo este problema.
Todo el procedimiento esta en esta pagina. El problema es que no lista los productos porque $idalquiler no reconoce en en la consulta que estoy haciendo.
Código HTML:
<?php
    error_reporting(0);
    $cn=  mysql_connect("localhost","root","root");
    if($cn)
    {
        mysql_select_db("biblioteca",$cn);
    }

    $idalquiler = $_GET['idalquiler'];

    if(isset($_POST['proAlqui']))
    {
        $sql=" 
            select ap.idalquiler,p.imagen,ap.cantidad,p.producto,ap.precio,ap.adelanto,ap.accesorios,ap.observaciones
            from alquiler_producto ap,producto p
            where p.idproducto=ap.idproducto
            and ap.idalquiler='$idalquiler'
             ";
        $result=  mysql_query($sql); 
        while ($row=  mysql_fetch_object($result))
        {
            echo "<tr align='left'>    
                        <td>$row->cantidad</td>    
                        <td>$row->producto</td>
                        <td>
                            <img class='pic' src='recursos/productos/$row->imagen'>
                            <img class='picbig' src='recursos/productos/$row->imagen'>    
                        </td>     
                        <td>$row->precio</td>
                        <td>$row->adelanto</td>   
                        <td>
                            <a idd='$row->idalquiler' class='delete' href='#?idd=$row->idalquiler'><span class='icon mif-cross'></span></a>
                        </td>                            
                        <td>                        
                            <a ide='$row->idalquiler' role='button' onclick=showDialog('dialog9') class='edit' href='#?id=$row->idalquiler'><span class='icon mif-pencil'></span></a>
                        </td>
                  </tr>";
        }
        exit();
    }
    if($idalquiler==""){    
    $result = mysql_query("select max(idalquiler) as id from alquiler where estado='1'");
    $row = mysql_fetch_array($result);    
    header("Location: reserva.php?idalquiler=".$row["id"]."");
    exit();
    }
?>
<html>
    <head>
        <title>reserva</title>
    </head>
    <script src="jquery/jquery-2.1.3.min.js"></script>
    <body>
        <table border="1">
                <thead>
                    <tr>              
                        <th>Cant.</th>                               
                        <th>Prenda</th>
                        <th></th>
                        <th>SubTo.</th>
                        <th>Total</th>
                        <th></th>
                        <th></th>  
                    </tr>
                </thead>
                <tbody id="proAlqui">
                </tbody>
                <tfoot>
                    <tr>
                        <th></th>                            
                        <th></th>
                        <th></th>                               
                        <th></th>
                        <th>TOTAL:</th>
                        <th>10</th>
                        <th></th>
                        <th></th>  
                    </tr>
                </tfoot>
            </table> 
    </body>
    <script type="text/javascript">
        $(function () {
    proAlqui();
    
});

function proAlqui()
{
    $.ajax({
        url: "reserva.php",
        type: "POST",
        async: false,
        cache: false,
        data:
                {
                    proAlqui: 1
                },
        success: function (re)
        {
            $('#proAlqui').html(re);

        }
    });
}
    </script>
</html>