Rewrite all occurances of mysql_query() to MySQLi/Prepared Statements
- Status Completed
- Budget €30 - €250 EUR
- Total Bids 67
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.Get free quotes for a project like this
Looking to make some money?
- Set your budget and the timeframe
- Outline your proposal
- Get paid for your work
Hire Freelancers who also bid on this project
Looking for work?
Work on projects like this and make money from home!Sign Up Now
- The New York Times
- Wall Street Journal
- Times Online