CodeIgniter Forums

Full Version: simple dbforge oddity causes newbie,s brain to fade
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

below is a simple script that is part of my learning of ci .
I have no idea where even to think of looking.

Is my code and logic ok ?
Any ideas appreciated
comments at end explain problem


class Phil extends Controller {

function Phil()




function index()



// a manual test is required with postgresql, IF EXISTS in version 8.2
If ($this->db->table_exists('phil'))

echo " table named phil exists";
echo "<br/>";
echo "dropped table named phil";
echo "table did not exist";


$fields = array(
'type'=> 'SERIAL'),
'type'=> 'INT',//note no size required
'null'=> TRUE),
'null'=>FALSE), );
If ($this->db->table_exists('phil'))
echo "<br/>";
echo "created table named phil";
// not working on first pass
// ie . if no table at start
// table IS created but NOT (echo) reported here
// works ok, if table existed at start