views:

22

answers:

2

Hello. I am using a SWFupload script and I can't make a request from flash with mod_rewrite, I don't know why... I just need to point the Flash request to that file directly. This file runs an upload script that works ok but now I need to save some info to the database and I would like to know what should I write to have access from that file that is not called from the controller and does not extend the model in order to run a mysql query.

Thanks.

A: 

If you include the ci core you can access the CI object like this:

$CI =& get_instance();

$CI->db->get('stuff');
Aren
How do I include the core ? :">
Manny Calavera
A: 

If you want to access the database directly from a PHP file separate to CodeIgniter you'll have to set up the database connection in the traditional manner. eg.

$con = mysql_connect("localhost","username","password");

if (!$con) {
  die('Could not connect: ' . mysql_error());
}

mysql_select_db("my_db", $con);

mysql_query("INSERT INTO files (filename, size)
VALUES ('my_cv.doc', 35)");

mysql_close($con);
WeeJames