Jump to content

burhankhan

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Everything posted by burhankhan

  1. Yes i have this: I want two queries: 1- get all products that have country USA. 2- get all products that have option_id 1.
  2. ok here is my database design and its values: I want two queries: 1- get all products that have country USA. 2- get all products that have option_id 1. Can you help me?
  3. Will following BOLD values are NOT un-nessassary? 1 | 1 | 1 1 | 2 | 1 1 | 1 | 2 What should be complete Optimized query to get all products that have country_id = 2? I know joins or inner queries should be use, but don't know how.... Can you please provide me complete query?
  4. ok i understand. So middle table should be like: product_id | country_id | option_id | Right? But i think it will not allow me to have multiple countries and multiple options against each product??? If i am wrong, what should be design of Middle Table?
  5. because table_id can be either country_id or option_id. that's why i named it table_id and i will identify that ID using table_name. For example if table_name is countries, then table_id will be ofcourse ID of country...... Let me know if i am doing wrong?
  6. Hi Revraz, thanks for reply. Middle table contains product_id, table_name and table_id. (Table_name is name of other table, like countries or options) For example if a product_id 7 exists in USA, CANADA, INDIA, CHINA (these countries have IDs like; 1, 2, 3, 4 respectively) and options are OPTION-1, OPTION-2, OPTION-3 (these options have IDs like; 1, 2, 3 respectively) then Middle table is like: Middle-table: product_id table_name table_id 7 countries 1 7 countries 2 7 countries 3 7 countries 4 7 options 1 7 options 2 7 options 3 I am not sure, if my database design is correct or not..... If it is not correct can you please guide me? Actually each product have multiple countries, and multiple options.... that's why i design like this. Regards, Burhan Khan
  7. Hi: I want to get data from multiple tables. I have designed a design of my database in MS Access. Actually there are 4 tables. one is PRODUCTS (i want to get products from that table) 2nd is COUNTRIES (products can be deliver to multiple countries) 3rd is OPTIONS (each product will have some DEFINED options) and 4rd is MIDDLE-TABLE, i have created it as middle table. Actually each PRODUCT can have multiple COUNTRIES and multiple OPTIONS. My questions are: how to fetch all products in USA? or all products that have OPTION # 3 ? I know middle-table is not a good idea, because it contains tables names and their IDs, like country_id or option_id..... But i am not understanding how to do this? Can anyone suggest me with a sample query? Regards, Burhan Khan
  8. which inserts you are talking about? please clear me about batch inserts......
  9. Hi: How can i count hits on any image? I know i can use url-rewrite and then execute little script to update database and then show image. But it will slow downs server if there are thousands of images! Get i get something like awStats are doing? Or any other way? Thanks Burhan Khan
  10. Some time 30,000 records need to be fetch, some time only one record. And some time need to count number of records in it using Count(*). It is only one table that is making problem.
  11. What is general solution for a big database? If there are 10 queries in every second from that database, how we can manage it? Ofcourse server will got down, when it spends 3 seconds in each query.
  12. Hi: I have a database of members with 3 Million records. Its size is 400 MB. When i query to get records from that database, it takes too much time (2, 3 seconds) and server become busy when there are some queries from that database. I searched its solution, and found that i should split that database into many tables. How can i do this? There are primary keys (ID) into that table, if i will split it, how can i manage it using php? Or is there any other solution? Thanks Burhan Khan
  13. I have tried your script but it is not working with this string: [quote][quote]this is quote 3[/quote]this is qutoe 2[/quote]this is in the quote It should return this: this is in the quote But it is returning this: this is qutoe 2[ /quote ]this is in the quote Any suggestion?
  14. Hi: I want to remove sub string from a string. Criteria is like this: this is starting of string [tag][tag] here is some other code[/tag]here is some code[/tag] this is ending of string... You can see in this string there are many nested [tags]. I just want to remove those all nested tags. And out put should be: this is starting of string this is ending of string... I have tried many patterns but useless. Any help will be highly appreciated. Thanks Burhan Khan
  15. Can anybody help me????? Please ready my post ......
  16. I have edited my post. Actually i was typing post and press ENTER key by mistake. And post was incomplete.
  17. Hi: I have string like this: [ quote ] [ quote ] [ quote ] [quote ] here is data DDDDDDDDD[ / quote ] this is data CCCCCCCCCCC [ / quote ] this is data BBBBBBBBBB [ / quote ] this is data AAAAAAAAAAAA [ / quote ] I want some text processing, so that i can get only top [ quote ] and its data. And remove remaining data. For example output should be : [ quote ] this is data AAAAAAAAAAAA [ / quote ] I have applied some preg_repalce but no success. Please help me!
  18. It is working for me! Thanks for you help SASA.
  19. Hi: I have written a class to parse bbcode. I am having little problem with regular expression. preg_replace('/\[quote\](.+?)\[\/quote\]/is', '<pre>$1</pre>', $mytext) This is simple code to convert all QUOTES tags. It is working fine. But when i have text like this: [ quote ]here is some text[ quote ]here is more text[ / quote ][ / quote ] Then it is creating problem. It will print this: [ quote ]here is some text [ / quote ] Is there any solution to parse 2 or more level QUOTES?? Thanks Burhan Khan
  20. I couldn't understand what you said....... I use left join as: SELECT * FROM `members` LEFT JOIN `member-group` ON `member-group`.memberid IS NULL But still not working...
  21. Hi: I have two tables as: Members ---------------------------- MEMBER_ID | NAME ----------------------------- 1 abc 2 kdjf 3 kek GROUP ------------------------- MEMBER_ID | GROUP_ID ------------------------- 3 1 Now i want to fetch records from first table, where members.member_id != groups.members_id I use many types of quires and it is working: SELECT * FROM `members` RIGHT OUTER JOIN `member-group` ON `member-group`.memberid != members.memberid SELECT * FROM `members` WHERE `id` != (SELECT `memberid` FROM `groups`) Also left join working... But when second table "GROUP" is empty, then no query is working. It fetch ZERO records. What is its solution?
  22. Hi: I am using the following .htaccess code for virtual sub domain, and it is working fine: Options +FollowSymlinks RewriteEngine On RewriteCond %{HTTP_HOST} !^www [NC] RewriteCond %{HTTP_HOST} ^([^.]+)\.st-rt\.com [NC] RewriteRule ^$ /page/index.php?id=%1 [L] It is redirecting username.domain.com to www.domain.com/page/index.php?id=username But what to do for this: username.domain.com/mail.php?id=23 I want it to redirect to : www.domain.com/page/pages.php?id=23 What to add in .htacess? Thanks Burhan Khan
  23. I have 3 tables. Structure is as follow: Table A ---------------- id record 1 abc 2 def 3 sdf Table B -------------- id Aid records 1 1 ddd 2 1 eee 3 2 3434 Table C ------------- id Bid records 1 1 dfsdf 2 1 sfsfs 3 2 s sdfs 4 2 sdfsf I want to delete from all tables as: WHERE tableA.id = 1 and tableB.Aid = tableA.id and TableC.Bid = tableB.id I tried many queries but can't find how to delete all in one query. Thanks Burhan Khan
×
×
  • 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.