latheesan
01-09-2008, 08:30 AM
Hello,
I am trying to create a class to handle dba in php based on the notes found here http://uk3.php.net/dba
I am working on the function that inserts the data into a databse file based on these note for the function dba_insert() (http://http://uk3.php.net/manual/en/function.dba-insert.php)
This is how my code looks like for the Insert() function in my dba class :
function Insert($inField , $inValue)
{
if (!dba_insert($inField , serialize($inValue) , $this->dbaConnection))
{
$this->setError('Cannot insert data into database');
return false;
}
return true;
}
This is how i am trying to use it :
<?php
// Include class file
require_once('dba.class.php');
// Set DBA Type
$dba_type = 'flatfile';
// Make a new class
$mydba = new MyDBA();
// Connect to db
$mydba->Connect('test2',$dba_type) or die($mydba->getError());
// Insert some data
$mydba->Insert('message' , 'Hello World') or die($mydba->getError());
// Close connectiob to db
$mydba->Close();
?>
This is the error i am getting :
Warning: dba_insert() [function.dba-insert]: You cannot perform a modification to a database without proper access in C:\WWW\htdocs\dba\dba.class.php on line 65
Can someone tell me what this error is about? and how i can fix it?
I am on Windows OS (where my localhost test web server is) and i am running php 5.x
Oh yea, one other thing. I am not able to make any other type of database. I've tried to make these types:
- dbm
- ndbm
- gdbm
- db2 , db3 , db4
- cdb
- cdb_make
- qdbm
Only "flatfile" type is seems to be working =\ why is this?
I am trying to create a class to handle dba in php based on the notes found here http://uk3.php.net/dba
I am working on the function that inserts the data into a databse file based on these note for the function dba_insert() (http://http://uk3.php.net/manual/en/function.dba-insert.php)
This is how my code looks like for the Insert() function in my dba class :
function Insert($inField , $inValue)
{
if (!dba_insert($inField , serialize($inValue) , $this->dbaConnection))
{
$this->setError('Cannot insert data into database');
return false;
}
return true;
}
This is how i am trying to use it :
<?php
// Include class file
require_once('dba.class.php');
// Set DBA Type
$dba_type = 'flatfile';
// Make a new class
$mydba = new MyDBA();
// Connect to db
$mydba->Connect('test2',$dba_type) or die($mydba->getError());
// Insert some data
$mydba->Insert('message' , 'Hello World') or die($mydba->getError());
// Close connectiob to db
$mydba->Close();
?>
This is the error i am getting :
Warning: dba_insert() [function.dba-insert]: You cannot perform a modification to a database without proper access in C:\WWW\htdocs\dba\dba.class.php on line 65
Can someone tell me what this error is about? and how i can fix it?
I am on Windows OS (where my localhost test web server is) and i am running php 5.x
Oh yea, one other thing. I am not able to make any other type of database. I've tried to make these types:
- dbm
- ndbm
- gdbm
- db2 , db3 , db4
- cdb
- cdb_make
- qdbm
Only "flatfile" type is seems to be working =\ why is this?
