Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /usr/home/mysite/www/htdocs/admin/categories.php on line 1580

I am in need of assistance and would appreciate help concerning the above issue. Here is my code.

    Tried to upload the code, no good. Anybody that is interested, I can send you the code, it was over 10000 characters long

      Hi adasprom,
      You don`t need to post all the code, just copy and paste the few lines of code from the place which generate the error. (line 1580 🙂)

      Please make sure when you post the code to use proper BBcodes 🙂

      Thanks,
      best regards,
      Niroshan

        I am using oscommerce, but had to copy the data into Crimson Editor to straight to the Line Number.

        The code is the following:

        if (isset($cInfo) && is_object($cInfo) && ($categories['categories_id'] == $cInfo->categories_id) ) {
                echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . ''">' . "n";
              } else {
                echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href='' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories['categories_id']) . ''">' . "n";
              }

        Thankyou for your reply

          Hi adasprom,

          I have found some escaping problems in your code. You have forgot to escape the single quotes (') with a slash.

          if (isset($cInfo) && is_object($cInfo) && ($categories['categories_id'] == $cInfo->categories_id) ) 
          {
          	echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '\'">' . "n";
          } else {
          	echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories['categories_id']) . '\'">' . "n";
          }
          

          And please next time when you post the code use the BBCodes 🙂

          Hope this helps,

          Niroshan

            You are an absolute genius, it worked. The only thing it does strange though is when you select the Catalog link, it allows me to access it, which is great, but it seems to have put an extra section on top of the Categories section, with the same amount of lines as I have categories. If this sounds confusing, I can send you a screen dump.

            Thanks once again.

              Just a small note, it leaves the letter n in those rows I spoke of. Not sure if it has to do with this section of the code:

              ['categories_id'])) . '\'">' . "n";

              Sorry about the BBCode, I'm not an experienced programmer.

                Hi adasprom,
                Im not quite sure about your requirement but Im guessing it should be "\n" (line break) not "n"

                Regards,
                niroshan

                  After making that change you suggested, looks like it casued another issue. Having an issue with the following piece of code causing me grief. I cannot access my Catalog when under Administration.

                  Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /usr/home/pencit/www/htdocs/admin/categories.php on line 1371

                  <script language="javascript">
                  <!--
                      document.write('<?php echo '<a href="javascript:popupWindow('' . tep_href_link(FILENAME_POPUP_IMAGE, 'image=' . $products_image_lrg_name) . '')">' . tep_image(DIR_WS_CATALOG_IMAGES . $products_image_name, $products_image_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . '</a>'; ?>');
                  //--></script>

                  I would appreciate any help.

                  P.S I apologise if the code is not is BBCode

                  Thankyou
                  Anthony

                    adasprom;10948629 wrote:

                    After making that change you suggested, looks like it casued another issue.

                    Fixing your error didn't cause another error, it revealed another error. :p

                    adasprom;10948629 wrote:

                    P.S I apologise if the code is not is BBCode

                    I believe you misunderstood; bbcode is the tags used by the forum to change the way something appears. For example, if you wrap your code in [noparse]

                    ...

                    [/noparse] bbcode tags, it will be easier to read and analyze since the forum adds syntax highlighting. See this FAQ for more info about PHP bbcode tags.

                    As for your problem, you've got unescaped quotes. If you're using a single quote as your string delimiter, and what a literal single quote to appear in the string, you have to prepend (or "escape") the quote with a backslash. See the manual page for [man]string[/man] for more info/examples.

                      I fixed it, with your help of course.

                      I really have to thank you guys.

                      Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou Thankyou

                        Don't forget to mark this thread resolved (if it is) using the link on the Thread Tools menu above.

                          Write a Reply...