Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Have URGENT t string error in links.php


Guest

Recommended Posts

I didn't even TOUCH these lines, but I have an error in line 55 of links.php.

 

I substituted these lines from the original file and still receive this error.

 

This is lines 54 - 58

 

// random links query
 if ($random_product = tep_random_select("select links_id,links_url,links_image_url,links_status,links_date_added  from " . TABLE_LINKS . " where links_status = '2' order by links_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
 $links_query = tep_db_query("select links_title,language_id,links_id from " .TABLE_LINKS_DESCRIPTION." where links_id = '" .$random_product['links_id']. "' and language_id = '" . (int)$languages_id . "'");
 $row = tep_db_fetch_array($links_query);
 }

 

I do see that something is substituting the $random_product = part with a product number_product = (ex: 981984_product)

 

I do not know why this started out of the blue. How do i get it to stop picking a product number and giving the error????

Link to comment
Share on other sites

I remember this happened before in another file. A friend said to substitute the $ symbol with another symbol, which will do the same job but keep the server (or whatever) from messing it up. However, I have tried all the symbols I know and none work.

 

Can anyone please help? All I was doing was adding category images and descriptions in Admin>Links Manager>Links Categories

 

The Links sections has been working just fine for months without a problem.

Link to comment
Share on other sites

Now, if you read my posts above, I do know WHAT the problem is. I just don't know HOW to fix it. And yes, it is line 55, the portion I mentioned. I know it for a fact. I just don't know HOW to keep the script from substituting $random_product with a product number. Nor do I know why it just started doing that out of the blue after months of working just fine.

 

Error message when clicking on Links in my left column (to links.php):

 

Parse error: parse error, unexpected T_STRING in /home/moonligh/public_html/catalog/links.php on line 55

 

 

File:

 

<?php
/*
 $Id: links.php,v 1.07 2005/5/28 Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// define our link functions
 require(DIR_WS_FUNCTIONS . 'links.php');

 $linkSearch = '';
 $linkFound = false;
 $action_search = (isset($_POST['action_search']) ? $_POST['action_search'] : '');
 if (tep_not_null($action_search))
 {
 $linkSearch = $_POST['links_search'];
 $link_query = tep_db_query("select l.links_id, l.links_title, lc.links_id, lc.link_categories_id from " . TABLE_LINKS_DESCRIPTION . " l, " . TABLE_LINKS_TO_LINK_CATEGORIES . " lc where l.links_id = lc.links_id AND links_title LIKE '%" . $linkSearch . "%' and language_id = '" . (int)$languages_id . "'");
 if (tep_db_num_rows($link_query) > 0)
   $linkFound = true;
 }

// calculate link category path
 if (isset($HTTP_GET_VARS['lPath'])) {
$lPath = $HTTP_GET_VARS['lPath'];
$current_category_id = $lPath;
$display_mode = 'links';
 } elseif (isset($HTTP_GET_VARS['links_id'])) {
$lPath = tep_get_link_path($HTTP_GET_VARS['links_id']);
 } else {
$lPath = '';
$display_mode = 'categories';
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LINKS);

 // links breadcrumb
 $link_categories_query = tep_db_query("select link_categories_name from " . TABLE_LINK_CATEGORIES_DESCRIPTION . " where link_categories_id = '" . (int)$lPath . "' and language_id = '" . (int)$languages_id . "'");
 $link_categories_value = tep_db_fetch_array($link_categories_query);

 if ($display_mode == 'links') {
$breadcrumb->add(NAVBAR_TITLE, FILENAME_LINKS);
$breadcrumb->add($link_categories_value['link_categories_name'], FILENAME_LINKS . '?lPath=' . $lPath);
 } else {
$breadcrumb->add(NAVBAR_TITLE, FILENAME_LINKS);
 } 

 // random links query
if (461440_product = tep_random_select("select links_id,links_url,links_image_url,links_status,links_date_added  from " . TABLE_LINKS . " where links_status = '2' order by links_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
 $links_query = tep_db_query("select links_title,language_id,links_id from " .TABLE_LINKS_DESCRIPTION." where links_id = '" .random_product['links_id']. "' and language_id = '" . (int)$languages_id . "'");
 $row = tep_db_fetch_array($links_query);
 }

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<?php
// header tags
if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {
 require(DIR_WS_INCLUDES . 'header_tags.php');
} else {
?> 
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 <title><?php echo TITLE; ?></title>
<?php
}
// eof
?>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<?php
 if ($display_mode == 'categories') {
?>
<td width="100%" valign="top"><table border="0" width="90%" cellspacing="0" cellpadding="0" align="center">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><center><?php echo HEADING_TITLE; ?></center></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '25'); ?></td>
  </tr>
  <tr>
	  <td align=middle class="index"> <a href="<?php echo tep_href_link(FILENAME_DEFAULT, '', 'NONSSL'); ?>">Home</a>  |   
	<a href="<?php echo tep_href_link(FILENAME_LINKS, '', 'NONSSL'); ?>">Link Categories</a>  |	   
	<a href="<?php echo tep_get_links_url(394225_product['links_id']); ?>" target="_blank">Featured Link</a>  |   
	<a href="<?php echo tep_href_link(FILENAME_LINKS_SUBMIT, '', 'NONSSL'); ?>">Submit New Link</a><br><br><br></td>
  </tr>

  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
<?php
$categories_query = tep_db_query("select lc.link_categories_id, lcd.link_categories_name, lcd.link_categories_description, lc.link_categories_image from " . TABLE_LINK_CATEGORIES . " lc, " . TABLE_LINK_CATEGORIES_DESCRIPTION . " lcd where lc.link_categories_id = lcd.link_categories_id and lc.link_categories_status = '1' and lcd.language_id = '" . (int)$languages_id . "' order by lcd.link_categories_name");

$number_of_categories = tep_db_num_rows($categories_query);

if ($number_of_categories > 0) {
  $rows = 0;
  while ($categories = tep_db_fetch_array($categories_query)) {
	$rows++;
	$lPath_new = 'lPath=' . $categories['link_categories_id'];
	$width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';

	echo '				<td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_LINKS, $lPath_new) . '">';

	if (SHOW_LINKS_CATEGORIES_IMAGE == 'True') {
	  if (tep_not_null($categories['link_categories_image'])) {
		echo tep_links_image(DIR_WS_IMAGES . $categories['link_categories_image'], $categories['link_categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>';
	  } else {
		echo ''; //tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', $categories['link_categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT, 'style="border: 3px double black"') . '<br>';
	  }
	}

	$categories_count_query = tep_db_query("select l.links_id, l.links_status, lc.links_id, lc.link_categories_id from " . TABLE_LINKS . " l, " . TABLE_LINKS_TO_LINK_CATEGORIES . " lc where l.links_id = lc.links_id and ( l.links_status = 2 or l.links_status = 4) and lc.link_categories_id = " . $categories['link_categories_id']);
	$linkCount = tep_db_num_rows($categories_count_query);
	echo '<br><b><u>' . $categories['link_categories_name'] . '</b></u></a><br>' . $categories['link_categories_description'] . '</td>' . "\n";
	if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
	  echo '			  </tr>' . "\n";
	  echo '			  <tr>' . "\n";
	}
  }
} else {
?>
			<td><?php new infoBox(array(array('text' => TEXT_NO_CATEGORIES))); ?></td>
<?php
}
?>
		  </tr>
		</table></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
	  <tr>

		<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
		  <tr class="infoBoxContents">
			<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>

				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>






				<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			  </tr>
			</table></td>
		  </tr>
		</table></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '60'); ?></td>
	  </tr>
	  <tr>
	   <td><?php include(DIR_WS_MODULES . FILENAME_LINK_SEARCH); ?></td>
	  </tr>
	</table></td>
  </tr>
</table></td>
<?php
 } elseif ($display_mode == 'links') {
// create column list
$define_list = array('LINK_LIST_TITLE' => LINK_LIST_TITLE,
					 'LINK_LIST_URL' => LINK_LIST_URL,
					 'LINK_LIST_IMAGE' => LINK_LIST_IMAGE,
					 'LINK_LIST_DESCRIPTION' => LINK_LIST_DESCRIPTION
					);

if (ENABLE_LINKS_COUNT == 'False') {
  $define_list['LINK_LIST_COUNT'] = LINK_LIST_COUNT;
}

asort($define_list);

$column_list = array();
reset($define_list);
while (list($key, $value) = each($define_list)) {
  if ($value > 0) $column_list[] = $key;
}

$select_column_list = '';

for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
  switch ($column_list[$i]) {
	case 'LINK_LIST_TITLE':
	  $select_column_list .= 'ld.links_title, ';
	  break;
	case 'LINK_LIST_URL':
	  $select_column_list .= 'l.links_url, ';
	  break;
	case 'LINK_LIST_IMAGE':
	  $select_column_list .= 'l.links_image_url, ';
	  break;
	case 'LINK_LIST_DESCRIPTION':
	  $select_column_list .= 'ld.links_description, ';
	  break;
	case 'LINK_LIST_COUNT':
	  if (ENABLE_LINKS_COUNT == 'False') {
		$select_column_list .= 'l.links_clicked, ';
	  } else {
		continue;
	  }
	  break;
  }
}

// show the links in a given category
// We show them all
$listing_sql = "select " . $select_column_list . " l.links_id from " . TABLE_LINKS_DESCRIPTION . " ld, " . TABLE_LINKS . " l, " . TABLE_LINKS_TO_LINK_CATEGORIES . " l2lc where ( l.links_status = '2' or l.links_status = '4' ) and l.links_id = l2lc.links_id and ld.links_id = l2lc.links_id and ld.language_id = '" . (int)$languages_id . "' and l2lc.link_categories_id = '" . (int)$current_category_id . "'";

if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
  for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
	if ($column_list[$i] == 'LINK_LIST_TITLE') {
	  $HTTP_GET_VARS['sort'] = $i+1 . 'a';
	  $listing_sql .= " order by ld.links_title";
	  break;
	}
  }
} else {
  $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
  $sort_order = substr($HTTP_GET_VARS['sort'], 1);
  $listing_sql .= ' order by ';
  switch ($column_list[$sort_col-1]) {
	case 'LINK_LIST_TITLE':
	  $listing_sql .= "ld.links_title " . ($sort_order == 'd' ? 'desc' : '');
	  break;
	case 'LINK_LIST_URL':
	  $listing_sql .= "l.links_url " . ($sort_order == 'd' ? 'desc' : '') . ", ld.links_title";
	  break;
	case 'LINK_LIST_IMAGE':
	  $listing_sql .= "ld.links_title";
	  break;
	case 'LINK_LIST_DESCRIPTION':
	  $listing_sql .= "ld.links_description " . ($sort_order == 'd' ? 'desc' : '') . ", ld.links_title";
	  break;
	case 'LINK_LIST_COUNT':
	  $listing_sql .= "l.links_clicked " . ($sort_order == 'd' ? 'desc' : '') . ", ld.links_title";
	  break;
  }
}
?>
<td width="100%" valign="top"><table border="0" width="90%" cellspacing="0" cellpadding="0" align="center">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><center><?php //echo HEADING_TITLE; ?></center></td>
<?php
// Get the right image for the top-right;-)
$image = 'silvermoon.jpg';
if ($current_category_id) {
  $image_query = tep_db_query("select lcd.link_categories_name, lc.link_categories_image from " . TABLE_LINK_CATEGORIES . " lc, " . TABLE_LINK_CATEGORIES_DESCRIPTION . " lcd where lc.link_categories_id = lcd.link_categories_id and lcd.link_categories_id = '" . (int)$current_category_id . "'");
//	$image_query = tep_db_query("select link_categories_image, link_categories_name from " . TABLE_LINK_CATEGORIES . " where link_categories_id = '" . (int)$current_category_id . "'");
  $image_value = tep_db_fetch_array($image_query);

  if (tep_not_null($image_value['link_categories_image'])) {
	$image1 = $image_value['link_categories_image'];
  }
  if (tep_not_null($image_value['link_categories_name'])) {
	$image2 = $image_value['link_categories_name'];
  }


}
?>
		<td class="pageHeading"><center><?php echo $image2; // ' ' . HEADING_TITLE; ?></center></td>

		</tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '25'); ?></td>
  </tr>
  <tr>
	  <td align=middle class="index"> <a href="<?php echo tep_href_link(FILENAME_DEFAULT, '', 'NONSSL'); ?>">Home</a>  |   
	<a href="<?php echo tep_href_link(FILENAME_LINKS, '', 'NONSSL'); ?>">Link Categories</a>  |   
	<a href="<?php echo tep_href_link(FILENAME_LINKS, '', 'NONSSL'); ?>">Most Popular</a>  |   
	<a href="<?php echo tep_href_link(FILENAME_LINKS, '', 'NONSSL'); ?>">Recent Links</a>  |  
	<a href="<?php echo tep_href_link(FILENAME_LINKS_SUBMIT, '', 'NONSSL'); ?>">Submit New Link</a></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '25'); ?></td>
  </tr>
  <tr>
	<td><?php include(DIR_WS_MODULES . FILENAME_LINK_LISTING); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>

		   <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_LINKS, '') . '">' . tep_image_button('button_categories.gif', 'Link Categories') . '</a>'; ?></td>




			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '60'); ?></td>
  </tr>
  <tr>
   <td><?php include(DIR_WS_MODULES . FILENAME_LINK_SEARCH); ?></td>
  </tr>
</table></td>
<?php
 }
?>
<!-- body_text_eof //-->

 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Link to comment
Share on other sites

error in:

461440_product

think you wanna change that to:

$461440_product

 

and $random_product is also used in the specials.php file. so it is previously defined.

if you wanna use the variable new unset($random_product) first

Link to comment
Share on other sites

This line within links.php:

// random links query
if (461440_product = tep_random_select("select

 

is originally this:

 

//random links query
if($random_product = tep_random_select("select

 

It was working perfectly with that original line, until I started added category images within Admin>Links Manager>Link Categories. Then, as I kept going to my site to view the new images and category descriptions I entered, the error started.

 

I noticed within that links.php file that that line above kept substituting in product numbers, some of which do not exist in my database as far as I can tell. I kept putting the code back to the original $random_product, but after saving the file, the code was changed again to a product number. How do I keep it from happening? Again, everything was working perfectly for months. Why all of a sudden?

 

Sorry, jdvb, I do not understand what you mean by your solution. Why change something that had been working fine for months?

Link to comment
Share on other sites

Change these two lines (55 and 56)

if (461440_product = tep_random_select("select links_id,links_url,links_image_url,links_status,links_date_added  from " . TABLE_LINKS . " where links_status = '2' order by links_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
 $links_query = tep_db_query("select links_title,language_id,links_id from " .TABLE_LINKS_DESCRIPTION." where links_id = '" .random_product['links_id']. "' and language_id = '" . (int)$languages_id . "'");

to this

if ($random_product = tep_random_select("select links_id,links_url,links_image_url,links_status,links_date_added  from " . TABLE_LINKS . " where links_status = '2' order by links_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
 $links_query = tep_db_query("select links_title,language_id,links_id from " .TABLE_LINKS_DESCRIPTION." where links_id = '" .$random_product['links_id']. "' and language_id = '" . (int)$languages_id . "'");

Then change line 110 from

	   <a href="<?php echo tep_get_links_url(394225_product['links_id']); ?>" target="_blank">Featured Link</a>  |

to

		<a href="<?php echo tep_get_links_url($random_product['links_id']); ?>" target="_blank">Featured Link</a>  |

That should get the code working. If there is a problem on the server or in some other code that is randomly changing the code though, it will happen again.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Jack,

 

THANK YOU SO MUCH!

 

I did keep fixing the first $random_product, but it just kept doing it's own thing. I did NOT know about the one for the featured product link.

 

That fixed it. What gets me, everything was fine for months, until I decided to start adding category images and descriptions for the link categories. Then BAM! *shrugs*

 

Again, thank you!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...