Guest Posted February 5, 2007 Share Posted February 5, 2007 I'm doing some changes to a piece of code and apparently I've done something its not happy with see below error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #322' at line 1 here is the code I am working on/what I've been playing with! <?php //ADD SALEMAKER BOF if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $specials_products_query = tep_db_query ("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_DISPLAY_SPECIAL_PRODUCTS); } else { $specials_products_query = tep_db_query("select (p.products_id, p.products_image, p.products_tax_class_id, p.products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_SPECIAL_PRODUCTS); } //ADD SALEMAKER EOF $specials_split = new splitPageResults($specials_products_query, MAX_DISPLAY_SPECIAL_PRODUCTS); if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) { ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td> <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table></td> </tr> and <?php $row = 0; $specials_query = tep_db_query($specials_split->sql_query); while ($specials = tep_db_fetch_array($specials_query)) { //TRYING TO MAKE SPECIALS SHOW UP WITH SALEMAKER INSTEAD OF SPECIALS $special_price = tep_get_products_special_price($specials['products_id']); if ($special_price) { $products_price = '<s>' . $currencies->display_price($specials['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($special_price, tep_get_tax_rate($specials['products_tax_class_id'])) . '</span>'; } else { $products_price = $currencies->display_price($specials['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])); } $row++; // echo ' <td align="center" width="33%" class="smallText"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials['products_image'], $specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . $specials['products_name'] . '</a><br><s>' . $currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($specials['specials_new_products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</span></td>' . "\n"; //ABOVE REPLACED WITH BELOW //ADDED SALEMAKER BOF echo ' <td align="center" width="33%" class="smallText"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials['products_image'], $specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials['products_id']) . '">' . $specials['products_name'] . '</a><br><s>' . $currencies->display_price($specials['products_price'], tep_get_tax_rate($specials['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price(tep_get_products_special_price($specials['products_id']), tep_get_tax_rate($specials['products_tax_class_id'])) . '</span></td>' . "\n"; //ADDED SALEMAKER EOF if ((($row / 3) == floor($row / 3))) { ?> Sure love to hear anyone's opinion! Teresa Link to comment Share on other sites More sharing options...
♥bruyndoncx Posted February 5, 2007 Share Posted February 5, 2007 if I remember well, you only pass a sql string to the split_page_results class, not the result of a query. KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt Link to comment Share on other sites More sharing options...
Guest Posted February 5, 2007 Share Posted February 5, 2007 Is that because I took out the "raw" query than? Link to comment Share on other sites More sharing options...
Guest Posted February 5, 2007 Share Posted February 5, 2007 no, its because you're using the tep_db_query() function. You should only have the strings there and the split page results will do the rest as Carine mentioned Link to comment Share on other sites More sharing options...
Guest Posted February 17, 2007 Share Posted February 17, 2007 no, its because you're using the tep_db_query() function. You should only have the strings there and the split page results will do the rest as Carine mentioned Hi, That worked for me. Wrong: $new_query_raw = tep_db_query("SELECT foo FROM bar "); $new_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $new_query_raw, $new_query_numrows); Correct: $new_query_raw = "SELECT foo FROM bar "; $new_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $new_query_raw, $new_query_numrows); In my case, I encountered the error because I had cut and paste from a file that did not paginate the results. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.