Jump to content

esport

Members
  • Posts

    98
  • Joined

  • Last visited

Everything posted by esport

  1. Yes but I have used the ensemble column as flag, either 1 or 0 to indicate the type of the item. So for example there would be 2 singles with the product ID of 1 and product_id size price ensemble ---------- ------ ------ -------- 1 Single 10 0 1 Single 20 1 1 Double 20 0 1 Double 30 1 or e.g. this:
  2. Each product may have 2 prices, its actually for a bedding website. Price 1 represents the mattress only and the price 2 represents it with ensemble. And there are many sizes of each product. i.e. Single, Double, Queen etc. So I have a product line with all sizes for each product and if they are ensemble or not. So the actual table should be more like: product_id, size, price, ensemble. However I want to group each product in size but since threre are 2 prices in a group, I was wondering how to do this in one query. I have managed to accomplish this, but running a second query to find out the ensemble price. I was hoping to do this in 1. Thanks Daniel
  3. Hi Guys, I have a product line table that consists of id, product_id, size and price. I want to be able to group each item by size but at the same time display all the prices of the product_id in question in that particular size. i.e a product may have 1 size but many prices for that size. For example: PIDprice1price2 1$30$50 Is this possible to do in 1 query or do i need to run 2 queries. Thanks Daniel
  4. Thanks heaps, worked a treat. So is that the only way to achieve this? Otherwise do multiple queries with COUNT and WHERE clause.
  5. Hi Guys, I was wonder how to acheive multiple COUNTS in 1 query. For example, I have a user_rating table, id, user_id, rating i want to count the different ratings, say A and B for example. Can I do this in 1 query? Thanks Daniel
  6. ha i worked it out. i was grouping the wrong field. thanks for your help guys.
  7. I relised why it wont produce the results I want. I have a GROUP BY clause in the query grouping the taskid's in the task_assigned_to table so it wont produce duplicates. If so, how would I produce a result with all tasks without duplicates? SELECT * FROM tasks t LEFT JOIN tasks_asigned_to ta ON t.ID=ta.task_id GROUP BY ta.task_id
  8. Hi guys, I have 2 tables 'tasks' and 'tasks_assigned_to'. I want to display all the tasks in the 'tasks' table'. easy select * from tasks however, when I join the 2 tables like SELECT * FROM tasks t LEFT JOIN tasks_asigned_to ta ON t.ID=ta.task_id It will only display the tasks that are in both tables. How do I display all tasks even if they aren't in the 'task_assigned_to' table. Thanks Daniel
  9. Still no luck why certain emails wont even receive any emails whats so ever. Its killing me. My hotmail account and the local emails receive them. Ahhhh
  10. Thanks for the tutorial, it helped greatly.
  11. Hi guys, I want to display hierarchically organized data in the form of categories/subcategories. The classic usage is in products, where the db tree is used to filter data based on the active subcategory. I have a table called categories with the following fields: id, parent_id, name I have the following example data 1,0,trade 2,0,house 3,1,painting 4,1,electrical So if I passed the id 3, it would display: trade > electrical Can anyone help? Thanks Daniel
  12. I used to code and works great, but would be nice to know how to send multiple files.
  13. The code has worked in the pass and as I mentioed before, it works fine with hotmail and yahoo accounts and local accounts. I believe it sends ok but the other end doesn't recieve the email.
  14. Has it got something to do with my server settings?
  15. Hi Guys, I just recently moved my website over to a new serer and noticed my mail function is not working. The recipients are not receiving their emails, yet the results show true when the mail function is used. However if I send and email to a hotmail or yahoo account, it works fine. And it also works fine if i send an email locally, as to an email account with the same domain name. I have made several adjustments to my code hoping it would change the outcome. Below is the code i am using. ini_set ("SMTP","mail.pitpro.com.au"); ini_set('sendmail_from',"sales@pitpro.com.au") $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "From: Pitpro Motorcycles <sales@pitpro.com.au>\r\n"; $headers .= "To: ".$name." ".$surname." <".$email.">\r\n"; $headers .= "Reply-To: Pitpro Motorcycles <sales@pitpro.com.au>\r\n"; $headers .= "Return-Path: Pitpro Motorcycles <sales@pitpro.com.au>\r\n"; $headers .= "X-Priority: 1\r\n"; $headers .= "X-MSMail-Priority: High\r\n"; $headers .= "X-Mailer: PHP"; $subjectText="Order Confirmation - PitPro Australia"; mail($email, $subjectText, $body, $headers,"-f sales@pitpro.com.au"); The code looks fine to me and I have no idea why its not working. Any help would be much appreciated. Thanks Daniel
  16. I got it to work select table1.uid,name,cid from table1 left join table2 on table2.uid = table1.uid AND table2.cat_id=1 Rather in the WHERE cluse.
  17. Maybe if i put it this way it may help., I want to list all favourites which is easily done. However I want to check each favourite to see if they are in a particular group. Now the way I would usually do this is list all the favourites then run a separate query on each favourite to see if they exist in a particular group. Now if I have a list of say 100 favourites, it will run 100 separate queries. I know it is possible just to run the 1 query but I’m not to sure how to do it. I have just made an example for argument sake: favourites fid name 1 Dan 2 Simon 3 Matt 4 Emma 5 Sarah fav_group gid fid 1 1 1 3 1 5 2 1 2 4 Now I want to produce the following results so it displays all users and tag the users with the gid 1 for example. fid name gid 1 Dan 1 2 Simon null 3 Matt 1 4 Emma null 5 Sarah 1 Now say if i select gid=3, it will still list all favourites but obviously gid would be null. Hope this helps. Thanks in advance and for your patients. Daniel
  18. It should also produce all the users even if they all aren't in a category either.
  19. Thanks, if I add the WHERE clause it limits the results of the users. It will only display the users that are assigned to that category. I want to display all users regardless if they are in that category, but I still want to know which ones are in the category.
  20. Still doesn't produce the results Im after. I think it needs the WHERE clause so I can specify the catid. But if i add this in, it will only list the users that are in that catid. I want all users, but some how tag the users in the specified catid and null the rest of users that aren't. Thanks for your help tho
  21. I actually have used the left join query on this before. However, the uid may occur multiple times in the category table.
  22. I will add the tables and the results I want to display. It might help. users uidname 1Dan 2Simon 3Matt 4Emma 5Sarah categories ciduid 11 13 15 Now I want to produce the following results so it displays all users and tag the users with the catid 1 for example. uidnamecatid 1Dan1 2Simonnull 3Matt1 4Emmanull 5Sarah1 Not sure how to do this. Thanks in advance. Daniel
  23. Hi Guys, I have a table of users which I want to display all. Easy done SELECT userid,name FROM users I have another table that groups the users in categories. What I want to do, is display all the users in the users table but at the same time I want to tag the users in a specific category. For example. SELECT userid FROM cat WHERE catid=1 How do I combine the 2 queries to display all the users in the users table but at the same time tag the users in the category table with a specific category? I having trouble doing this. Thanks Daniel
  24. I think you miss understood. Here is an example of the way I am doing it at the moment. $res = mysql_query("SELECT * FROM categories",$server); while($getCat=mysql_fetch_array($res)){ $catid = $getCat[cat'id']; $res2 = mysql_query("SELECT * FROM products WHERE catid=$catid",$server); $numRows = mysql_num_rows($res2); echo $getCat['name]." has ".$numRows." products<br>"; } Is it possible to cobine this into 1 query? So it doesn't run the second query every loop?
  25. Hi Guys, Not sure if this is possible. I have 2 tables. 1 table that is a set of categories. The other table is a set of products and categories. What I want is to list each category but then I want to know how many products are in that particular category. I know you can do 2 seperate queries in a loop, but if i have over 100 entries, then it would run the query 100 times. Can I do it so we can have the 1 query? The tables look like this for example: category(catid,name) (1, Bikes) (2, Cars) products(catid,pid) (1, car1) (1, car2) (1,car3) (2,car1) Thanks Daniel
×
×
  • 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.