it runs three times because there are three rows of data and you are setting the same thing for each set of data.

try this

$sql="select * from hotspots";
$result = mysql_query($sql);
$x = 1;

while ( $row = mysql_fetch_array($result))
        printf("<p><img src=\"hotspots/latest$x.gif\" alt=\"%s\"
title=\"%s\"></p><p class=\"footnote\">%s</p>", $row["alt-text"],
$row["title-text"], $row["desc-text"]);


From: Chip Wiegand <[EMAIL PROTECTED]>
To: "PHP DB" <>
Subject: [PHP-DB] odd results when running this
Date: Fri, 28 Jan 2005 07:41:30 -0800

Okay, so I have got the php bits working in this web page but it is
running 3 times every time the page loads, and I see no reason why (I have
opened this page in two differant browsers). The code for the entire page
is pasted below, it includes some calls to include files which are not
included in this message of course (and this file is itself included in
another file), the page can be seen at this address:
If anyone can see any reason for the script to run 3 times please let me
<table width="100%" border="0" cellpadding="5" cellspacing="0"
summary="table that contains the body of the page">
<div align="top">
<p class="welcome">Welcome to Simrad, Inc</p>
<p class="paratext">
Simrad is one of the world's largest manufacturers of marine electronics
for the yachting,
fishery and commercial marine markets, offering sales and service
worldwide. A complete
range of products from Simrad is available for many different types of
marine activity,
including auto steering, navigation, hydro acoustic and communication
equipment. Ranging
from pleasure boating, through fishing and into commercial craft. Please
select the type
of activity that you are interested in using the links on the left.
<br /><br /><br />
<p class="paratext">Read <a
href="SimradNews/Spring2004/SimradNews-p1.html" target="_new"><span
class="red">Simrad</span><span class="blue">News</span></a> - Your
quarterly guide to today's marine electronics (opens in a new window)<br
<!-- Or download the .pdf version <a
href="SimradNews/Spring2004/SimradNews.php">here</a> (765Kbytes) --></p>
<br />
<p class="c2"><img src="images/sim-net-icon.gif" alt="ANNOUNCING THE NEW
SIMNET NETWORK" border="0" title="SAWDUST helm - all Simrad products"
<a href="#"
 onmouseover="window.status='ANNOUNCING THE NEW SIMNET NETWORK';return
onmouseout="window.status='ANNOUNCING THE NEW SIMNET NETWORK'; return
 title="Read more about the SimNet" class="special-links"><em>ANNOUNCING
<td><br />
<p class="title">What's New</p>
$sql="select * from hotspots";
$result = mysql_query($sql);
while ( $row = mysql_fetch_array($result))
         printf("<p><img src=\"hotspots/latest1.gif\" alt=\"%s\"
title=\"%s\"></p><p class=\"footnote\">%s</p>", $row["alt-text"],
$row["title-text"], $row["desc-text"]);
   printf("<p><img src=\"hotspots/latest2.gif\" alt=\"%s\"
title=\"%s\"></p><p class=\"footnote\">%s</p>", $row["alt-text"],
$row["title-text"], $row["desc-text"]);
   printf("<p><img src=\"hotspots/latest3.gif\" alt=\"%s\"
title=\"%s\"></p><p class=\"footnote\">%s</p>", $row["alt-text"],
$row["title-text"], $row["desc-text"]);
<table summary="company blurb" align="center" border="0" cellspacing="0"
cellpadding="10" width="80%">
<td colspan="2">
<div class="co-blurb">
<hr width="75%" />
<p class="paratext"><a href="contact/simradbackground.php"
onmouseover="window.status='Some Background information about
Simrad';return true;"
title="Some Background information about Simrad"
class="special-links">Simrad</a> has built its name on
products which do what they are designed to do, whatever the conditions.
As part of <a
onmouseover="window.status='The Kongsberg Maritime Corporate Home
Page';return true;"
title="Our corporate parent company home page" target="_blank"
class="special-links">Kongsberg Maritime</a>, the largest
manufacturer of marine electronics in the world, Simrad manufactures
products which are
developed and built on the same principles as the company's sophisticated
for the demanding commercial shipping and fisheries market.</p>

PHP Database Mailing List (
To unsubscribe, visit:

-- PHP Database Mailing List ( To unsubscribe, visit:

Reply via email to