Narrow selection

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



$db->all("SELECT * FROM table");


It will output array of table.



$db->row(SELECT * FROM table WHERE field='$value'");


It will output just a line as array. No need to add "LIMIT 1".



$db->field("SELET field FROM table WHERE ...");


It returns single variable. It's not like $result['field'] - it's like $result just.



$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();



$db->array2update("table", $array, "id='$value'");


same as above, third field is where to update.



$db->query("ANY QUERY");


just mysql_query.

Design theme color

Primary color

Alternative color