Proba lo siguiente (try the following):

$SQL = "SELECT... ...".$cliptoshow.")";

aca el ". significa terminar cadena de texto y concatenar lo que sigue a la
cadena y ." significa concatenar una nueva cadena (es lo ideal aunque ocupe
mas espacio y tiempo, pues separa variables del texto)
(here the ". is end the text string and append the following to the string,
and ." is append a new text string (is the ideal, because divide from
strings and variables, but take more space and time)

o quizas (or maybe)

$SQL = "SELECT... ...$cliptoshow\)";

el caracter de escape puede solucionar tu problema (the escape char can help
you)

Espero que estas soluciones funcionen

Gonzalo Daniel Vivanco Mocorrea
-----------------------
"Fernando Gonzalez" <[EMAIL PROTECTED]> escribió en el mensaje
000e01c0e031$29bf0de0$90fd30c8@servidor">news:000e01c0e031$29bf0de0$90fd30c8@servidor...
I have to php pages that call the same mysql query

The first page would be:

<?php
include ('conection.inc');

$sql="SELECT mae_articulos.fecha_pub, mae_medios.des_medio,
    mae_articulos.pagina, mae_periodistas.nom_periodista,
    mae_periodistas.ap_periodista, mae_articulos.alto,
    mae_articulos.ancho, mae_articulos.cod_articulo,
    mae_articulos.ruta_imagen
FROM mae_articulos, mae_medios, mae_periodistas
WHERE mae_articulos.cod_medio = mae_medios.cod_medio AND
    mae_articulos.cod_periodista = mae_periodistas.cod_periodista
     AND (mae_articulos.cod_articulo = $art)";

$results=mysql_query($sql,$db);
$rows=mysql_fetch_array($results);
$fecha=$rows[0];
$medio=$rows[1];
$periodista=$rows[3]." ".$rows[4];
$pag=$rows[2];
$tamano=$rows[5]." cm. x ".$rows[6]." cm.";
$alto=doubleval($rows[5])*28.35;
$ancho=doubleval($rows[6])*28.35;
$imagen=$rows[8];
?>
The query in this page works well with an $art variable that is being
passed.

The problem comes on another page where I have a an array being passed and I
dont know which would be the first value, so I have this:


<?php
 include ('conection.inc');
// $cantidad  is a variable that let me know the lenght of the array being
passed (it starts a 1) (checkboxes $clip[$i])
// I want to capture the first checkbox that has been selected so I can
display the results for that variable (a hidden input $art[$i] will give me
the value)
// Later
$i=1;
while($i<=$cantidad){
    if ((isset($clip[$i]))){
       $cliptoshow=$art[$i];
       break;
    }
$i++;
}

$sql="SELECT mae_articulos.fecha_pub, mae_medios.des_medio,
    mae_articulos.pagina, mae_periodistas.nom_periodista,
    mae_periodistas.ap_periodista, mae_articulos.alto,
    mae_articulos.ancho, mae_articulos.cod_articulo,
    mae_articulos.ruta_imagen
FROM mae_articulos, mae_medios, mae_periodistas
WHERE mae_articulos.cod_medio = mae_medios.cod_medio AND
    mae_articulos.cod_periodista = mae_periodistas.cod_periodista
     AND (mae_articulos.cod_articulo = $cliptoshow)";

$results=mysql_query($sql,$db);
$rows=mysql_fetch_array($results);
$fecha=$rows[0];
$medio=$rows[1];
$periodista=$rows[3]." ".$rows[4];
$pag=$rows[2];
$tamano=$rows[5]." cm. x ".$rows[6]." cm.";
$alto=doubleval($rows[5])*28.35;
$ancho=doubleval($rows[6])*28.35;
$imagen=$rows[8];
?>

I would have this error Not a valid MySQL result argument at line xxx  (line
xxx will be the one of  "$rows=mysql_fetch_array($results);")
The wierd thing will be that when I put an  echo $sql; line The Browser will
show me this:

SELECT mae_articulos.fecha_pub, mae_medios.des_medio,mae_articulos.pagina,
mae_periodistas.nom_periodista,
mae_periodistas.ap_periodista, mae_articulos.alto, mae_articulos.ancho,
mae_articulos.cod_articulo,
mae_articulos.ruta_imagen FROM mae_articulos, mae_medios, mae_periodistas
WHERE mae_articulos.cod_medio = mae_medios.cod_medio AND
mae_articulos.cod_periodista = mae_periodistas.cod_periodista AND
(mae_articulos.cod_articulo = 1026       // yes without the closing
parentesis


Anyone have the slightest Idea why is this ocurring.

I am new at this php, and I think my while() code is bothering....


Thanks in advance


Fernando






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to