PDA

View Full Version : Regarding XML and MySQL



Bakamoo
Jan 6th, 2009, 06:39 AM
I know this has been asked many times before, but if anyone could help again, it would be great.

Anyways, I'm going to use this for my windows mobile phone (htc hd)

I currently have the input field automated. This project would be some sort of a meta for keyword searching. Currently it is running in php and mysql with some javascript/ajax. The problem i am seeing is running php on a windows mobile. I cannot afford to run it non locally as our internet charges here are crazy. I won't be posting the whole database to keep it short. please dont mind if i dont close it properly, im just copy pasting important lines.


CREATE TABLE `area` (
`areaRef` int(10) unsigned NOT NULL auto_increment,
`areaName` varchar(255) default NULL,

INSERT INTO `area` (`areaRef`,`areaName`) VALUES
(1,'Makati'),
(2,'Fort Bonifacio'),
(3,'Jupiter'),
(4,'Rockwell'),
(5,'Shangrila'),
(6,'Binondo'),
(7,'Robinson\'s Place'),
(8,'Roxas'),

CREATE TABLE `store` (
`storeRef` int(10) unsigned NOT NULL auto_increment,
`storeName` varchar(255) default NULL,
`storeArea` varchar(255) default NULL,
`storeNo` varchar(255) default NULL,

INSERT INTO `store` (`storeRef`,`storeName`,`storeArea`,`storeNo`) VALUES
(71,'President Tea House','Binondo',''),
(72,'President Tea House','Mall Of Asia',''),
(73,'Alex III','San Juan',''),
(74,'Cibo','Greenbelt',''),
(75,'Pizza Hut','Delivery','9111111'),
(76,'Italiannis','Fort Bonifacio',''),
(77,'Italiannis','Greenbelt',''),

As you can see, a store can have many different areas
ie store 76 and 77 which is italiannis can be in fort bonifacio or greenbelt

now, this all would link to main. main is my super table where everything will be placed


CREATE TABLE `main` (
`ref` int(10) unsigned NOT NULL auto_increment,
`id` int(10) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`picture` text,
`type` varchar(100) NOT NULL,
`keywords` text NOT NULL,
`status` int(1) unsigned NOT NULL default '1',
`updated` datetime NOT NULL default '0000-00-00 00:00:00',
`price` varchar(100) default NULL,
`perprice` varchar(100) default NULL,
`rating` int(1) unsigned default NULL,
`contactno` varchar(255) default NULL,
`ip` varchar(100) default NULL,
`notes` text,

ref is not used, it is the mysql autoincrement function
id is my self generated autoincrement based on last id
type for now is mostly food
keywords would be my problem, ie, i would describe an apple as
red apple***apple***california apple***
the *** are used to parse the data later
the columns will as soon as i get into more types, for now, this is it

under games type

(10,1,'Chab0',NULL,'Games','Server***CS***Games***Chabo***Chab0***Steam***IP',1,'2008-12-28 15:48:31',NULL,NULL,NULL,NULL,'203.116.32.70:27015',NULL),

under food type

(17,7,'Kalbi Kui',NULL,'Food','Korean***Beef***Korean Garden',1,'2008-12-28 16:27:55','',NULL,5,NULL,'',NULL),
(18,8,'Pork BBQ',NULL,'Food','Korean***Pork***Korean Garden',1,'2008-12-28 16:29:58','',NULL,4,NULL,'',NULL),
(19,9,'Soundubu Chickey',NULL,'Food','Korean***Soup***Clear Soup***Spicy***Tofu***Korean Garden',1,'2008-12-28 16:31:03','',NULL,4,NULL,'',NULL),
(20,10,'Chap Chae',NULL,'Food','Korean***Korean Garden',1,'2008-12-28 16:34:28','',NULL,4,NULL,'',NULL),

(39,29,'Frozen Siomai',NULL,'Food','Frozen***Chinese***Chuanteck Best Food***Chuanteck***Siomai***Frozen Siomai***Dimsum',1,'2008-12-28 19:36:48','75','12pcs',1,NULL,'',NULL),
(40,30,'Frozen Siomai',NULL,'Food','Frozen***Chinese***Chong Sheng***Siomai***Asher\'s Frozen Dimsum Inc.***Frozen Siomai***Dimsum',1,'2008-12-28 19:38:18','105','15pcs',4,NULL,'',NULL),


now, when adding the food, i have to enter an area and store. this would come from the db, if non are selected it will add to the db. this is currently working now. what i dont have is the display, im still waiting to buy the htc hd before i proceed making the display and search function

so basically, I would be typing the (keyword or name) to display the results.
let us take this for an example


(39,29,'Frozen Siomai',NULL,'Food','Frozen***Chinese***Chuanteck Best Food***Chuanteck***Siomai***Frozen Siomai***Dimsum',1,'2008-12-28 19:36:48','75','12pcs',1,NULL,'',NULL),

the entry will show if i type, even the first few letters since ajax will do the checking

frozen siomai
frozen
chinese
chuanteck best food
chuanteck
siomai
dimsum

this would help me locate the stuff i want easier.

So now for the questions.
I havnt touched xml for years now and even then it would be like relearning everything as i was really such a beginner. I don't mind about the learning curve.
I know xml will reduce the need to parse the keyword using *** as xml can do something like this right?

<main>
<name>siomai</name>
<keyword>frozen</keyword>
<keyword>chinese</keyword>
</main>

btw, i do not want to separate by area and stuff as that would require me telling the search function to look for multiple areas which grows as i learn more new things or find another category i did not think of before, i want to not program as much as possible so everything will be done by keyword search

now for the estimate
there would be around 200shops at most (shops.xml)
100 areas(areas.xml)
if type food (food.xml), this would reach 500+ entries
if other type(whatever i need.xml) per file might reach 200+ entries

So now my question is, can I really do a php mysql in windows mobile or do i have to use xml. The only reason i can see xml working better is that i can transfer the app wherever and it would work without installations needed. htc hd comes with opera btw.

Thanks :D is it long??? :rolleyes:

Bakamoo
Jan 8th, 2009, 05:53 AM
nevermind, im sticking with mysql for now