Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-14-2007, 02:07 PM
Junior Member
 
Join Date: Dec 2007
Posts: 7
Default Need to access a database outside a controller

I have an AJAX function on a View page that refers to a PHP script. This script is placed inside the public/php folder and it looks like this:

Code:
<?php

require_once('Zend/Loader.php');
Zend_Loader::loadClass('Zend_Json');
Zend_Loader::loadClass('Zend_Db_Table');
Zend_Loader::loadClass('Users');

$values = array(
				'firstname' => $_GET['firstname'],
				'lastname' => $_GET['lastname']
				);

$users = new Users();
$users->insert($values);

echo Zend_Json::encode($values, Zend_Json::TYPE_OBJECT);
When i try to instantiate the Users class, which is a model inside the application/models folder, it does not work. It does not even reach the insert statement. When i remove those 2 statements i do get a JSON reply from the script. Can anybody help me with this and tell me what i am doing wrong. If this is not the correct wat to go about things in the Zend Framework i would love to hear the correct wat, i searched a lot but i cannot seem to find it.

Last edited by TB191 : 12-14-2007 at 02:29 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:03 PM.