sql_insert

The sql_insert() function is used to insert content into a database. The SQL ports may experience problems when using this function, and if so, they should use the sql_insertq() function instead. This function is described here only to ensure support for restoring old backups and for transitioning old scripts. The function accepts 6 parameters: -# $table is the SQL table, -# $noms is the list of columns affected, -# $valeurs is the list of values to be stored, -# $desc, -# $serveur, -# $option. Usage example:
sql_insert('table', '(column)', '(value)');

Example

Insert a link to a keyword for an article:
$id_mot = intval($id_mot);
$article = intval($article);
sql_insert("spip_mots_articles", "(id_mot, id_article)", "($id_mot, $article)");
Example of migrating to sql_insertq():
sql_insertq("spip_mots_articles", array(
	"id_mot" => $id_mot, 
	"id_article" => $article));

Author Mark Baber Published : Updated : 02/06/10

Translations : English, français