Note that there are some explanatory texts on larger screens.

plurals
  1. POTop 15 products, need a number to show for each one, starting with 1
    primarykey
    data
    text
    <p>I'm creating a new website, I don't want to link direct to it so I'll put spaces inbetween: test . glow - sticks . org I have a list of the 15 most popular products on the right hand side of the page (WHATS HOT), I would like to show a number for each one, the first being 1 and the last being 15.</p> <p>I am a php noob, but despite reading about using range and foreach at the php manual site, I'm struggling to show numbers. I've found it easy to show the same range of numbers for each product block, e.g 1,2,3...15 showing 15 times, but this obviously isn't what I'm trying to do.</p> <p>I probably need to give more info than I have here, so I'll past the code that I'm working with on the php include:</p> <pre><code>&lt;div id="whatshot_smallblock"&gt; &lt;a href='/&lt;?=str_replace(" ","-",$productname)?&gt;.html'&gt;&lt;img src='http://www.glow-sticks.org/images/products/&lt;?=$productimage?&gt;' alt='&lt;?=$productname?&gt;' width='66' height='66' hspace="2" vspace="2" border='0' class="radius" /&gt; &lt;/a&gt; &lt;div id="whatshot_smallblock_Txt"&gt; &lt;a href='/&lt;?=str_replace(" ","-",$productname)?&gt;.html'&gt;&lt;?=$productname?&gt;&lt;/a&gt;&lt;br&gt;&lt;div id="pink_color"&gt;&lt;span class="content_2"&gt;&lt;?=$minprice_dis?&gt;&lt;/span&gt;&lt;?=$_SESSION['currsymbol']?&gt;&lt;?=$minprice?&gt;&lt;/div&gt;&lt;/div&gt; &lt;div id="bigblacknumbers"&gt;&lt;/div&gt;&lt;/div&gt; </code></pre> <p>and in my objectmanager php file I can see the code relating to the whatshot section:</p> <pre><code>//what's hot function whatshotids() { if( !isset( $this-&gt;dblink ) ) dbconnect(); //$sql = "SELECT COUNT(pid) AS repetitions, pid FROM gs_orderlines GROUP BY pid ORDER BY repetitions DESC LIMIT 15"; $timenow = time(); $checktime = ($timenow - 1814400); // 3 weeks $sql = "SELECT COUNT(pid) AS repetitions, gs_orderlines.pid FROM gs_orderlines INNER JOIN gs_orders ON gs_orders.oid = gs_orderlines.oid WHERE gs_orders.datetime &gt;= $checktime GROUP BY gs_orderlines.pid ORDER BY repetitions DESC LIMIT 15"; $result = mysql_query( $sql, $this-&gt;dblink ) or die( "Invalid query Line 1018" ); $i = 0; $whids = array(); while( $row = mysql_fetch_object( $result ) ) { //// $sql2 = "SELECT * from gs_inventory WHERE pid = ".$row-&gt;pid. " AND display_product='1' AND stock&gt;0 AND canbackstock!='yes'"; $result2 = mysql_query( $sql2, $this-&gt;dblink ); if($row2 = mysql_fetch_object( $result2 )){ $whids[$row-&gt;pid] = $row-&gt;repetitions; $i = $i + 1; } ... } ... } </code></pre> <p>Hopefully this is enough or too much information.</p> <p>Many thanks!</p>
    singulars
    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.
 

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