Forums / Cotonti / Extensions / Inserting data into the database

Dyllon
#32536 2012-01-12 04:39

The safest way I'm aware of is by defining what the variable contains when inserting, or updating it to your sql table. You can accomplish that by doing something like this:

$variable_int = 0;
$variable_string = 'string';

$db->insert($db_table_name, array(
	'field_name' => (string) $variable_string,
	'field_name' => (int) $variable_int
));
We are what we repeatedly do. Excellence then, is not an act, but a habit.