I have been lately rewriting my project and trying to improve the database class mainly. Currently I am trying to figure out the most convenient way to handle data that goes into the database.
I am using prepared statements. To be exact, I am using MySQLi since it is the fastest extension at the moment. Faster than MySQL or PDO and I only need MySQL backend. Further more, MySQL -extension does not even support prepared statements.
Code: Select all
$db -> prepare("INSERT INTO members (name,email,ip,some_number) VALUES (?,?,?,?);");Code: Select all
$db -> bind($name,'s',255);
$db -> bind($email,'s',255);
$db -> bind($ip,'s',16);
$db -> bind($nro,'i',65535);Do you think that is a good approach? What are you doing yourself? Suggestions?
Also, that approach above is a bit painful to write. I mean, so much code for stupid binding?
I am trying to find a convenient way to bind. Thank you for the time you spend on reading/replying ladies and gentlemen.