GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 18-Jun-2008, 09:58
sp00ky sp00ky is offline
New Member
 
Join Date: Jun 2008
Posts: 14
sp00ky is on a distinguished road

Unexpected T_ENCAPSED_AND_WHITESPACE


Hi, I have just built a web store using oscommerce, everything was good until I wanted to install a new feature for my products (tabs).

I have installed it and it seems to be working on my website, but I keep getting an error when I try to go into an area to add my products. The error i get is:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in html/catalog/admin/categories.php on line 516


this the php files from line 500 to 530:

PHP Code:

$check = tep_db_fetch_array($check_query);
              if ($check['total'] < '1') {
                tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");
              }
            } else {
              $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');
            }
          } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
            $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
            $product = tep_db_fetch_array($product_query);

            tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6,
 products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']). "', '" . tep_db_input($product['products_image_med']) . "', '" . tep_db_input($product['products_image_lrg']) . "', '" . tep_db_input($product['products_image_sm_1']) . "', '" . tep_db_input($product['products_image_xl_1']) . "', '" . tep_db_input($product['products_image_sm_2']) . "', '" . tep_db_input($product['products_image_xl_2']) . "', '" . tep_db_input($product['products_image_sm_3']) . "', '" . tep_db_input($product['products_image_xl_3']) . "', '" . tep_db_input($product['products_image_sm_4']) . "', '" . tep_db_input($product['products_image_xl_4']) . "', '" . tep_db_input($product['products_image_sm_5']) . "', '" . tep_db_input($product['products_image_xl_5']) . "', '" . tep_db_input($product['products_image_sm_6']) . "', '" . tep_db_input($product['products_image_xl_6'])
 . "', '" . tep_db_input($product['products_price']) . "',  now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
            $dup_products_id = tep_db_insert_id();

            $description_query = tep_db_query("select language_id, products_name, products_description, products_spec, products_musthave, products_extraimage, products_manual, products_extra1, products_moreinfo, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");
            while ($description = tep_db_fetch_array($description_query)) {
              tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', tep_db_input($description['products_spec']) . "', '" . tep_db_input($description['products_musthave']) . "', '" . tep_db_input($description['products_extraimage']) . "', '" . tep_db_input($description['products_manual']) . "', '" . tep_db_input($description['products_extra1']) . "', '" . tep_db_input($description['products_moreinfo']) . "', '" . tep_db_input($description['products_url']) . "', '0')");
            }

            tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");
            $products_id = $dup_products_id;
          }

          if (USE_CACHE == 'true') {
            tep_reset_cache_block('categories');
            tep_reset_cache_block('also_purchased');
          }
        } 



if someone could please run through the code and see if they can find the error and tell me how to change it to fix it, that will be great! It is getting very annoying, I cant figure it out....so plz help

thanks
  #2  
Old 18-Jun-2008, 10:15
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,140
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: can someone plz help fix error in php?!?!? plzzz


Look at the syntax highlighting in the post.

It appears that the string "gets lost" at the statement inside the while-loop, after this point:
PHP Code:

tep_db_input($description['products_description']) 


__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #3  
Old 18-Jun-2008, 11:27
sp00ky sp00ky is offline
New Member
 
Join Date: Jun 2008
Posts: 14
sp00ky is on a distinguished road

Re: can someone plz help fix error in php?!?!? plzzz


Thanks for your reply TurboPT, I am not too great with php, any ideas of how I can fix it? ....any1?

thanks


Quote:
Originally Posted by TurboPT
Look at the syntax highlighting in the post.

It appears that the string "gets lost" at the statement inside the while-loop, after this point:
PHP Code:

tep_db_input($description['products_description']) 


  #4  
Old 18-Jun-2008, 11:41
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,140
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: can someone plz help fix error in php?!?!? plzzz


hint: What's missing with the concatenation, just after that point?
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #5  
Old 18-Jun-2008, 11:55
sp00ky sp00ky is offline
New Member
 
Join Date: Jun 2008
Posts: 14
sp00ky is on a distinguished road

Re: can someone plz help fix error in php?!?!? plzzz


LOL! ok I think I fixed it... I added '" . at the end of:

tep_db_input($description['products_description']) . "',

but now I get another error:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in html/catalog/admin/categories.php on line 515

come on give give me a hint for this one
  #6  
Old 18-Jun-2008, 13:35
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,140
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Unexpected T_ENCAPSED_AND_WHITESPACE


Post the updated code, and let's see what the syntax tells us.

That seems like the same area, and it may be complaining about the extra single quote characters after this:
PHP Code:

tep_db_input($description['products_url']) 


__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #7  
Old 18-Jun-2008, 16:36
sp00ky sp00ky is offline
New Member
 
Join Date: Jun 2008
Posts: 14
sp00ky is on a distinguished road

Re: Unexpected T_ENCAPSED_AND_WHITESPACE


heres the code after first change (line from 500 to 529):

PHP Code:

$check = tep_db_fetch_array($check_query);
              if ($check['total'] < '1') {
                tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");
              }
            } else {
              $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');
            }
          } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {
            $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
            $product = tep_db_fetch_array($product_query);

            tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6,
 products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']). "', '" . tep_db_input($product['products_image_med']) . "', '" . tep_db_input($product['products_image_lrg']) . "', '" . tep_db_input($product['products_image_sm_1']) . "', '" . tep_db_input($product['products_image_xl_1']) . "', '" . tep_db_input($product['products_image_sm_2']) . "', '" . tep_db_input($product['products_image_xl_2']) . "', '" . tep_db_input($product['products_image_sm_3']) . "', '" . tep_db_input($product['products_image_xl_3']) . "', '" . tep_db_input($product['products_image_sm_4']) . "', '" . tep_db_input($product['products_image_xl_4']) . "', '" . tep_db_input($product['products_image_sm_5']) . "', '" . tep_db_input($product['products_image_xl_5']) . "', '" . tep_db_input($product['products_image_sm_6']) . "', '" . tep_db_input($product['products_image_xl_6'])
 . "', '" . tep_db_input($product['products_price']) . "',  now(), " . (empty($product['products_date_available']) ? "null" : "'" . tep_db_input($product['products_date_available']) . "'") . ", '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");
            $dup_products_id = tep_db_insert_id(); $description_query = tep_db_query("select language_id, products_name, products_description, products_spec, products_musthave, products_extraimage, products_manual, products_extra1, products_moreinfo, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'"); while ($description = tep_db_fetch_array($description_query)) {
tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_spec, products_musthave, products_extraimage, products_manual, products_extra1, products_moreinfo, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description 'products_description']) . "', '" . tep_db_input($description['products_spec']) . "', '" . tep_db_input($description['products_musthave']) . "', '" . tep_db_input($description['products_extraimage']) . "', '" . tep_db_input($description['products_manual']) . "', '" . tep_db_input($description['products_extra1']) . "', '" . tep_db_input($description['products_moreinfo']) . "', '" . tep_db_input($description['products_url']) . "', '0')");}
            tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");
            $products_id = $dup_products_id;
          }

          if (USE_CACHE == 'true') {
            tep_reset_cache_block('categories');
            tep_reset_cache_block('also_purchased');
          }
        }

        tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));
        break;
      case 'new_product_preview':
// copy image only if modified 






Quote:
Originally Posted by TurboPT
Post the updated code, and let's see what the syntax tells us.

That seems like the same area, and it may be complaining about the extra single quote characters after this:
PHP Code:

tep_db_input($description['products_url']) 


  #8  
Old 18-Jun-2008, 19:53
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,140
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Unexpected T_ENCAPSED_AND_WHITESPACE


What's wrong with this picture?
PHP Code:

tep_db_input($description 'products_description']) 


__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #9  
Old 19-Jun-2008, 02:30
sp00ky sp00ky is offline
New Member
 
Join Date: Jun 2008
Posts: 14
sp00ky is on a distinguished road

Re: Unexpected T_ENCAPSED_AND_WHITESPACE


Ok got that, added [ in front of 'products_description'])..... getting another error now :

PHP Code:

Parse error: parse error, unexpected T_ECHO, expecting ']' in html/catalog/admin/categories.php on line 1392 



and here is the code, lines between 1378 to 1423:

PHP Code:

<?php
/* Re-Post all POST'ed variables */
      reset($HTTP_POST_VARS);
      while (list($key, $value) = each($HTTP_POST_VARS)) {
        if (!is_array($HTTP_POST_VARS[$key])) {
          echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
        }
      }
      $languages = tep_get_languages();
      for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
        echo tep_draw_hidden_field('products_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_name[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_description[$languages[$i]

// Product Tabs 2.0 Start
        echo tep_draw_hidden_field('products_spec[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_spec[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_musthave[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_musthave[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_extraimage[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_extraimage[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_manual[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_manual[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_extra1[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_extra1[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_moreinfo[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_moreinfo[$languages[$i]['id']])));
// Product Tabs 2.0 End


['id']])));
      echo tep_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']])));
      }
      echo tep_draw_hidden_field('products_image', stripslashes($products_image_name));

// Product Tabs 2.0 Start
//BOF UltraPics
      echo tep_draw_hidden_field('products_image_med', stripslashes($products_image_med_name));
      echo tep_draw_hidden_field('products_image_lrg', stripslashes($products_image_lrg_name));
      echo tep_draw_hidden_field('products_image_sm_1', stripslashes($products_image_sm_1_name));
      echo tep_draw_hidden_field('products_image_xl_1', stripslashes($products_image_xl_1_name));
      echo tep_draw_hidden_field('products_image_sm_2', stripslashes($products_image_sm_2_name));
      echo tep_draw_hidden_field('products_image_xl_2', stripslashes($products_image_xl_2_name));
      echo tep_draw_hidden_field('products_image_sm_3', stripslashes($products_image_sm_3_name));
      echo tep_draw_hidden_field('products_image_xl_3', stripslashes($products_image_xl_3_name));
      echo tep_draw_hidden_field('products_image_sm_4', stripslashes($products_image_sm_4_name));
      echo tep_draw_hidden_field('products_image_xl_4', stripslashes($products_image_xl_4_name));
      echo tep_draw_hidden_field('products_image_sm_5', stripslashes($products_image_sm_5_name));
      echo tep_draw_hidden_field('products_image_xl_5', stripslashes($products_image_xl_5_name));
      echo tep_draw_hidden_field('products_image_sm_6', stripslashes($products_image_sm_6_name));
      echo tep_draw_hidden_field('products_image_xl_6', stripslashes($products_image_xl_6_name));
//EOF UltraPics
// Product Tabs 2.0 End



EDIT: Fixed above error by adding ]))); after:

[PHP($products_description[$languages[$i][/php]
  #10  
Old 19-Jun-2008, 03:32
sp00ky sp00ky is offline
New Member
 
Join Date: Jun 2008
Posts: 14
sp00ky is on a distinguished road

unexpected '[' in html/catalog/admin/categories.php on line 1401


cant fix this one now:

PHP Code:

Parse error: parse error, unexpected '[' in html/catalog/admin/categories.php on line 1401 



same, line from 1378 to 1423:

PHP Code:

<?php
/* Re-Post all POST'ed variables */
      reset($HTTP_POST_VARS);
      while (list($key, $value) = each($HTTP_POST_VARS)) {
        if (!is_array($HTTP_POST_VARS[$key])) {
          echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
        }
      }
      $languages = tep_get_languages();
      for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
        echo tep_draw_hidden_field('products_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_name[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_description[$languages[$i]])));

// Product Tabs 2.0 Start
        echo tep_draw_hidden_field('products_spec[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_spec[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_musthave[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_musthave[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_extraimage[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_extraimage[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_manual[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_manual[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_extra1[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_extra1[$languages[$i]['id']])));
        echo tep_draw_hidden_field('products_moreinfo[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_moreinfo[$languages[$i]['id']])));
// Product Tabs 2.0 End


['id']])));
      echo tep_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']])));
      }
      echo tep_draw_hidden_field('products_image', stripslashes($products_image_name));

// Product Tabs 2.0 Start
//BOF UltraPics
      echo tep_draw_hidden_field('products_image_med', stripslashes($products_image_med_name));
      echo tep_draw_hidden_field('products_image_lrg', stripslashes($products_image_lrg_name));
      echo tep_draw_hidden_field('products_image_sm_1', stripslashes($products_image_sm_1_name));
      echo tep_draw_hidden_field('products_image_xl_1', stripslashes($products_image_xl_1_name));
      echo tep_draw_hidden_field('products_image_sm_2', stripslashes($products_image_sm_2_name));
      echo tep_draw_hidden_field('products_image_xl_2', stripslashes($products_image_xl_2_name));
      echo tep_draw_hidden_field('products_image_sm_3', stripslashes($products_image_sm_3_name));
      echo tep_draw_hidden_field('products_image_xl_3', stripslashes($products_image_xl_3_name));
      echo tep_draw_hidden_field('products_image_sm_4', stripslashes($products_image_sm_4_name));
      echo tep_draw_hidden_field('products_image_xl_4', stripslashes($products_image_xl_4_name));
      echo tep_draw_hidden_field('products_image_sm_5', stripslashes($products_image_sm_5_name));
      echo tep_draw_hidden_field('products_image_xl_5', stripslashes($products_image_xl_5_name));
      echo tep_draw_hidden_field('products_image_sm_6', stripslashes($products_image_sm_6_name));
      echo tep_draw_hidden_field('products_image_xl_6', stripslashes($products_image_xl_6_name));
//EOF UltraPics
// Product Tabs 2.0 End

 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML Form to PHP File - Help Requested vigilantweather MySQL / PHP Forum 15 07-Aug-2006 20:22
PHP - sizes and generation times cable_guy_67 MySQL / PHP Forum 3 29-Sep-2005 09:26
Help ! I need help starting up on Php ! onauc MySQL / PHP Forum 11 05-Jan-2005 00:57
PHP in HTML jrobbio Web Design Forum 4 24-Jul-2003 07:05
All the big PHP script collections that matter jrobbio MySQL / PHP Forum 5 06-Jun-2003 17:14

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 21:08.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.