Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Custom methods

ratajs edited this page Feb 27, 2018 · 6 revisions

This feature will not work in smysql-old-1.php


You can also define your own methods:

$obj->selectUser = "SELECT * FROM users WHERE name LIKE '%0' AND password LIKE '%1'";

And then call it:

$obj->selectUser($_POST['name'], hash("sha256", $_POST['password']));

Or with text variables:

$obj->selectUser = "SELECT * FROM users WHERE name LIKE '%name' AND password LIKE '%pass'";

Then, call it as an array:

$obj->selectUser(['name' => $_POST['name'], 'pass' => hash("sha256", $_POST['password'])]);

The parameters will escape automaticaly.

Clone this wiki locally