MySQL standards
Here I write how to use MySQL syntaxes with SPA-Cart. MySQL or MySQLi - it is same functions.
As you know PHP function is simple mysql_query. But it makes complicated to work with data.
SPA-Cart MySQL connection is wrote in $db variable.
Here are functions list
1.
$db->all("SELECT * FROM table");
It will output array of table.
2.
$db->row(SELECT * FROM table WHERE field='$value'");
It will output just a line as array. No need to add "LIMIT 1".
3.
$db->field("SELET field FROM table WHERE ...");
It returns single variable. It's not like $result['field'] - it's like $result just.
4.
$db->array2insert("table", $array);
Array is like
$array = array(
'field' => $value,
...
);
No need to put "addslashes" in that case.
To get recent inserted ID
$inserted_id = $db->insert_id();
5.
$db->array2update("table", $array, "id='$value'");
same as above, third field is where to update.
6.
$db->query("ANY QUERY");
just mysql_query.