Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

special letters sql phoenix 1075


ce7

Recommended Posts

Posted

hi

I am trying to put special with letter,
here is the code modified

	    $search = '';
    if (isset($_GET['search']) && tep_not_null($_GET['search']))
        {
        $keywords = tep_db_input(tep_db_prepare_input($_GET['search']));
        $search = "where pd.products_name like '%" . $keywords . "%'";
        }        
	  if (isset($_GET['sLetter'])) {
    $specials_name_params = 'sLetter=' . $_GET['sLetter']; //to pass onto display_links() below
    if ($_GET['sLetter'] == 'num') {
      $specials_name_filter = " where pd.products_name regexp '^[0-9]'";
    } else if (preg_match('/[A-Z]/',$_GET['sLetter'])) {
      $specials_name_filter = " where pd.products_name like '" . $_GET['sLetter'] . "%'";
    }
  }
     $specials_query_raw = "select s.specials_id, pd.products_name, pd.products_description, p.*, s.specials_new_products_price, s.status from products p, products_description pd, specials s " . $search . $specials_name_filter . " where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id order by pd.products_name";
	


and I got error message like this:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where p.products_id = pd.products_id and pd.language_id = '1' and p.products_...' at line 1

SELECT COUNT(*) AS total from products p, products_description pd, specials s where pd.products_name like 'O' where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = s.products_id

[TEP STOP]

image.thumb.png.2331aee169eb86393c476fe32ff0ec0a.png

image.thumb.png.5cf434af268b1405f4cd7c94263c6e86.png

when click on the bold letter, the error show up, how do i modified the  $specials_query_raw to make it works properly?

any help or suggestion is appreciated, thanks!

Archived

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

×
×
  • Create New...