Ver Mensaje Individual
  #4 (permalink)  
Antiguo 20/11/2014, 05:35
nakoart
 
Fecha de Ingreso: junio-2010
Mensajes: 10
Antigüedad: 13 años, 10 meses
Puntos: 0
Respuesta: <a href="# no funciona

Como ya he dicho, es difícil de explicar, y yo me explico como el culo, el funcionamiento es el siguiente:

el botón esta dentro de un SELECT * FROM, y este recoge la numeración de la factura de <?php echo $dato['factura']; ?>(por lo que se generan tantos botones como registros tenga la tabalSQL "factura") por eso tiene un value. A su vez los envia a otro SELECT * FROM, en modo búsqueda, realizando en otra tablaSQL "detalle" la búsqueda de todos los productos, cuya numeración de factura sea igual, a la que envía el botón, y muestra en tantas tablas comos sea necesario todos los resultados, coincidad.

Aquí el código completo del botón con el SELECT, este, repito, recoge la numeración de factura y la envía tras hacer click, a la tabla "MyProduc" y a su vez hace la llamada para que esta, que se encuentra oculta, se muestre.
Código:
<tabla>
<?php 
    	$can=mysql_query("SELECT * FROM factura UNION SELECT * FROM gastos WHERE cajera='$usuario'");
		while($dato=mysql_fetch_array($can)){			 
?>
	<tr>
		<td colspan="17" width="1223" height="3">
			<img src="IMG_ADMINISTRADOR/arqueo_list_17.png" alt=""></td>
	</tr>
	<tr>
	  <td width="150" height="50" class="Blanco7" align="center">
        <font class="ArtC"><?php echo $dato['factura']; ?></font></td>
		<td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/arqueo_list_19.png" alt=""></td>
	  <td width="257" height="50" class="Blanco7b" align="left" >
        <font class="ArtC"><?php echo $dato['estado']; ?></font></td>
		<td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/arqueo_list_21.png" alt=""></td>
	  <td width="303" height="50" class="Blanco7b" align="left">
       <font class="ArtC"><?php echo $dato['cajera']; ?></font></td>
		<td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/arqueo_list_23.png" alt=""></td>
	  <td width="114" height="50" class="Blanco7" align="center">
        <font class="ArtC"><?php echo $dato['fecha']; ?></font></td>
		<td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/arqueo_list_25.png" alt=""></td>
		<td width="78" height="50" class="Blanco7" align="center">
        <font class="ArtC"><?php echo $dato['articulos']; ?></font></td>
		<td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/arqueo_list_27.png" alt=""></td>
	  <td width="94" height="50" class="Blanco7" align="center">
        <font class="ArtC"><?php echo $dato['total']; ?>€</font></td>
		<td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/arqueo_list_29.png" alt=""></td>
	  <td width="103" height="50" class="Blanco7" align="center">
        <font class="ArtC"><?php  $dato['pago']; ?></font></td>
		<td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/arqueo_list_31.png" alt=""></td>
         <form method="post" class="">   
        <td width="50" height="50">
         <a href="#MyProduc"data-toggle="modal">
         <button name="bus"  class="X100to" type="submit" value="<?php echo $dato['factura']; ?>">
            <img src="IMG_ADMINISTRADOR/arqueo_list_32.png" alt=""></button></a></td></form>
		<td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/arqueo_list_33.png" alt=""></td>
		<td width="50" height="50">
        <a href="#">
     	<form type="ton" class="PV" onClick="window.location='php_eliminar_venta.php?id=<?php echo $dato['factura']; ?>'">
			<img src="IMG_ADMINISTRADOR/arqueo_list_34.png" alt=""></form></a></td>
	</tr> 
    <?php } ?>

Aquí el código de la tabla MyProduct, cuando esta reciba la orden de mostrarse, también mostrar el resultado de la búsqueda en "detalle" mostrando todos los productos que coincidan con la numeración facilitada por el anterior botón.

Código:
<table id="MyProduc"  class="modal2 hide fade" >
....
<?php 
	if(empty($_POST['bus'])){
		$can=mysql_query("SELECT * FROM detalle");
	}else{
		$can=mysql_query("SELECT * FROM detalle WHERE factura LIKE '$buscar%'");
	}	
	while($dato=mysql_fetch_array($can)){			
	?>
	<tr>
		<td width="150" height="50" align="center" class="Blanco7">
		<?php echo $dato['codigo']; ?>
			</td>
	  <td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/caja_productos_18.png" alt=""></td>
	  <td width="644" height="50" class="Blanco7b">
      <font class="ArtC">
	  <?php echo $dato['nombre']; ?></font>
	  </td>
	  <td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/caja_productos_20.png" alt=""></td>
	  <td colspan="2" width="122" height="50" class="Blanco7" align="center">
	  <?php echo $dato['valor']; ?></td>
	  <td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/caja_productos_22.png" alt=""></td>
	  <td width="60" height="50" class="Blanco7" align="center">
      <?php echo $dato['cantidad']; ?>
	  </td>
	  <td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/caja_productos_24.png" alt=""></td>
	  <td width="128" height="50" class="Blanco7" align="center">
      <?php echo $dato['importe']; ?>
	  </td>
	  <td width="3" height="50">
			<img src="IMG_ADMINISTRADOR/caja_productos_26.png" alt=""></td>
	  <td width="51" height="50">
			<img src="IMG_ADMINISTRADOR/caja_productos_27.png" alt=""></td>
	  <td width="1" height="50">
			<img src="IMG_ADMINISTRADOR/espacio.gif" alt=""></td>
	</tr>
	<tr>
		<td colspan="12" width="1170" height="3">
			<img src="IMG_ADMINISTRADOR/caja_productos_28.png" alt=""></td>
		<td width="1" height="3">
			<img src="IMG_ADMINISTRADOR/espacio.gif" alt=""></td>
	</tr>
<?php  }?>
El problema esta en que no carga los 2 productos por ejemplo que coinciden con la numeracion enviada por el submit, sino que los carga todos, coincidan o no, pero por el contrario quito "class="modal2 hide fade"" de la tabla "MyProduc" no se oculta y se muestran los resultados que coinciden.

¿Como hago para que se muestren los productos que coinciden y que la tabla oculta también funcione?

No se si me he explicado bien, Pero de todas formas muchas gracias.

Última edición por nakoart; 20/11/2014 a las 05:41