Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

unexpected T_ELSE


lindsayanng

Recommended Posts

I am not a coder, so i am hoping some experienced eyes can take a look at this for me. I did some research on that type of error and figured the usually cause was a semi-colon that should not be there, however i do not see it.

 

It says that the error is on line 127. Here is the code from line 120-135

120<?php
121	  }
122	  if (DISPLAY_ABSTRACT_ARTICLE_LISTING == 'true' || DISPLAY_DATE_ADDED_ARTICLE_LISTING) {
123?>
124		  <tr>
125			<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
126		  </tr>
127<?php
128 }
129	} // End of listing loop
130  } else {
131?>
132		  <tr>
133			<td class="main"><?php if ($listing_no_article<>'') {
134									 echo $listing_no_article;
135								   } elseif ($topic_depth == 'articles') {

 

i really hope someone can give me a quick hand with this. THANKS

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

can someone PLEASE gimme a hand, i know this post hasnt been up long, but i am about to loose my mind reading over this code looking for the error.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

It's not a full listing so there is no way to tell but the problem appears to be with this code

128 }
129	} // End of listing loop
130  } else {

You need to match every { with a }. That might help you find it.

 

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

Or you've written yourself into a code situation like this

 

if ( WHATEVER ) {
// code here
} else {
// code here
} else {
// code here
}

The second "else {" will produce the error you're getting because it's not preceded by an open "if" clause.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

i'm sorry, i thought if i gave the few lines before and the few lines after that would be ok. Either way, thank you for your help. Here is the full code from that page.

 

I ended up adding a } before the ELSE on line 130 and it seemed to work.

 

 

<?php
/*
 $Id: article_listing.php, v1.0 2003/12/04 12:00:00 ra Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

$listing_split = new splitPageResults($listing_sql, MAX_ARTICLES_PER_PAGE);
 if (($listing_split->number_of_rows > 0) && ((ARTICLE_PREV_NEXT_BAR_LOCATION == 'top') || (ARTICLE_PREV_NEXT_BAR_LOCATION == 'both'))) {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_ARTICLES); ?></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
 }
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
 if ($listing_split->number_of_rows > 0) {
$articles_listing_query = tep_db_query($listing_split->sql_query);
?>
  <tr>
	<td class="main"><?php echo TEXT_ARTICLES; ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
while ($articles_listing = tep_db_fetch_array($articles_listing_query)) {
?>
	  <tr>
		<td valign="top" class="main" width="75%">
<?php  // osc-help.net: added class=main to the link.
 echo '<a class="main" href="' . tep_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $articles_listing['articles_id']) . '"><b>' . $articles_listing['articles_name'] . '</b></a> ';
 if (DISPLAY_AUTHOR_ARTICLE_LISTING == 'true' && tep_not_null($articles_listing['authors_name'])) {
  echo TEXT_BY . ' ' . '<a href="' . tep_href_link(FILENAME_ARTICLES, 'authors_id=' . $articles_listing['authors_id']) . '"> ' . $articles_listing['authors_name'] . '</a>';
 }
?>
		</td>
<?php
  if (DISPLAY_TOPIC_ARTICLE_LISTING == 'true' && tep_not_null($articles_listing['topics_name'])) {
?>
		<td valign="top" class="main" width="25%" nowrap><?php echo TEXT_TOPIC . ' <a href="' . tep_href_link(FILENAME_ARTICLES, 'tPath=' . $articles_listing['topics_id']) . '">' . $articles_listing['topics_name'] . '</a>'; ?></td>
<?php
  }
?>
	  </tr>
<?php

  if (DISPLAY_ABSTRACT_ARTICLE_LISTING == 'true') {
?>
	  <tr>
		<td>
<table>

<tr>
<td style="padding-left:5px" valign="top">
<img src="/images/magazin-<?php echo $articles_listing['articles_id']; ?>.jpg" alt="<?php echo $articles_listing['articles_name']; ?>" title="<?php echo $articles_listing['articles_name']; ?>">
</td>
<td class="main" style="padding-left:15px" valign="top">
<?php echo clean_html_comments(substr($articles_listing['articles_head_desc_tag'],0, MAX_ARTICLE_ABSTRACT_LENGTH)) . ((strlen($articles_listing['articles_head_desc_tag']) >= MAX_ARTICLE_ABSTRACT_LENGTH) ? '...' : ''); ?>
<br><br><font size="-3"><b>
<?php echo TEXT_DATE_ADDED . ' ' . tep_date_long($articles_listing['articles_date_added']); ?>
</td>
</tr>
<tr><td class="smalltext">
<?php echo tep_draw_separator('pixel_tr.gif', '100%', '5'); ?>
</td></tr>
</table>
</tr>


<?php
  if (DISPLAY_ABSTRACT_ARTICLE_LISTING == 'true') {
?>
	  <tr>
		<td>
<table>

<tr>
<td style="padding-left:5px" valign="top">
<img src="/images/magazin-<?php echo $articles_listing['articles_id']; ?>.jpg" alt="<?php echo $articles_listing['articles_name']; ?>" title="<?php echo $articles_listing['articles_name']; ?>">
</td>
<td class="main" style="padding-left:15px" valign="top">
<?php echo clean_html_comments(substr($articles_listing['articles_head_desc_tag'],0, MAX_ARTICLE_ABSTRACT_LENGTH)) . ((strlen($articles_listing['articles_head_desc_tag']) >= MAX_ARTICLE_ABSTRACT_LENGTH) ? '...' : ''); ?>
<br><br><font size="-3"><b>
<?php echo TEXT_DATE_ADDED . ' ' . tep_date_long($articles_listing['articles_date_added']); ?>
</td>
</tr>
<tr><td class="smalltext">

<?php echo tep_draw_separator('pixel_tr.gif', '100%', '5'); ?>
</td></tr>
</table>


	  </tr>

<?php
  }
  if (DISPLAY_ABSTRACT_ARTICLE_LISTING == 'true' || DISPLAY_DATE_ADDED_ARTICLE_LISTING) {
?>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
<?php
}
} // End of listing loop
 }} else {
?>
	  <tr>
		<td class="main"><?php if ($listing_no_article<>'') {
								 echo $listing_no_article;
							   } elseif ($topic_depth == 'articles') {
								 echo TEXT_NO_ARTICLES;
							   } elseif (isset($HTTP_GET_VARS['authors_id'])) {
								echo  TEXT_NO_ARTICLES2;
							   } ?></td>
	  </tr>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
<?php
 }
?>
	  <tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
	  </tr>
	</table></td>
  </tr>
<?php
 if (($listing_split->number_of_rows > 0) && ((ARTICLE_PREV_NEXT_BAR_LOCATION == 'bottom') || (ARTICLE_PREV_NEXT_BAR_LOCATION == 'both'))) {
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_ARTICLES); ?></td>
		<td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
	  </tr>
	</table></td>
  </tr>
<?php
 }
?>

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

I think so, THANKS.. Now i am having some other issues with the contribution. For one, when you click on the Articles Link the list of articles shows up, but it shows up TWICE.

Like here: Furry Family Articles

 

and the other issue is in the admin section where there is a place to cross sell, but when i add/remove the products, nothing happens. I know this isn't a general issue, but i have posted in the support thread and have gotten very little help.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

This I think will fix the problem of it displaying twice.

 

The FIRST line in the file that says this:

 

if (DISPLAY_ABSTRACT_ARTICLE_LISTING == 'true') {

Change it to:

 

if ( false ) {

This is only a "band-aid" as it appears to me that a portion of the code has been repeated when it shouldn't have been...

:huh:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

actually, surjer i did not implement it yet, but is it really NOT showing up twice when you click on the articles listing? I am going to change that code now to see what it will do.

 

THANKSN Jim. Your help is REALLY appreciated.. actually ANY help i can get is REALLY appreciated

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

This I think will fix the problem of it displaying twice.

 

The FIRST line in the file that says this:

 

if (DISPLAY_ABSTRACT_ARTICLE_LISTING == 'true') {

Change it to:

 

if ( false ) {

This is only a "band-aid" as it appears to me that a portion of the code has been repeated when it shouldn't have been...

:huh:

 

 

well, when i changed that line of code to what you suggested, the abstract disappeared, but i wanted it to show.. AND i get this error on the ALL ARTICLES page:

All Articles

Current Articles

1054 - Unknown column 'a.authors_id' in 'on clause'

 

select count(*) as total from articles a, articles_to_topics a2t left join topics_description td on a2t.topics_id = td.topics_id left join authors au on a.authors_id = au.authors_id, articles_description ad where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and ad.language_id = '1' and td.language_id = '1'

 

[TEP STOP]

 

link to NEW articles without abstract

furry family new articles

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Well, it wasn't what I expected..

:blink:

 

But it's different!

:lol:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

And you only changed the code in ONE PLACE.

 

Right?

:unsure:

 

The line is in there TWICE, but you should just change ONE.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

ok, i re-uploaded the file and now the articles are showing only once, but NOW i am having an issue with the ALL ARTICLES listing.

this is the error

All Articles

Current Articles

1054 - Unknown column 'a.authors_id' in 'on clause'

 

select count(*) as total from articles a, articles_to_topics a2t left join topics_description td on a2t.topics_id = td.topics_id left join authors au on a.authors_id = au.authors_id, articles_description ad where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and ad.language_id = '1' and td.language_id = '1'

 

[TEP STOP]

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

yep. i changed it in only ONE PLACE.. however THAT issue is fixed and now there is the other issue of the error on the ALL ARTICLES PAGE.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

I can't help with the last error as I can't even spell MYSQL, let alone fix any errors assocaited with it!

:(

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

ok then.. well thank you for trying and thanks for the help with the other thing.. I am also VERY VERY novice when it comes to MYSQL. In fact, friday night was the FIRST time i ever even messed with it.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Hey check the file articles.php under the boxes folder.

 

Can you verify this is what the all_articles code looks like? (Its pretty close to the bottom)

 

if (DISPLAY_ALL_ARTICLES=='true') {

if (SHOW_ARTICLE_COUNTS == 'true') {

$articles_all_query = tep_db_query("select a.articles_id from (" . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_TO_TOPICS . " a2t) left join " . TABLE_TOPICS_DESCRIPTION . " td on (a2t.topics_id = td.topics_id) left join " . TABLE_AUTHORS . " au on (a.authors_id = au.authors_id), " . TABLE_ARTICLES_DESCRIPTION . " ad where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "'");

$articles_all_count = ' (' . tep_db_num_rows($articles_all_query) . ')';

} else {

$articles_all_count = '';

}

Link to comment
Share on other sites

this is what that section of the code looks like:

 

  if (DISPLAY_ALL_ARTICLES=='true') {
if (SHOW_ARTICLE_COUNTS == 'true') {
  $articles_all_query = tep_db_query("select a.articles_id from (" . TABLE_ARTICLES . " a, " . TABLE_ARTICLES_TO_TOPICS . " a2t) left join " . TABLE_TOPICS_DESCRIPTION . " td on (a2t.topics_id = td.topics_id) left join " . TABLE_AUTHORS . " au on (a.authors_id = au.authors_id), " . TABLE_ARTICLES_DESCRIPTION . " ad where (a.articles_date_available IS NULL or to_days(a.articles_date_available) <= to_days(now())) and a.articles_id = a2t.articles_id and a.articles_status = '1' and a.articles_id = ad.articles_id and ad.language_id = '" . (int)$languages_id . "' and td.language_id = '" . (int)$languages_id . "'");
  $articles_all_count = ' (' . tep_db_num_rows($articles_all_query) . ')';
} else {
  $articles_all_count = '';
}

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

looks the same to me. Is there something wrong in the database now? its weird because it was working just fine and i never TOUCHED the code in this file.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

OK kewl - So its definately a problem in the other articles.php file. Somehow that variable isnt getting pushed through so it doesnt know what ''a.authors_id' is. I am not too good with code but might be able to track it down. problem is with me it takes ALOT longer than say a "real" developer. (Its my hobby not profession) Imma keep on looking tho!

Link to comment
Share on other sites

Hey, you can take THREE DAYS to figure it out as long as i am getting help, i am HAPPY!!

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

wow, this little bug is REALLY driving me NUTTY!!!

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

So, is that a short jaunt, or a cross-country drive?

:unsure:

 

;)

 

:lol:

 

Something here may help:

 

Click Me

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

seems like this thing is in for the long haul.. its been HOURS of me working on it.. I even left and went to my Aunt;s for dinner and i just HAD to get to the CPU to look at something else.. STILL NOTHING

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...