Page 1 of 1

PHP + Codeigniter + MySQL -> unable to perform db operations

Posted: Wed Nov 05, 2014 10:55 pm
by vmnoodle
Hello.
This is my first post here.I am an android developer and my server stuff is always in php.
I am using the PHP + codeigniter + MySQL based architechture to perform some basic database operation like insert,read,update.
To test out the scripts functioning I am firing the script url with proper parameters in my browser , but the issue is the insert function is not working


device_model.php

Code: Select all

function insertid($id=false,$name=false,$number=false)
	{
		$res = $this->db->get_where('tbl_device', array('clm_device_id'=>$id,'clm_device_name'=>$name,'clm_device_number'=>$number))->num_rows;
		if($res==0){
			$date = date("Y-m-d");
			$this->db->insert('tbl_device', array('clm_registered'=>$date, 'clm_device_id'=>$id,'clm_device_name'=>$name,'clm_device_number'=>$number));
		}

		return;
	}
device.php

Code: Select all

function checkdevice($did=false)
	{
		if($_POST){
			$did = $_REQUEST['did'];
			$name = $_REQUEST['name'];
			$number = $_REQUEST['number'];
			$res = $this->device_model->insertid($did, $name, $number);
			return;
		}
	}
URL To fire for insertion
www.[xxxxxx].com/[xxxx]/device/checkdevice/test/test/test

Re: PHP + Codeigniter + MySQL -> unable to perform db operat

Posted: Wed Nov 05, 2014 10:59 pm
by vmnoodle
The following is my database.

Code: Select all

$active_group = 'default';
$active_record = TRUE;


$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'xxxxx';
$db['default']['password'] = 'xxxx';
$db['default']['database'] = 'xxxx';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;