I have a PHP project which has around 542 occurrences of the mysql_query function.
These need to be rewritten using the corresponding MySQLi methods and prepared statements.
To give an example ($dbh is a PDO object that is available to you in every file):
$sql = "SELECT * FROM users WHERE id LIKE '$id' LIMIT 1";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);
$sql = "SELECT * FROM users WHERE id LIKE :id LIMIT 1";
$stmt = $dbh->prepare($sql);
$stmt->execute(array(':id' => $id));
$row = $stmt->fetch();
If you have any questions let me know.
To answer a common question:
The mysql_query function is used in 140 of the 288 PHP files.
I can provide a list with all occurrences (file name + line number).
I did a recount and it is actually 662 occurrences of the mysql_query function.
I used "grep -or 'mysql_query' . | wc -l" for the counting.
Sorry for the inconvenience.
Hello! No need for list of file/occurrencies to be hones. There's not much that need discussing either. Can work on this as soon as you move forward with the project. Regards, Dobri
63 freelancers are bidding on average €163 for this job
Hello Sir., I am ready to start it.i am highly interested in your project But i have some questions for you. So kindly leave message for me, then i'll discuss it in depth.