Jump to content

sloth456

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

Posts posted by sloth456

  1. Can you please post the contents of iframe.php, also a link to view in the browser would be useful but not essential.

     

    The code you have posted has a drop down, but no 'submit' button to click and update the iframe.  You can either include a submit button or use javascript to automatically detect when the drop down changes and reload the iframe.

     

    If you can show us the code iframe.php and give us a link to the page you are trying to change this should be pretty easy to solve.

  2. Ok here are my real tables, obviously not all my rows, because that would be massive.

     

    catalog_product_entity:

     

    Contains my product SKU's and an entity_id which is used to relate to other tables.  I want to select all rows WHERE type_id=simple (there are other types not shown here)

     

    entity_identity_type_idattribute_set_idtype_idskuhas_optionsrequired_optionscreated_atupdated_at

    7 4 10 simple 30019472 0 0 2011-11-17 13:15:13 2011-11-26 13:11:19

    8 4 10 simple 30019471 0 0 0000-00-00 00:00:00 2011-11-26 13:11:19

    9 4 10 simple 30019470 0 0 2011-11-17 13:15:13 2011-11-26 13:11:19

    10 4 10 simple 30019469 0 0 0000-00-00 00:00:00 2011-11-26 13:11:20

    11 4 10 simple 30019468 0 0 0000-00-00 00:00:00 2011-11-26 13:11:21

     

     

    catalog_product_entity_decimal:

     

    Once I have selected all products and there ids I need to go to this table  and pull out value WHERE entity_id=catalog_product_entity.id AND attribute_id=67 (price) AND store_id=0 (there are other rows not shown here)

     

    value_identity_type_idattribute_idstore_identity_idvalue

    21 4 67 0 7 209.95

    22 4 72 0 7 500

     

    catalog_product_entity_varchar:

     

    SELECT value WHERE entity_id=catalog_product_entity.id AND attribute_id=134 (subtitle) OR attribute_id=146 (brand) AND store_id=0

     

    value_identity_type_idattribute_idstore_identity_idvalue

    234 4 134 0 7 Black, 10-Speed, Medium Cage

    235 4 146 0 7 Sram

     

    cataloginventory_stock_item:

     

    This is a table with a lot of columns that aren't important to us.  We just want to select  'qty' WHERE product_id=catalog_product_entity.id

     

    item_id product_id stock_id qty min_qty use_config_min_qty backorders use_config_backorders min_sale_qty use_config_min_sale_qty max_sale_qty use_config_max_sale_qty is_in_stock low_stock_date notify_stock_qty use_config_notify_stock_qty manage_stock use_config_manage_stock stock_status_changed_auto use_config_qty_increments qty_increments use_config_enable_qty_inc enable_qty_increments

    7 7 1 1 0 1 0 0 1 1 0 1 1 NULL 0 1 0 1 0 1 0 1 0

    8 8 1 1 0 1 0 0 1 1 0 1 1 NULL 0 1 0 1 0 1 0 1 0

     

     

    The tables are too large to post in their entirety, so if you want to inspect further I can provide sql exports for these tables.

     

    Thanks again for all your help so far.

  3. Managed to figure it out with a bit of googling.  Seems I needed to increase the size limits on my tmp directory.

     

    The query half works.  Here is the first row pulled off

     

    Array (

    [0] => 30019472

    [sku] => 30019472

    [1] => 1.0000

    [qty] => 1.0000

    [2] => 209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500

    [Price] => 209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500,209.9500

    [3] => Sram ,Sram ,Sram

    [brand] => Sram ,Sram ,Sram

    [4] => Black, 10-Speed, Medium Cage,Black, 10-Speed, Medium Cage,Black, 10-Speed, Medium Cage,Black, 10-Speed, Medium Cage,Black, 10-Speed, Medium Cage,Black, 10-Speed, Medium Cage

    [subtitle] => Black, 10-Speed, Medium Cage,Black, 10-Speed, Medium Cage,Black, 10-Speed, Medium Cage,Black, 10-Speed, Medium Cage,Black, 10-Speed, Medium Cage,Black, 10-Speed, Medium Cage

    )

     

    All the data seems to be correct, but I can't figure out why the same data has been grabbed over and over for price,brand and subtitle.

  4. Thanks for the replies guys.

     

    So far I've tried the second solution which shows an error I've never seen before.

     

    Here's my sql statement

     

    SELECT catalog_product_entity.sku,cataloginventory_stock_item.qty,
    	GROUP_CONCAT(IF(catalog_product_entity_decimal.attribute_id = '67',catalog_product_entity_decimal.value,NULL)) AS 'Price',
    	GROUP_CONCAT(IF(catalog_product_entity_varchar.attribute_id = '146',catalog_product_entity_varchar.value,NULL)) AS 'Brand',
    	GROUP_CONCAT(IF(catalog_product_entity_varchar.attribute_id = '134',catalog_product_entity_varchar.value,NULL)) AS 'Subtitle'
    FROM catalog_product_entity
    	JOIN cataloginventory_stock_item ON catalog_product_entity.entity_id = cataloginventory_stock_item.product_id
    	JOIN catalog_product_entity_decimal ON catalog_product_entity.entity_id = catalog_product_entity_decimal.entity_id
                    JOIN catalog_product_entity_varchar ON catalog_product_entity.entity_id = catalog_product_entity_varchar.entity_id
    GROUP by catalog_product_entity.entity_id
    

     

    Its a fair bit more complex than my example but its the same principle.  I actually have to gather data from 4 tables in total. 

     

    - catalog_product_entity is my 'table1' it has an 'entity_id' column which relates to all the other tables.  It also stores an SKU column against these ids that I need.

     

    - cataloginventory_stock_item contains the product stock level in a column named 'qty', it has an id column that matches the table1.entity_id (product_id)

     

    - catalog_product_entity_decimal this table looks like table2 in my example, except the 'attribute_id' is a number not a code, 67 means price

     

    - catalog_product_entity_varchar contains a brand and a subtitle, its just like my table2 example.  146 is brand and 134 is subtitle.

     

    The error that I get is this

     

    Incorrect key file for table '/tmp/#sql_3d9c_0.MYI'; try to repair it.

  5. I'm not too hopeful there is a solution for this but here goes

     

    This is a simplified version of my tables

     

    Table 1

     

    id

    product_name

    1

    jersey

    2

    trousers

     

    Table 2

     

    product_idattribute_codevalue

    1price95

    1brandmamut

    2price105

    2brandarcteryx

     

    Is it possible to use a single SQL statement such that my result set looks something like this

     

    idnamebrandprice

    1jerseymammut95

    2trousersarcteryx105

     

    I thought about using JOIN, but I think with join you can only add seperate columns with different names.  In this example, there is only 1 column 'attribute_code' which needs to be joined on twice so that one column becomes 'price' and another 'brand'.

     

    Something like

     

    JOIN table2.attribute_code ON table1.id=table2.product_id WHERE table2.attribute_code = 'brand'
    JOIN table2.attribute_code ON table1.id=table2.product_id WHERE table2.attribute_code = 'price'
    

     

    But I don't think it would work.  I think I may have to achieve this with more than 1 query :(, but this is slow when I go through 4,000 records and each has 2 attributes.

     

    Thanks to whoever has anything to say about this.

  6. Starting from the first line its starts out like this

     

    `brand` (1,'No Brand','No Brand','no-brand.jpg',0,NULL),(2,'686','686','686.jpg',0,NULL),(3,'A Plus','A Plus','a-plus.jpg',0,NULL),(4,'Alien','Alien','alien.jpg',0,NULL),(5,'Almost','Almost','almost.jpg',0,NULL),(6,'Analog','Analog','analog.jpg',0,''),(7,'Anon','Anon','anon.jpg',0,NULL),(8,'Arcteryx','Arcteryx','arcteryx.jpg',0,NULL);`category`(1,'ROOT'),(2,'Home'),(3,'Alpine'),(4,'Mountain Bike'),(5,'Road Bike'),(6,'Snowboard'),(7,'Climbing'),(9,'Subculture'),(10,'Work at Height'),(18,'Soft Shell Jackets'),(19,'Insulated Shell Jackets');

     

    It seems to specify the table name right at the beginning, followed by rows contained within brackets, once the rows have been specified, its delimited by ; and then `category` must be the start of a new table.

     

    It looks like field names are totally omitted so is there any way to view this in a tabular format at all?  I've not seen an SQL like this before.

  7. Hi

     

    I wonder if anyone will be kind enough to help.

     

    I am getting into forking with pcntl_fork()

     

    I intend to create a script that runs 24/7 running 100 forks/children/'threads' simultaneously.

     

    Once a child has finished it's task and exited how can I start a new child to replace it?

     

    I need some kind of infinite loop that can continually check for exited children and set up new ones.  I'm finding it hard to get my head round since I'm new to forking.  Can anyone suggest a way to do this?

     

    Thanks in advance.

  8. Hi guys,

     

    I need to select 1 random row from a table but the row id must NOT match one of multiple values (possibly thousands).

     

    To put it another way:

     

    SELECT any random row EXCEPT ones WHERE id="1,6,9,100,300,56,2,44......"

     

    Whats a good way to do this considering there could be more than 3,000 id's we would not want to pick from.

     

    Any help would be greatly appreciated.

  9. Hi guys,

     

    I have written a script that opens up my gmail messages via IMAP stores them in an array.  However, I have thousands of emails, so this is taking forever.  Is there a faster way of doing this?

     

    Here's my code

     

    <?php
    //lets get those emails
    
    /* connect to gmail */
    $hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
    $username = 'info@***********.com';
    $password = '******';
    
    /* try to connect */
    $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
    
    /* grab emails */
    $emails = imap_search($inbox,'ALL');
    
    /* if emails are returned, cycle through each... */
    if($emails) {
      
    
      /* for every email... */
      foreach($emails as $email_number) {
        
        $message = imap_fetchbody($inbox,$email_number,2);
      }
      
    } 
    
    /* close the connection */
    imap_close($inbox);
    ?>
    

  10. Perhaps then, have an 'email template generator'.  The resellers come to a form on your site where they pick out the product they want to sell and your site returns a template email along with the HTML code they can use to promote the product via email to their clients.  Underneath the code are instructions on how to use it.

     

    Would that work? Then they wouldn't have to put client emails into your system.

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