Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From what you've written i think you are doing something like:</p> <pre><code>function holiday_hitlist($tablename, $hit_user){ /* connections etc */ while($row = mysql_fetch_array($result)) { $title = $row['title']; $url = $row['URL']; $price = "$" . $row['price']; $output = print "&lt;li&gt;&lt;a href=\"$url\" target=\"_blank\"&gt;$title&lt;/a&gt;$price&lt;/li&gt;"; } print "&lt;/ol&gt;&lt;/div&gt;"; return $output; } print holiday_hitlist("mytab","myuser"); </code></pre> <p>or maybe </p> <pre><code>$somevar = holiday_hitlist("mytab","myuser"); print $somevar; </code></pre> <p>It's really a problem with the fact that you are "printing" the returned value. In your above example why return anything? You could either;</p> <p>a) set up the function as a routine that just does something and returns nothing. (ie: just remove the <strong>return $output</strong> and the print in <strong>print holiday_hitlist()</strong>)</p> <p>or</p> <p>b) create a function that returns the data you want and then do something with it.</p> <p>An example of b) is;</p> <pre><code>function holiday_hitlist($tablename, $hit_user){ /* connections etc */ while($row = mysql_fetch_array($result)) { $title = $row['title']; $url = $row['URL']; $price = "$" . $row['price']; $output .= "&lt;li&gt;&lt;a href=\"$url\" target=\"_blank\"&gt;$title&lt;/a&gt;$price&lt;/li&gt;"; } return $output; } $somevar = holiday_hitlist("mytab","myuser"); print "&lt;div class=\'hit_list\'&gt; &lt;h3&gt;My Holiday Hitlist&lt;/h3&gt; &lt;p&gt;Five things I want the most, based on my desirability ratings.&lt;br/&gt;You can't go wrong with this stuff!&lt;/p&gt; &lt;ol&gt; $somevar &lt;/ol&gt;&lt;/div&gt;"; </code></pre> <p>The function above helps to separate the presentation (ie: the HTML) from your data. While not perfect in this example you will be able to see all your html in one block and debug it a lot easier.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload