function holiday_hitlist($tablename, $hit_user){ global $host, $user, $pass, $dbname; $link = mysql_connect($host, $user, $pass, $dbname); print '<div class=\'hit_list\'> <h3>My Holiday Hitlist</h3> <p>Five things I want the most, based on my desirability ratings.<br/>You can't go wrong with this stuff!</p> <ol>'; $sql = 'SELECT title, URL, price FROM $dbname.$tablename WHERE user='$hit_user' AND rank >= 3 ORDER BY date DESC LIMIT 5'; $result = mysql_query($sql) or die ('Couldn't retrieve holiday hit list for this user. ' . mysql_error()); while($row = mysql_fetch_array($result)) { $title = $row['title']; $url = $row['URL']; $price = '$' . $row['price']; $output = print '<li><a href=\'$url\' target=\'_blank\'>$title</a> $price</li>'; } print '</ol></div>'; return $output; }
On an HTML page, it puts the ‘1’ immediately following the closing div tag. Why?
See the line
you should probably remove the print after the $output =
Or maybe you just need to remove the $output =
I am not quite sure what you intend.
To explain, $output is getting the return value of print ‘…’