Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8135679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:29:37+00:00 2026-06-06T10:29:37+00:00

first thread i post here. I have been searching here for answers and almost

  • 0

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

<tr>
  <td>
<?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;
  }
} ?> 
</td>
</tr>
<?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) > $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;
  }
  ?>
<tr>
<?php if($English==0){ ?>
 <td dir="rtl" align="center" colspan="3">
 <?php echo $ItemsCount; ?> <?php echo $Title; ?> <?php echo $NumOfItems; ?>
 <?php }else { ?>
 <td align="center" colspan="3">
 Currently there are <?php echo $ItemsCount." ".$Title; ?> in the catalog.Only <?php echo $NumOfItems; ?> are displayed on each page.
 <? } ?>

<? for($i=0;$i<$var;$i++) {
    echo "<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}&Page=".($i+1)."&SubCat=    {$SubCat}&lang={$Lang}\"' >".($i+1); 
    echo "</td>";
}
?> 

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:29:39+00:00Added an answer on June 6, 2026 at 10:29 am

    You seem to have forgotten curly braces {} for the if/else statements.

    EDIT: Try changing:
    <? } ?> to <? }just before for($i=0;$i<$var;$i++) {

    (You missed the php <? starting tag for the for loop.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok guys, this is my first thread, and I have searched online but with
This is my first post here. My question is similar to a previous thread
I have an application that has two threads. The first one (the main thread)
this is my first post here. First off, some background, I'm new to C#
This problem has been driving me mad. Here's the general gist: I have two
I have seen this post here (http://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state). I am having a similar problem I
I'm having a problem similar to the one discussed in this thread , but
It has been a long question, so here is the summary first, I have
I found this thread which basically has the same issue I have. But their
First one: how can I create a Thread that doesn't start right away.If I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.