Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Upgraded to PHP5/mySQL 5 - need help with this code block possible mysql string?


chieffan

Recommended Posts

Can't get this to display. I think it is a problem with the mysql string but not sure. Thanks

 

<?php

/*

$Id: reviews.php,v 1.37 2003/06/09 22:20:28 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- reviews //-->

<table>

<tr>

<td>

<?php

 

 

$random_select = "select r.reviews_id, r.reviews_rating, p.products_id, p.products_image, pd.products_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = r.products_id and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'";

if (isset($HTTP_GET_VARS['products_id'])) {

$random_select .= " and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'";

}

$random_select .= " order by r.reviews_id desc limit " . MAX_RANDOM_SELECT_REVIEWS;

$random_product = tep_random_select($random_select);

 

$info_box_contents = array();

 

if ($random_product) {

// display random review box

$rand_review_query = tep_db_query("select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$random_product['reviews_id'] . "' and languages_id = '" . (int)$languages_id . "'");

$rand_review = tep_db_fetch_array($rand_review_query);

 

$rand_review_text = tep_break_string(tep_output_string_protected($rand_review['reviews_text']), 10, '-<br>');

 

$info_box_contents[] = array('text' => '<div align="justify"><a class="tabhead" href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '"></a>' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br><br><div align="center"><a class="tabhead" href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . $rand_review_text . ' </a><br><br>' . tep_image(DIR_WS_IMAGES . 'stars_' . $random_product['reviews_rating'] . '.gif' , sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating'])) . '</div>');

} elseif (isset($HTTP_GET_VARS['products_id'])) {

// display 'write a review' box

$info_box_contents[] = array('text' => '<table border="0" cellspacing="0" cellpadding="2"><tr><td class="infoBoxContents3"><a class="tabhead" href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'box_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a></td></tr><tr><td class="infoBoxContents3"><a class="tabhead" href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $HTTP_GET_VARS['products_id']) . '">' . BOX_REVIEWS_WRITE_REVIEW .'</a></td></tr></table>');

} else {

// display 'no reviews' box

$info_box_contents[] = array('text' => BOX_REVIEWS_NO_REVIEWS);

}

 

new contentBox2($info_box_contents);

?>

</td>

</tr>

</table>

<!-- reviews_eof //-->

Link to comment
Share on other sites

Are you running an old version of osc and not done the patches?

 

Thanks for the reply.

 

I am using a new version of the cart hooked to the existing cart database. I had done all the patches on the existing cart but the index page and a few others would not work after the patches. The new version of the cart worked extremely well so the decision was made to use that and modify it to look like the original.

 

This file I had posted is from what I can tell a contribution but I can't find which one it was. I assume it is a mySQL problem as I saw from the patches so mySQL strings had been altered.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...