Note that there are some explanatory texts on larger screens.

plurals
  1. POSyntax error, unexpected $end In for loop
    primarykey
    data
    text
    <p>first thread i post here. I have been searching here for answers and almost always got them. But this one is a slightly different. I have this php code snippet</p> <pre><code>&lt;tr&gt; &lt;td&gt; &lt;?php if (mysql_numrows($sqlstr) != 0) { //if there are records found while ($row = mysql_fetch_array($sqlstr)) { //do while there are rows if($English==1) $Title=$row["sSubCatEng"]; else $Title=$row["sSubCat"]; echo $Title; } } ?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php $NumOfItems= 9; //Number of items per page. $ItemsCount=count($ItemPartID); //number of items in ItemPartID array $Page = $_GET["Page"]; //puts the var in a local one if(($NumOfItems*$Page) &gt; $ItemsCount) // if it is the last page { $StopFor = $ItemsCount % $NumOfItems; //stop when you modulo $j = ($NumOfItems*($Page - 1)); $indexFor = $StopFor; } else { $StopFor = $NumOfItems * $Page; $j =($NumOfItems*($Page - 1)); $indexFor = $StopFor - $j; } ?&gt; &lt;tr&gt; &lt;?php if($English==0){ ?&gt; &lt;td dir="rtl" align="center" colspan="3"&gt; &lt;?php echo $ItemsCount; ?&gt; &lt;?php echo $Title; ?&gt; &lt;?php echo $NumOfItems; ?&gt; &lt;?php }else { ?&gt; &lt;td align="center" colspan="3"&gt; Currently there are &lt;?php echo $ItemsCount." ".$Title; ?&gt; in the catalog.Only &lt;?php echo $NumOfItems; ?&gt; are displayed on each page. &lt;? } ?&gt; &lt;? for($i=0;$i&lt;$var;$i++) { echo "&lt;td style='width:30px;height:30px;border-color:black;border-style:solid;border- width:1px;background-color: lightgray;font-weight: bold;text-align: center;"; if($Page==($i+1)) echo "color:red;"; echo "' onmouseover=\"this.style.cursor = 'pointer';\" onmousemove=\"this.style.backgroundColor = 'red';this.style.color='white';\" onmouseout=\"this.style.backgroundColor='lightgray';"; if($Page==($i+1)) echo "this.style.color='red';"; else echo "this.style.color='black';"; echo "\" onClick='window.location=\"Catalog.php?Cat={$Category}&amp;Page=".($i+1)."&amp;SubCat= {$SubCat}&amp;lang={$Lang}\"' &gt;".($i+1); echo "&lt;/td&gt;"; } ?&gt; </code></pre> <p>It's a little messy ,i just don't know how to add code snippets. I have done some debugging and got that the 1st line (the line of the for) is the prob, yet I can't find the problem. (i replaced $var with 1 and it still didn't help). Thank you.</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