|
Posted by Dave on 10/19/53 11:21
julian maisano (julianmaisanoXYZ@gmail.com) decided we needed to
hear...
> As you'll see, I'm a beginner php guy...
>
> What i'm trying to achieve is:
>
> 1) List in AllProducts.php a set of products which are stored in a MySql
> table. Each product has a picture. Each picture actually is a link to a
> articulodetalle.php, where there will be greater pictures in, plus some
> detailed text.
>
>
> Code in AllProducts.php actually works fine:
>
> $query = "SELECT * FROM articulos";
> $result = mysql_query($query);
> $i=0;
> while($row = mysql_fetch_array($result, MYSQL_ASSOC))
> {
> if($i==$public_numero_de_items_por_fila){ //acá cambia de columna
> $i=0;
> echo "<TR><TH>";
> } else {
> echo "<TH>";
> }
> $i+=1;
> //here I set up the link to detallearticulo.php *******
> echo '<a href="detallearticulo.php?id_articulo=' . $row['id_articulo']
> . '">';
> echo '<img width="150" border="0" src="images/' . $row['id_articulo']
> . '.jpg" >';
> echo '</a>';
> echo "<br>";
> echo "id_articulo :{$row['id_articulo']} <br>";
> echo "descripcion :{$row['descripcion']} <br>";
> echo "precio : {$row['precio']} <br><br>";
> }
>
>
> ***** an example of the the link created (in AllProducts.php )is:
>
> detallearticulo.php?id_articulo=xyz325
>
>
> The problem i'm having is that I've an empty variable value in
> detallearticulo.php
>
> $id_articulo (in detallearticulo.php)should have the variable value
> associated with the product (xyz325), but it's empty...
>
> What's happening?
> Any advice would be apreciated...
>
> sdos - jm
>
You seem to be assuming that $id_articulo will be set for you
automatically. If register_globals is on in php.ini then that
is what will happen, however register_globals is a potential
security risk (when not used correctly) and so its default
value is off since PHP 4.2
The "correct" way to access the variable passed from your first
script is to use $_GET['id_articulo'] instead of $id_articulo
--
Dave <dave@REMOVEbundook.com>
(Remove REMOVE for email address)
Navigation:
[Reply to this message]
|