Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No luck with popup slideshow

Status
Not open for further replies.

DirectMe

IS-IT--Management
Jul 31, 2002
4
US
I am trying to create a popup slideshow. Everything seems to check out but no data is displayed in the popup window except for the info passed in the querystring. (ie $listingnumber in title is correct). Can anyone show me where I am going wrong? I am Stumped.

The formatting shows but no images or text. Also $id remains blank. AAAAAAAAAAAAAarggh!! What am I doing wrong??[sadeyes]

<html>
<head>
<title>Listing <? echo $listingnumber ?>Slideshow</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<style>
<!--
a {color:660000; font-family:georgia; font-size:13px; font-weight:bold}
a:hover {color:8C8C8C}
-->
</style>
</head>
<body>
<table width=&quot;95%&quot; border=&quot;0&quot; cellspacing=&quot;1&quot;>
<tr align=&quot;center&quot; valign=&quot;top&quot;>
<td>
<table width=&quot;80%&quot; border=&quot;0&quot; cellspacing=&quot;1&quot;>
<tr>
<td><div align=&quot;center&quot;><IMG SRC=&quot;<?php echo $image;?>&quot; border=&quot;1&quot; width=&quot;350&quot; height=&quot;300&quot; alt=&quot;sorry image not available&quot;></div>
</td>
</tr>
<tr>
<td><div align=&quot;center&quot;><?php echo $temp[caption][$id];?><?php echo $id; ?></div>
</td>
</tr>
<tr>
<td><div align=&quot;center&quot;>
<a href=&quot;javascript:history.back()&quot;><<<</a>
   |    <a href=&quot;view_images.php?listingnumber=<?php echo $listingnumber; ?>&id=<?php echo $id; ?>&quot;>>>></a></div>
</td>
</tr>
</table>
</td>
</tr>
</table>

<?php
$dbh=mysql_connect (&quot;HOSTNAME&quot;, &quot;USERNAME&quot;, &quot;PASSWORD&quot;) or die ('I cannot connect to the database because :'. mysql_error());
mysql_select_db (&quot;DATABASE&quot;, $dbh);
$result = @ mysql_query(&quot;SELECT caption, imgname FROM directho_.listing_images WHERE listingnumber = $listingnumber&quot;);
if ($result)
{
$rows=mysql_num_rows($result);
$temp=array();

for ($i=0; $i<$rows; $i++)
$temp[]= mysql_fetch_array($result);

$uploaddir = &quot;/listing_images/&quot; . $listingnumber . &quot;/&quot;;

if ($id==&quot;&quot;){
$id=0;
}elseif ($id==$rows){
$id=0;
}else{
$id=($id+1);
}
$image = $uploaddir.$temp
[$id];
}
else
{ print &quot;Sorry there are no pictures on this listing: $listingnumber<br><br>&quot;;
}
MYSQL_CLOSE();
?>
</body>
</html>
 
I am trying to output by echo in the table:

IMG SRC=&quot;<?php echo $image;?>&quot;
and
<?php echo $temp[caption][$id];?><?php echo $id; ?>

I know its pretty muddy code, but, I a very new to php.
 
Start at the top of your script and work your way through it.

Your script outputs some HTML. In there is a command to print $image.

Then later in your script, you actually assign $image a series value. But you do that only after you have already printed your HTML



Want the best answers? Ask the best questions: TANSTAAFL!
 
Basically, you can't print something before you fetch it from the database.

That'd mean your code could see into the future and Micro$oft would have already copied your code, patented it and sued you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top