I want to display photos from a database using php and my sql...
the problem seems to be that the value of Picnum hasn't been passed
to the second script...
I know in the first script the value of picnum is correct, because I
added some echos that displayed the value..and I selected view
source and saw that in the code of the first script the value of
picnum was substituted by the id.
But the second script didn't select the pictures...
I got the picture frames empty witout the picture...(empty boxes)
if in the second script I use the $PicNum=1 instruction then I'm
able to display the first image when I entered the first script in
the browser...for these reason I know the first script executed the
second script.
do someone know what I'm doing wrong? and why I'm loosing the PicNum
value?
thanks!...
php code of first script:
albumsep23.php
<?
$usuario='xxxx';
$password='xxxx';
$my_server="localhost";
$record_ctr=0;
$dbname="album";
#entablar conexión: parametros: servidor, usuario,password
#
$conxid1=mysql_connect($my_server,$usuario,$password);
#cruds start:
mysql_select_db($dbname) or die ("unable to select db");
$result=mysql_query("SELECT * FROM fotos") or die("can't perform
query");
echo"<ul>";
while ($row=mysql_fetch_object($result))
{
echo "<IMG SRC=\"Second0923.php3?PicNum=$row->photo_id\">";
$record_ctr = $record_ctr + 1;
}
#echo "</ul>";
echo "total fotos en album.$record_ctr";
?>
-----------------------------------------------------
php code of the second script:
Second0923.php3
<?
$usuario='XXXX';
$password='XXXX';
$my_server="localhost";
$dbname="album";
#$PicNum=1;
mysql_connect($my_server,$usuario,$password) or die ("unable to
connect to sql");
@mysql_select_db($dbname) or die("unable to select db");
result=mysql_query("SELECT * from fotos where photo_id=$PicNum") or
die("error");
$row=mysql_fetch_object($result);
Header("Content-type:image/jpeg");
echo $row->photo;
?>