Jump to content


Staff Alumni
  • Posts

  • Joined

  • Last visited

  • Days Won


Posts posted by awjudd

  1. SELECT * FROM shop s
    LEFT JOIN ( SELECT ss.shop_id, MAX(add_date) AS add_date FROM search_up ss GROUP BY shop_id ) ss ON s.id = ss.shop_id
    WHERE s.shop_region = 'kansai' AND s.publication = 'dsp' AND (s.shop_area = 'osaka')
    ORDER BY ss.add_date DESC LIMIT 0,5


    Please Note: You should never use SELECT * even if there are a large number of fields.



  2. You need to build up a list for each of the categories and then output it because you want all of the subcategories to be listed under it.


    When you go through the query results either:

    a - cycle and load all values into an array based on $array [ $row [ 'category' ] ] [] = $row [ 'sub_category' ]; then cycle through $array

    b - keep track of the current category you are in and if it changes then emit the <ul> stuff


    As for if the query is the issue, try it in something like phpMyAdmin to see.


    Hope this helps.



  3. If you have a value listed in the SET section of your UPDATE query, then it will overwrite whatever value is in there with the value you provide it.  So, if you don't want it to be changed, then you need to remove it from your SET section.


    Does that make sense?



  4. Why are you using a LEFT JOIN?  You are eliminating the need for it by having the conditions in your WHERE clause, so really you only need it to be an INNER JOIN.


    $_query = "SELECT products.sku, products.photo FROM products 
    JOIN stores ON products.store_id = stores.id 
    WHERE stores.status = 1 AND stores.visibility = 1 ORDER BY RAND() LIMIT 8";



  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.