1

In database it shows:

-Table 1 data show discount_category_id as: 1 2 3
-Table 2 data show category_id as: ,1, ,2, ,3,

So is anything wrong or any syntax error with my code because i tried print_r but no value.

->join('LEFT', $db->quoteName('#__hikashop_discount', 'e'). ' ON (' . 
 $db->quoteName('e.discount_category_id') . ' LIKE "%' . $db-
 >quoteName('d.category_id') . '%")') 

closed as unclear what you're asking by mickmackusa, Lodder Oct 22 '18 at 15:17

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • To construct a good, clear question please provide a small SQL dump of your database tables and check your error logs. If there are any errors, you are meant to tell us -- not the other way around. See what your generated query actually looks like. Please always endeavor to progress your questions toward some type of resolution. – mickmackusa May 16 '18 at 4:47
  • Please improve this question so that future researchers will benefit from reading this page. Currently your table structures and rows are a bit unclear and your intended logic isn't clear either. We all must take care of the content that we post here as a matter of good StackExchange citizenship. – mickmackusa Jul 23 '18 at 2:48
  • Using LIKE to match values in a comma-separated string is super bad idea. LIKE is whole-number-ignorant, so if you search for 1 you will get a match if 11, 8741, or 180 (etc.) is in the csv list. Let us help you -- edit your question please. – mickmackusa Mar 2 at 4:03
0

You’re quoting your like string with “ and then quoting the int column inside with quoteName. I’m not sure it’d work even after you fix that because int columns don’t act like strings that you just concat with %. There’s a nice discussion about using int column likes here that should help. https://stackoverflow.com/questions/8422455/performing-a-like-comparison-on-an-int-field

Not the answer you're looking for? Browse other questions tagged or ask your own question.