Dec 17

JSON Array Single MySQL Insert and Update

This is another quick one. I wanted to insert a JSON array into MySQL with a single insert and, on duplicate key update. This is how you get it done:

Say you have a JSON array like this:

[{"num":"222","desc":"seconds","freq":11,"type":"hour","active":false},{"num":"1234","desc":"forths","freq":22,"type":"day","active":false},{"num":"3333","desc":"thirds","freq":33,"type":"week","active":true}]

Continue reading

Dec 29

ExtJS Treepanel with MySQL data

In this tutorial I’ll show you how to build an ExtJS treepanel using data coming from MySQL, while using PHP to create the json array sent to the treepanel. Here’s how:

Continue reading

Apr 11

Extjs Cascading (Dependent) Combo Boxes

This tutorial was written after one of my readers requested help with creating a dependent dropdown menu for continents, countries and states. I hope this helps everyone out there, who like myself, have struggled with this in the past.

First you’ll need to create the connect.php file, explained here.

Next create the 3 mysql/php/json files used for:
1. gathering data from mysql,
2. storing the data into a json array for each of the combo boxes you’ll be using (Continent, Country and State).

(Please adjust the paths to connect.php (mentioned above) and all other files used in this example
accordingly and create the required tables in mysql as needed)

Start by creating the continentQ.php file, to gather the continent data:
Continue reading

Feb 12

Create Extjs PDF Report

I have been looking for ways to export MySQL data to pdf using ExtJS, and up to this day I haven’t been able to
find a simple solution. I finally came across a project called “PHPJasperXML”, which allows me to access MySQL data, export it to pdf from my ExtJS application, using php and without having to use any javascript.
Albeit, the report isn’t necessarily created by ExtJS, it is extremely easy to create the report and implement this on your ExtJS application.

**** Update May 17th 2011 ****
This is an alternate solution to PHPJasperXML, it uses jasperserver to store the report which can be accessed via its url and you can also use subreports and multiple parameters.

*****************************

Continue reading