473,386 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Display accessory which match with mobile model

41
hi all

i have "product table" in which i have 2 categories.

1) Mobile Phone
2) Mobile Phone Accessories which consists of many "Phone Covers"

Some Phone covers are compatible with 8-10 mobiles.

For Mobile phone category, the The "model" field contains single value like "E71" or "E72".

But For Accessories category, The "model" field contains value like "E71,E72,E73,E74......" all together separated with comma.

if i m on e72 mobile phone page then i want to show accessories whose 'model' field have value 'e72'


Expand|Select|Wrap|Line Numbers
  1. <?php
  2. /* query to select all models from accessories category from product table */
  3.  
  4. $qry_model="select * from product_table where category_id=4";
  5. $qry_model_result=mysql_query($qry_model);
  6. while($qry_model_row=mysql_fetch_array($qry_model_result))
  7. {
  8. $desc_model_all = $qry_model_row['model'];
  9. $desc_model_all = explode(',', $desc_model_all);
  10.  
  11. foreach ($desc_model_all as $value) 
  12. {
  13. echo $value; /* this outputs as E73E72 */
  14. }
  15. }
  16.  
  17. $mobile_model = $row['model'];
  18.  
  19. if($value == $mobile_model) 
  20. {
  21.  
  22. $qryc="select * from product_table where model = '$value' and category_id=4";
  23.  
  24. $resultc = mysql_query($qryc);
  25. if(mysql_num_rows($resultc)>0)
  26. {
  27. // product detail is displayed here
  28. }
  29. ?>
  30.  
i m not getting the desired results

vineet
Jul 8 '12 #1
3 1828
ariful alam
185 100+
How many tables you have 1 or 2. if you have 2 tables like,
1. mobile_phone
2. phone_accessories

Now suppose, first table mobile_phone has the following fields
Expand|Select|Wrap|Line Numbers
  1.    phone_model (contains E63, E72 any one in each row)
  2.    phone_name  (contains the manufacturer)
  3.    phone_image (contains the image or image path of the model)
  4.  
and the second table phone_accessories has the following fields
Expand|Select|Wrap|Line Numbers
  1.    accessories_id (contains accessories id)
  2.    accessories_info (contains accessories information)
  3.    accessories_supported_phones (contains phone_model like E63, E72 one or more in each row)
  4.  
then to list phone model you can use the following query
Expand|Select|Wrap|Line Numbers
  1. select phone_model from mobile_phone
  2.  
after selecting a mobile phone it shows the phone manufacturer name name a model image on the page.

to show the accessories information on the selected phone you can use the following query
Expand|Select|Wrap|Line Numbers
  1. select accessories_info from phone_accessories where accessories_supported_phones like '%'+phone_model+','
  2.  
hope this help you.
Jul 8 '12 #2
vinpkl
41
i alam

i have only one table.

vineet
Jul 9 '12 #3
ariful alam
185 100+
Than, can you write here the table structure?
Jul 9 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Aaron Whiffin | last post by:
Hi, I've set up the following table in MySQL 3.23.58 and all seemed to be working fine: CREATE TABLE advert ( id INT NOT NULL AUTO_INCREMENT, userid INT NOT NULL, make VARCHAR(25) NOT NULL,...
9
by: Rich | last post by:
Please help. Looking for a script to detect and display what version of Windows a user is running. Thanks in advance. Rich
1
by: Jeff | last post by:
Hey asp.net 2.0 I wonder if it's possible to have both standard asp.net and mobile asp.net in the same web application. When the web server gets a request it can detect if this requested...
11
by: Jankie | last post by:
I need to dispaly a user's multiple images in one entry.Right now,say if a user uploads 3 images,three entries for the same id display to match 3 images. I only want 1 entry to display all of a...
1
by: shreshta | last post by:
Hello.. I need a site which offers to download flash player for symbian based mobile. Can anybody help me.. mobile model is Nokia Nseries. Thanks in advance
2
by: udaypawar | last post by:
Hi All, I am developing a mobile application using PHP and XHTML for mobile. In this application I am just counting number of downloads and after each hit I am making an entry in Mysql...
0
by: =?Utf-8?B?SGVjdG9y?= | last post by:
is there any ActiveSync Remote Display for Windows Mobile 5 or 6?
5
by: imranmunirawan | last post by:
i am developing a wap site i want when any one hit the link of my wap site its mobile model and manufacturer will show at my home page of wap site. i am using j2ee for that with wml/xhtml. please...
1
by: rajujrk | last post by:
Hi all, How to retreive the mobile model using J2ME? Thanks in Advance..
0
by: MxMave | last post by:
Hi, I have developed a project for a handheld device. I have added a shortcut to the startup directory, the only problem being is that sometimes the app will load on device boot but subsequently...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.