Hi,

I am just exploring the sencha world.I am creating my first app using sencha. Can someone point me as to how i can get the data from the database using php and json. Ive got a code which i will write down.

Code:
function showRecent() {
            Ext.Ajax.request({
                url: 'server.php?action=get',
                success: function(e) {
                    var obj = Ext.util.JSON.decode(e.responseText);
                    var guests = obj.guests;					
                    if (guests) {						
                        var html = tpl.applyTemplate(guests);
                        Ext.getCmp('recentTab').update(html);
                    }
                }
            });
        }
Code:
if (isset($_GET['action']) && $_GET['action'] == "get") {
        $sql = "SELECT * FROM messages";
        $guests = array();
        foreach ($dbh->query($sql) as $row)
        {
            $guests[] = array(
                'id' => $row['id'],
                'name' => $row['name'],
                'email' => $row['email'],
                'url' => $row['url'],
                'message' => $row['message'],
                'date' => $row['date_entry']
            );
        }
        echo json_encode(array('success' => true, 'guests' => $guests));
    }

I am not able to get individual date from the array. Its always saying undefined.

Also can i declare a global variable and use it throughout the project?

I am creating a login page and using that information which i get from login, i need to fill up contents in the app. So i would need the id throughout. Or is it possible to send the value from one panel to another.

Thanks

Roy M J