Jump to content

cmgmyr

Members
  • Posts

    1,278
  • Joined

  • Last visited

    Never

Posts posted by cmgmyr

  1. Hey All,

    I have a little delema that I can't figure out. I have this query currently:

    SELECT p.id, p.styleno, t1.name AS category1, t2.name as category2, t3.name as category3, p.description, p.price, p.sort 
    FROM 
    categories AS t1
    LEFT JOIN 
    categories AS t2 ON t2.parentid = t1.id
    LEFT JOIN 
    categories AS t3 ON t3.parentid = t2.id
    INNER JOIN 
    products AS p ON t3.id = p.category

     

    Now, this works great if there are 3 levels of categories, but I need this to be altered to show all of the items if there are 1, 2, or 3 levels of categories...and not just 3. Any ideas?

     

    Thanks in advance,

    -Chris

  2. Hey All,

    I'm having a little problem with exporting data from my database. The problem is that the query seems to be too much for PHP and MySQL to handle since it is timing out. Here is the query:

    SELECT p.id, p.base_no, p.style_no, t1.name AS category1, t2.name as category2, t3.name as category3, p.metal, p.description, c.name as collection, p.price, pe.b2c_desc, pe.meta_title, pe.meta_desc, pe.meta_keys, pe.alt_tag, p.site 
    		FROM 
    			categories AS t1
    		LEFT JOIN 
    			categories AS t2 ON t2.parentid = t1.id
    		LEFT JOIN 
    			categories AS t3 ON t3.parentid = t2.id
    		INNER JOIN 
    			products AS p ON t3.id = p.categories_id
    		LEFT JOIN 
    			collections AS c ON p.collection = c.id
    		LEFT JOIN 
    			products_extended AS pe ON p.style_no = pe.style_no

    The categories table is a hierarchical setup (id, parentid, name). Do you guys have any ideas about how to make this function better? Any other solutions???

     

    Thanks in advance,

    -Chris

  3. This is an update from my first post. I originally voted for 30-40k, but at the end of the year I did about 63K (little off haha). So far the first quarter of this year I've done 20+K so I look to clean up about 90+K by the end of the year. For reference here in Syracuse, NY, USA I bought a pretty good size 4 bdr house back in Jan. for 130K.

  4. I play drums mostly (as you can make out from my image), but I also play guitar, a little bass, and a little piano. Recently I have picked up and become a "Guitar Hero", but that doesn't really count...awesome game though, I wish I thought of it.

  5. So have you guys heard of these? Used them? Plan to?

     

    I've been following both of these for quite a while now and it just seems like the latest releases are very stable and ready to go for heavy development. I made a little app over the weekend and it wasn't too bad to construct. It was pretty much a small search outputted to a data grid. It came out to about 65 lines of code (just the flex)...the same thing in PHP would have been around 200 or so (or more easily).

     

    It looks like both of these will be very helpful for future development. What are your thoughts???

  6. I have a database that will eventually have to be used for english, russian, spanish, and a few other languages. Right now I'm adding the russian to it, but when it outputs to the PHP page all I get are question marks. It's showing correctly in phpMyAdmin, but not when it's echoed. Can anyone point me in the right direction?

     

    Thanks,

    -Chris

  7. you can do something like this:

    <?php 
    
    $current_hour = date('h');
    
    if($current_hour >= 17 && $current_hour <= 4){
    	//between 5pm and 4am
    	$col = 'night';
    }elseif($current_hour >= 5 && $current_hour <= 12){
    	//between 5am and 12 noon
    	$col = 'morning';
    }else{
    	$col = 'afternoon';
    }
    
    ?>

    Where $col would be whatever you named your columns, then just put that into your query

  8. some people learn by example and looking at other scripts which would probably be the best way to go for something like this. The one that i posted is a very simple example that can get anyone going, buknoii still has a lot of work to do be for he can get it into an actual site

     

    the other link that was posted is good too

  9. dwest, I think it might not have worked because of your query, try something like this:

    $sql = "SELECT something FROM your_table WHERE id = '$albumID' ORDER BY RAND() LIMIT 5";

    Just run this as a full query and not just getting the variable and see what you come up with. Putting the data into arrays (when it's already in one) will just slow you down.

     

    ...the limit will limit the amount of records returned, so in this one a max of 5 records can be returned.

×
×
  • 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.