Sunday, December 27, 2009

DOJO Charting and php mysql connection thingy

yesterday i was trying to get my ajax-php-mysql code working..
Following are the problems that i faced...
1. I wanted to avoid call to mysql_connect method multiple times because in my perception, this would lead to multiple handles to database and hence wastage of resource and time... I was trying to save the handle of database in $_session variable but it was fruitless because i was getting server side error that database not connected ... then i checked documentation of mysql_connect and it says that if same arguments are passed then no new connection handle is created.... This can be great abstraction as PHP does the job for you.. but some inflexibility as well that it does not allowing me to have multiple connection to back end.... but i guess my knowledge is incomplete so will update this space regarding flexibility issue...

2. JSON object parsing...
we can use many inbuilt functions... My understanding of this is still vague... I was sending text/plain data from server and calling JSON.parse($data) thingy to convert it to JSON object but in some cases i saw that data was received in JSON format.. means it was converted into JSON on server side itself...
basically read the data from server and store it in {"" : [{"":"","":""},{"":"","":""}] } form....

3. Third problem was related to DOJo charts...
there is no way in dojo charts to create custom labels.. which is bad... because my RA guys would be mad about it...

4. Ajax.. PHP... MYSQL.. JSON...AJAX handling... this is the sequence of getting this done...

For dojo charting quickcet source is ...
http://www.sitepen.com/blog/2008/06/16/a-beginners-guide-to-dojo-charting-part-2-of-2/
first and second blog here... best

SJ

No comments:

Post a Comment