Jump to content

webbhelp

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by webbhelp

  1. Hi! I have this nested menu, where everything works fine expect from the third hierarchy level. I have the code and the result here: http://jsfiddle.net/wvsL9/ If you hover the menu: "PRODUKTER" and then "PRIVAT", you see the problem with the width is not "auto". I am really stuck here, and I have tried a lot of variations. Can you find out why it doesn't work as I want? Thanks in advance
  2. I do like this in my webshop. The order is created in the database with the customers personally information and the products they bought. The order is create with a field in the database "paid" = 0 / false When the order is paid then paid will be updated to 1 / true if the customer changes his mind and go back because he/she wants to buy more products, then when the customer leaves the payment page I look if a SESSION with the order ID exists, if it exists, I remove the order from the database and the session. If the customer have changed his products and want to pay again, just another order is created because the other one was removed. BUT If the customer leaves the payment page without coming back to the shop, then there will be an unpaid order in the database table. The solution there would be to delete unpaid orders where the date is ... let's say 1 week old or something I don't know. But if the customer will pay with invoice, then it shouldn't be deleted in 2 weeks because maybe the payemnt will arrive later.
  3. Thanks for your reply! Okey so the group by suppress the result of rows! But when I Don't use group by, I only get one row :S? I don't see a solution here? Thanks in advance
  4. Hi! I got this small irritating problem here, how should I use group by? I am joining a lot of tables here and this SQL is used in a webshop. Okey, the question: I want to get all images from customer_img connected to each product. in this example, I got one product with a image in customer_img connected to it AND I got one product with 2 images in customer_img connected to it. But when I run this query, I only get one image each to those products, when I am supposed to get 1 image to the first product and 2 images to the other product. I think the problem is that I use wrong column in group BY, but I don't know. SEE IMAGE SELECT products.id AS id, products.vat, products.outprice AS price, products.weight, products.imgupload, products_img.imgurl AS pimgurl, `customer_products`.`number`, `products_lang`.`title`, `customer_img`.`imgurl`, `customer_products`.`number`, count(customer_img.id) AS countimg, (`products`.`outprice` * `customer_products`.`number`) + (count(customer_img.id) * 150) AS total, round( ((`products`.`outprice` * `customer_products`.`number`) + (count(customer_img.id) * 150)) * (1 - products.vat / 100)) AS brutto, round( ((`products`.`outprice` * `customer_products`.`number`) + (count(customer_img.id) * 150)) * (products.vat / 100)) AS countvat FROM (`customer_products`) JOIN `products` ON `products`.`id` = `customer_products`.`product` LEFT JOIN `products_lang` ON `products_lang`.`product` = `customer_products`.`product` AND products_lang.language = ? LEFT JOIN products_img ON products_img.id = products.firstimg LEFT JOIN `customer_img` ON `customer_img`.`product` = `customer_products`.`product` WHERE `customer_products`.`customer` = ? GROUP BY customer_products.product
  5. Hi! I got a controller in codeigniter which will update a database if a customer has paid or not! I am using Payson to do this. and payson will send back post data to site (controller) where it will say if the payment worked or not. and if it worked it would update the database. THE PROBLEM: I have set payson to send those data to a controller: www.site.se/paying/payson. but that controller never runs, so nothing happeneds, and I know that because I was trying to create a file(fil_put_contents()); to see if it worked but it didn't. WORKS: But! It works if I set payson to send the data to a file without the codeigniter framework; a normal file.php. So codeigniter make this unworkable. Can you please tell me your idéa about why this may not work! guess or something! Thanks in advance =)
  6. It was an unexpected answer... but better than I was expecting =) That sounds like a great learning method. I searched for this, but I was a little bit confused about the agile, is it like a framework where I easy create my own classes and methods. Was that example for learning different frameworks to get a better understanding of OOP? or why should I learn other frameworks instead of something like wordpress? I actually Don't like wordpress and applications like that, but it seems like many customers and company request people who have those knowledges. Why? I don't know, maybe they think it is a time saver?
  7. Hi! I got pretty good php knowledge, nothing which will constrain my future learning about these PHP applications. The problem is I don't know what I should learn, or which application which will be most useful for me. I got these in my mind: Drupal, joomla, wordpress, oscommerce, magento, prestashop, etc. etc means I got every application in my mind =) I want to learn something I get most use of, where I can earn money, it's always about the money . Wordpress, What I understand I can almost do anything there. I can start a blog with it, or an webshop, or a standard website with CMS, right? Magento, oscommerce, prestashop is only webshops but great ones. Drupal, joomla... Do i need to learn these? or does wordpress cover those uses? Then it is between wordpress and magento,etc. It might be difficult for you to help me with this choice, but what is the companies requesting now more? 1. If I want to get a job in the web developing business, what will help me most? 2. If I will start my own company and have to sell much sites, in an easy way, what helps me most then? Do you understand my questions? and why I want them answered? I might learn more than one of course, but this is like a priority list, what I should learn first, second, third. Thanks in advance =)
  8. I used GROUP BY now! and it works! You really saved my day! I appreciate this more than you can imagine. I hope you understand that! Thanks a lot for helping me with this! Wish I was good as you!
  9. IT WORKED! YOUR AWESOME! GREAT! everything good in this world! But what should I do to get the count? wow! wow! how did you found it? that was farfetched. Impressive! =)
  10. SELECT `products`.`id`, `products`.`outprice`AS price, `products`.`vat`, `products`.`imgupload`, `products_lang`.`title`, `products_img`.`imgurl`, count(customer_img.id) as countimg, `customer_img`.`imgurl` AS c_imgurl, `categories`.`category` FROM (`products`) JOIN `customer_products`ON `customer_products`.`product` = `products`.`id` LEFT JOIN `customer_img` ON `customer_img`.`product` = `customer_products`.`product` LEFT JOIN `products_lang` ON `products_lang`.`product` = `products`.`id` AND `products_lang`.`language` = '3' LEFT JOIN `products_img` ON `products_img`.`id` = `products`.`firstimg` JOIN `categories` ON `categories`.`id` = `products`.`category` WHERE `customer_products`.`customer` = 3 JOIN `customer_products`ON `customer_products`.`product` = `products`.`id` //using this to only fetch the products where customers_productds -> productid is the same as the product.id; this works I get the product data LEFT JOIN `customer_img` ON `customer_img`.`product` = `customer_products`.`product` //Getting all the images connected to the customer_products. IF I remove this line, all the 4 products is received //If this line is in use I get: 1157 1000 12 1 llllllllllllllllll sverige2.png 0 NULL Apple But I am suppose to get 3 more rows. --- LEFT JOIN `products_lang` ON `products_lang`.`product` = `products`.`id` AND `products_lang`.`language` = '3' //Selecting all translations to the product., this works I get the title. LEFT JOIN `products_img` ON `products_img`.`id` = `products`.`firstimg` //Selecting the image to the product, this works, I get the image
  11. I attached a file with the tables. I really don't understand why it don't work now, I think it's all connected with right column, table, but I understand it's not, can you see anything? Thank you!
  12. Now my result look like this: That is one row, null is the imgurl. and it will be null because there is no images. so it is correct. BUT the would be 3 row more. Because in customer_products there is: 4 rows, with same customer(id), and different product(id). so I don't understand why the 3 other result doesn't show?
  13. Hi! I am getting crazy about this problem. I really need your help because the deadline is today and this is the last thing to do. I got a lot of tables here: products (all products) products_lang (All translation to the product, title and description) products_img (All the images to each product) customer(All customer, name, email etc.) customer_products(All products the customer bought) customer_img (Every product each customer buy; there is a possibility to upload an image to that product, an attached image) //THIS ONE IS A BITCH! Okay! I wan't to select all the products (`products`) with the ID's from the table `customer_products` WHERE the customer_products.customer = 3. Then I select the products the customer has bought. and with that I want the products images, AND the images the customer uploaded to each image. The problem here is that I only receive one row when I should get 4 rows.AND I don't get the C_imgurl (customer_img.imgurl). BUT if I remove: LEFT JOIN `customer_img` ON `customer_img`.`product` = `customer_products`.`product` Then it works; I get the 4 rows. Good to know maybe, is that the customer_img is empty, that is why I use left JOIN SELECT `products`.`id`, `products`.`outprice`AS price, `products`.`vat`, `products`.`imgupload`, `products_lang`.`title`, `products_img`.`imgurl`, count(customer_img.id) as countimg, `customer_img`.`imgurl` AS c_imgurl, `categories`.`category` FROM (`products`) JOIN `customer_products`ON `customer_products`.`product` = `products`.`id` LEFT JOIN `customer_img` ON `customer_img`.`product` = `customer_products`.`product` LEFT JOIN `products_lang` ON `products_lang`.`product` = `products`.`id` LEFT JOIN `products_img` ON `products_img`.`id` = `products`.`firstimg` JOIN `categories` ON `categories`.`id` = `products`.`category` WHERE `customer_products`.`customer` = 3 AND `products_lang`.`language` = '3' Please help me with this! Thanks! Ask if you don't understand!
  14. True words! Thank you for all help! I really appreciate that!
  15. Aha! now all makes sense! I have actually never seen this, never been in touch with this problem. Okey but this was actually easy, no advanced solution I mean. Really good knowledge to have, I thank you for this =) you mean that products.* is bad practice, because the fields might have same name in another table, as some of them actually have (id-field), and I shouldn't fetch things I don't need. True, I will change that! Thank you =)
  16. Sry I didn't understand this line: "The trick is to process the product data only when the value changes." and this is correct: "1 product rec --- 1 lang rec --- several image recs" so how do you mean, how can I echo the result, if there is only one product row, and a several of img rows?
  17. okey, yes I can. but the wrong here is that if I have 4 pictures connected to a product, the product loops out 4 times. So if a product got the name iphone the result is: iphone img1 iphone img2 iphone img3 iphone img4. And I don't get it, if I loop my products result and have it like this: iphone - translations - images samsung - translations - images how can I loop the images out when iphone only echo:es in one loop-iteration. I don't really know how to explain my question in a good way here but... Loop-iteration 1: echo $p->title; echo $p->price etc, and then echo $p->img (That is just one img, in this one, right?) where is the other 3 images? Do you understand my question? =)
  18. Hi! I got 3 tables! 1 with the product, 1 with the translated titles, descriptions. 1 with the images to each products. I have to select all products by category and then get all the products in a specific category where I the language is (id), so I can get the right translated titles, and descriptions. This works, I got all the products with each translations. but now I have too add the third table... the images. one product, got 1 title, and description, so it was no big deal to get it. but every product can have a lot of images. So the question is how I can get the images too. Is this even possible to do with a join too? I mean don't I have to make another query for this? and loop them out in every product? it seems to be bad performance thinking if I do so? SELECT `products`.*, `products_lang`.`title`, `products_img`.`id` AS imgid, `products_img`.`imgurl`, `products_img`.`product` AS imgproduct FROM (`products`) INNER JOIN `products_lang` ON `products_lang`.`product` = `products`.`id` INNER JOIN `products_img` ON `products_img`.`product` = `products`.`id` WHERE `products_lang`.`language` = '3' AND `products`.`category` = '3' AND products_img.product = '3' I did something like this first, then I came up with the question if it is even possible to create a third join with the products_img table. Please give me a hand with this one! Thanks in advance =)
  19. hmm it didn't worked :/ $route['([a-zA-Z]+/)?(:any)'] = '$2'; I used this your line of code and still this work: http://s/gbc/sv/webshop/web but not this: http://s/gbc/webshop/web I have another solution which is: require_once( BASEPATH .'database/DB'. EXT ); $db =& DB(); $query = $db->select('short')->get('language'); if($query->num_rows() > 0) { foreach($query->result() as $l) { $route[strtolower($l->short) .'/(:any)'] = '$1'; $route['('. strtolower($l->short) .')'] = 'webshop'; } } which is that is creates a route for every language there is. and if there is something else than a language in the url like sv is svkaosdka instead, then the application redirect the user to url.se/sv/webshop. This is an alternative solution I tried with, this works, but I thought I could do this with one route instead :/
  20. Thanks for the reply. But unfortunately it didn't worked... The problem I can see is that if I remove the language from the url like: en/sv/dk or whatever it is $route['([a-zA-Z]*)/(:any)'] = '$2'; Then the regexp cannot match a-zA-Z before the / Right? Is there even any possible solution to this? The expression (in words) would be: If there is something before the / , the regexp is correct, but if not, then it should just ignore it or something. I am really stuck at this point
  21. Hi! I am using codeigniter framework, and what I am trying too do is to route the user to the right adress. I have the URL like this: www.site.se/en/webshop/method www.site.se/webshop/method and the problem is that the /en/ will not make any difference, because I am trying to bypass that with this: $route['([a-zA-Z]+)/(:any)'] = '$2'; So if there is anything with a-zA-Z then it will ignore it and just go with the rest of the url ($2). This doesn't work correctly. If I go to: www.site.se/en/webshop/ then it works, this too: www.site.se/webshop/ This also work: www.site.se/en/webshop/method BUT this doesn't work: www.site.se/webshop/method SO the problem is, if I don't have any language in the url, the method don't run. I hope you understand the problem and can help me, because I am stuck here, and I don't understand why this don't work, or what to try with... Thanks in Advance!
  22. ohh I see! very good explanation! This made me understand a lot more. Now I can see why I should use them. I really appreciate your help and the time you took to write this =) Thank you very much!
  23. PERFECT! I used the first one, without joining, and it worked perfect. Aha so INNER JOIN, did right the opposite of what I was trying to do, filter the none existing out? Yeah... I agree with that statement, my databases haven't been so complexed, but I have learned a lot since then, and now I start to understand, and you help me a lot, thanks =)
  24. Hi! I have 2 tables (See attached image). I want to select all(') from the table variables, but I only want to get data where variables.ID doesn't exist in table translations.ID. okey! So if the variables-ID does not exist in the table-translation:Variable, den I want to get it. Also, there must have to be a where statement so I can choose too fetch variables with language (id) 3, or another integer. I want this because I want to select all variables which hasn't been used in the translation table. I have tried with innerjoin... and actually I have never used joins before, never had too. But now I think I have to, but my innerjoin didn't worked. And because of my understanding in joins is small, I also tried left and right join but I din't get it too work. It would by my knowledge be something like this. SELECT variables.* FROM variables INNER JOIN translations ON variables.id != translations.id WHERE language = 3 But no.. I only get all variables even if the variable ID is in the translation.variable table. Thanks in advance! I guess this is simple for you guys.
  25. Hi! I have a class with many functions/methods. I want to split this into different files so I can easily edit and add functions. I want every functions to be able to call eachother and with that I mean, they have to be for example in same document. My question is: I can't have a class and include functions like this: class DB { include('select_functions.php'); //Only includes function's no class include('insert_functions.php'); //Only includes function's no class include('delete_functions.php'); //Only includes function's no class function test() { } } The includes will output fatal errors... How can I solve this so I can have all functions in different files but still use ONE object to call them! Thanks!
×
×
  • 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.