hi. I have this function in a file:
<?php
// set of previous functions...
function comment()
{
$conn = db_connect();
$s_sql = "select * from imagesdb where id = '$imageid'";
$s_result = mysql_query($s_sql, $conn);
if (mysql_num_rows($s_result))
{
$s = mysql_fetch_array($s_result);
}
echo "hola";
echo $imageid;
echo $s[poster];
?>
// some html
<?php
}
?>
my browser returns no errors to me but the query doesn't happen, i mean it returns no result (blank page)
because I am new in php, I think my mistake is with $imageid maybe not making it as global or something... I tried so but I got parse errors.
the function that displays content including the initial $imageid is:
<?php
function display_content()
{
echo "<p align='center'><font face='Arial, Helvetica, sans-serif' size=4><b>Image gallery</b></font></p>";
$conn = db_connect();
$s_sql = "select * from imagesdb order by image asc LIMIT 0 , 5";
$s_result = mysql_query($s_sql, $conn);
if (mysql_num_rows($s_result))
{
$s = mysql_fetch_array($s_result);
}
?>
<p>
<table width='99%' border='1' cellspacing='0' cellpadding='5'>
<p><a href="javascript:popUp('comment.php?imageid=<? echo $s[id]; ?>')"><img src="images/images/<? echo $s[poster]; ?>" width="94" height="140"></a></p>
<p><font face="Arial, Helvetica, sans-serif" size=2><b><? echo $s[image]; ?></b></font></p>
<p><font face="Arial, Helvetica, sans-serif" size=2><b>Genre:</b> <? echo $s[genre]; ?></font></p>
<input type=hidden name="imageid" value="<?php echo $s[id]; ?>">
<?php
// etc...........
?>
where as you can see I included:
<input type=hidden name="imageid" value="<?php echo $s[id]; ?>">
to send $imageid to the comment() function's query, but I don't know what's wrong with it.
Can anyone help me on this ? thanks.