Jump to content

sloth456

Members
  • Posts

    171
  • Joined

  • Last visited

    Never

Everything posted by sloth456

  1. Where is the second search? Perhaps post the entire of process.php
  2. 1) Yes the server is the host/computer where you have your website. 2) I recommend you follow this simple tutorial http://www.tizag.com/phpT/fileupload.php which tells you how to achieve what you want. If you have any problems, post back here
  3. Show us some code, maybe we can get a better insight that way.
  4. 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.
  5. Another possible solution would be to store the contents of the cart in a table. When the user logs in again you can retrieve everything that was in his cart from the table.
  6. The code you posted looks like you're using a class to access the database. Are you by any chance doing this with wordpress? I'm asking because we might need to know how the class is written in order to know how to use it.
  7. 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.
  8. 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.
  9. 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.
  10. Wow, if that sql line really works, its a god send. I'm back at work tommorow so I'll let you know how it goes.
  11. 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.
  12. Thanks fenway, I do not know the column names. But they are in the correct order. If there's no easy way to view as is I think I may have to write a script to parse this and turn it into something phpmyadmin could use by making up some column names of my own.
  13. 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.
  14. To clarify, there are no 'create table commands' or anything to actually setup the databases. Perhaps its in a format like I'm not used to?
  15. Hi sorry if this has been asked before, I have an sql dump, however it doesn't appear to contain any INSERT statements, so it won't import into phpmyadmin, at least I don't think it will. How do I go about viewing this in a tabular format, perhaps I can download some software locally
  16. 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.
  17. figured it out myself in the end. For those wondering how you need to type path/to/php path/to/fileyouwantotrun.php So for xampp on linux this is /opt/lampp/bin/php /opt/lampp/htdocs/yourfile.php This worked for me
  18. Thanks for your reply Kira, however php is installed, I have xampp. I can run php scripts in my browser from localhost fine just don't know how to run scripts from command line. I think xampp installs php to a different directory than normal.
  19. Hi guys, I'm trying to run a php script from command line in linux. I installed xampp for linux a.k.a lampp so typing php /path/to/file.php Just brings up a message saying I need to install php. Whats the correct way to do this?
  20. Sorry for the late reply, this worked great! May I ask what the 'DISTINCT' bit is for, is it necessary, my query seems to work without it.
  21. Hmm, I hadn't realised you could select data in this way, looks promising. I shall try it out soon and report back.
  22. Actually yes they would be. I can select them from a table like this SELECT ids FROM reports WHERE group_id=$group_id This would bring up a list of ids I would not want to come up again in my new selection.
  23. 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.
  24. 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); ?>
  25. 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.