Re: PEAR DB_DataObject
| From: | Alan Knowles | Date: | Sun, 11 May 2003 14:24:26 +0000 |
| Subject: | Re: PEAR DB_DataObject | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5303@lists.php.net to get a copy of this message | ||
Warwick Bruce Chapman wrote:
Howdy [NEW SUBSCRIBER ALERT | NEW SUBSCRIBER ALERT] Are there any DataObject specific tutorials around other than the examples supplied in the docs... I'm having a rough time learning to use it: At present No, damien was planning to write one, I've had a few offers to do some writing for magazines, and this may be the best place for a full tutorial..
Think I will use pastebin: http://www.pastebin.com/9347 Basically this little app needs to take details for jobs on the go and store then in the db, as well as list all jobs not currently completed (status=P) above the submission form All the code necessary to get DB_DataObject going is above. The problem? Well when I load the page first time, I get a listing of the jobs in the db, but after I press submit for a new job, I get only that job in the listing until I restart the script from scratch. Any ideas? try usingDB_DataObject::debugLevel(5); should show what is going on.. - It looks like you are using register_globals = on, its far better to do if (isset($_POST['projectSubmit'])) { $job->setFrom($_POST); // and make the post elements match the database coluns $job->insert(); } It's also a good idea to use a NEW $job object, after you have inserted.: = if (isset($projectSubmit)) {
$job->client = $projectClient;
$job->description = $projectDescription;
$job->person = $projectPerson;
$job->insert();
****
$job = new DataObjects_Projects;} Regards Alan
Warwick Chapman Managing Member Thusa Business Support cc Cell: +27 83 7797094 Fax: +27 31 2055838 -- There are 10 types of people in this world. Those who understand binary, and those who don't.