Foros del Web » Programando para Internet » PHP »

Ayuda

Estas en el tema de Ayuda en el foro de PHP en Foros del Web. ALGUIEN ME PUEDE EXPLICAR ESTE CODIGO LO QUE ESTA CON ROJO <?php $sql="SELECT * FROM articulos"; $src=mysql_query($sql,$conexion) or die ("<font color=red>No se puedo realizar la ...
  #1 (permalink)  
Antiguo 15/04/2009, 09:47
Avatar de rafyky86  
Fecha de Ingreso: abril-2009
Ubicación: monterrey
Mensajes: 81
Antigüedad: 15 años
Puntos: 0
Pregunta Ayuda

ALGUIEN ME PUEDE EXPLICAR ESTE CODIGO LO QUE ESTA CON ROJO



<?php

$sql="SELECT * FROM articulos";
$src=mysql_query($sql,$conexion) or die ("<font color=red>No se puedo realizar la sentencia</font><br>".mysql_error());
echo "<center ".$tit."><h2>Catalogo De Articulos</h2><br><a href=altaArticulos.php>Registrar nuevo articulo</a><br>
<a href=entradaInventario.php>Entrada al Inventario</a><br>
<a href=salidaInventario.php>Salida al Inventario</a></center>
<br>

<table align=center cellspacing=0 cellpadding=3>
<tr ".$tituloparatablas.">
<td colspan=2 align=center ".$fondo02."> OPERACIONES </td>
<td align=center ".$fondo02."> ID </td>
<td align=center ".$fondo02."> NOMBRE </td>
<td align=center ".$fondo02."> PRECIO </td>
<td align=center ".$fondo02."> DESCRIPCION </td>
<td align=center ".$fondo02."> EXISTENCIA </td>
<td align=center ".$fondo02."> DEPARTAMENTO </td>
<td align=center ".$fondo02."> IMAGEN </td>
</tr>";
while($data=mysql_fetch_array($src)){
$buscadepto="SELECT * FROM departamento WHERE id_depto='".$data[5]."'";
$busca=mysql_query($buscadepto,$conexion);
$departamento=mysql_fetch_array($busca);

echo "<tr ".$letrasparatablas."><td align=center><a href='borrarArt.php?id=$data[0]'><img src=borra.gif widht=20 height=20 alt='Borrar Articulo'></a></td>";
echo "<td align=center><a href='formModifiArt.php?id=$data[0]'><img src=modifica.gif widht=20 height=20 alt='Modificar'></a></td>";
echo "<td align=center>".$data[0]."</td>";
echo "<td align=center>".$data[1]."</td>";
echo "<td align=center>$".$data[2]."</td>";
echo "<td align=center>".$data[3]."</td>";
echo "<td align=center>".$data[4]."</td>";
echo "<td align=center>".$departamento[1]."</td>";
echo "<td align=center><a href=verfoto.php?id=$data[0] onClick=\"window.open('verfoto.php?id=$data[0]',
'verfoto', 'toolbar=no, directories=no, location=no, status=no, menubar=no,resizable=no, scrollbars=yes, width=500, height=500'); return false\"><img src=".$data[6]." width=15 height=15 alt='Click aqui para ver grande'></td>";
echo "</tr>";
}
echo "</table>";

mysql_close($conexion);

?>
  #2 (permalink)  
Antiguo 15/04/2009, 09:49
 
Fecha de Ingreso: enero-2008
Ubicación: Estado de México, México
Mensajes: 476
Antigüedad: 16 años, 3 meses
Puntos: 11
Respuesta: Ayuda

que necesitas saber se mas explicito para que puedas recibir ayuda.
  #3 (permalink)  
Antiguo 15/04/2009, 09:57
Avatar de By_George  
Fecha de Ingreso: abril-2009
Ubicación: localhost
Mensajes: 629
Antigüedad: 15 años
Puntos: 19
Respuesta: Ayuda

Cita:
Iniciado por rafyky86 Ver Mensaje
ALGUIEN ME PUEDE EXPLICAR ESTE CODIGO LO QUE ESTA CON ROJO



<?php

$sql="SELECT * FROM articulos";
$src=mysql_query($sql,$conexion) or die ("<font color=red>No se puedo realizar la sentencia</font><br>".mysql_error());
echo "<center ".$tit."><h2>Catalogo De Articulos</h2><br><a href=altaArticulos.php>Registrar nuevo articulo</a><br>
<a href=entradaInventario.php>Entrada al Inventario</a><br>
<a href=salidaInventario.php>Salida al Inventario</a></center>
<br>
en esta parte lo que hace es una busqueda a la tabla articulos y despues pone unos links

Cita:
Iniciado por rafyky86 Ver Mensaje
while($data=mysql_fetch_array($src)){
$buscadepto="SELECT * FROM departamento WHERE id_depto='".$data[5]."'";
$busca=mysql_query($buscadepto,$conexion);
$departamento=mysql_fetch_array($busca);
y en esta otra muestra los resultados de la consulta anterior y hace otra consulta ala tabla departamento cuando el id_depto es igual al valor de la columna 6 del resultado de la busqueda anterior
  #4 (permalink)  
Antiguo 15/04/2009, 10:57
Avatar de rafyky86  
Fecha de Ingreso: abril-2009
Ubicación: monterrey
Mensajes: 81
Antigüedad: 15 años
Puntos: 0
Respuesta: Ayuda

Muchas gracias por su ayuda ya resolvi los problemas que tenia con ese codigo

Saludos
  #5 (permalink)  
Antiguo 15/04/2009, 11:01
Avatar de rafyky86  
Fecha de Ingreso: abril-2009
Ubicación: monterrey
Mensajes: 81
Antigüedad: 15 años
Puntos: 0
Respuesta: Ayuda

ASI QUEDO MI CODIGO LO QUE PASA ES QUE LE QUITE UNAS COSAS Y LE AGREGUE EL INCLUDE CONEXION

<?php
include('conexion.php');
$sql="SELECT * FROM jea_500_cp";
$src=mysql_query($sql,$conexion) or die ("<font color=red>No se puedo realizar la sentencia</font><br>".mysql_error());
echo "<center ".$tit."><h2>Catalogo De Articulos</h2><br><a href=altaArticulos.php>Registrar nuevo articulo</a><br>
<a href=entradaInventario.php>Entrada al Inventario</a><br>
<a href=salidaInventario.php>Salida al Inventario</a></center>
<br>
<table align=center cellspacing=0 cellpadding=3>
<tr ".$tituloparatablas.">
<td colspan=2 align=center ".$fondo02."> OPERACIONES </td>
<td align=center ".$fondo02."> ID </td>
<td align=center ".$fondo02."> NOMBRE </td>
<td align=center ".$fondo02."> PRECIO </td>
<td align=center ".$fondo02."> DESCRIPCION </td>
<td align=center ".$fondo02."> EXISTENCIA </td>
<td align=center ".$fondo02."> DEPARTAMENTO </td>
<td align=center ".$fondo02."> IMAGEN </td>
</tr>";
while($data=mysql_fetch_array($src)){
echo "<tr ".$letrasparatablas."><td align=center><a href='borrarArt.php?id=$data[0]'><img src=borra.gif widht=20 height=20 alt='Borrar Articulo'></a></td>";
echo "<td align=center><a href='formModifiArt.php?id=$data[0]'><img src=modifica.gif widht=20 height=20 alt='Modificar'></a></td>";
echo "<td align=center>".$data[0]."</td>";
echo "<td align=center>".$data[1]."</td>";
echo "<td align=center>$".$data[2]."</td>";
echo "<td align=center>".$data[3]."</td>";
echo "<td align=center>".$data[4]."</td>";
echo "<td align=center>".$departamento[1]."</td>";
echo "<td align=center><a href=verfoto.php?id=$data[0] onClick=\"window.open('verfoto.php?id=$data[0]',
'verfoto', 'toolbar=no, directories=no, location=no, status=no, menubar=no,resizable=no, scrollbars=yes, width=500, height=500'); return false\"><img src=".$data[6]." width=15 height=15 alt='Click aqui para ver grande'></td>";
echo "</tr>";
}
echo "</table>";

mysql_close($conexion);

?>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:58.