Skip to content

API: Single Result

Adrian Preuß edited this page Jan 10, 2018 · 3 revisions
API.single(statement, parameters, callback);
Variable Default Type Description
statement <MySQL-Query> String Your MySQL-Query
parameters {} Object Parameters for your MySQL-Query
callback <Callback> Function Callback with the result

Returns

The data parameter on your Callback will return null if no rows/entries found or a Object with the single result.

Examples

API.single('SELECT * FROM `yourTable` WHERE `id`=:id', {
	id: 1
}, function onSuccess(data) {
	// Your result
});
API.single('SELECT * FROM `yourTable` WHERE `col1`=:test AND `col2`=:time', {
	test: 123,
	time: 'NOW()'
}, function onSuccess(data) {
	// Your result
});

Clone this wiki locally