• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database Forge Class does not create the table

#3
You can do it using a sql.

PHP Code:
$sql "CREATE TABLE MyGuests (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, 
firstname VARCHAR(30) NOT NULL,
lastname VARCHAR(30) NOT NULL,
email VARCHAR(50),
reg_date TIMESTAMP
)"
;

$result $this->_customQuery($sql);

// -------------------------------------------------------------------

/**
 * _customQuery()
 * -------------------------------------------------------------------
 *
 * @param  $mysqlQuery
 * @return object
 */
public function _customQuery($mysqlQuery)
{
 
   $data = [];

 
   $query $this->db->query($mysqlQuery);

 
   if ($query->num_rows() > 0)
 
   {
 
       $data $query->result();
 
   }

 
   $query->free_result();

 
   return $data;


Place the _customQuery() method in a MY_Model and extend it.

You can do any sql query like that.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: Database Forge Class does not create the table - by InsiteFX - 03-30-2019, 01:03 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.