Rewrite all occurances of mysql_query() to MySQLi/Prepared Statements

Completed Posted 7 years ago Paid on delivery
Completed Paid on delivery

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):

Rewrite this:

$sql = "SELECT * FROM users WHERE id LIKE '$id' LIMIT 1";

$result = mysql_query($sql) or die(mysql_error());

$row = mysql_fetch_array($result);

To this:

$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.

MySQL PHP SQL

Project ID: #12225759

About the project

59 proposals Remote project Active 7 years ago

Awarded to:

justTry

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

€45 EUR in 1 day
(168 Reviews)
6.1

59 freelancers are bidding on average €166 for this job

JunaidAhmed07

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.

€555 EUR in 3 days
(394 Reviews)
8.0
OutsourceMan

Hello We will rewrite all 542 occurrences or more of of the mysql_query function to mysqli Rest be assured we have done this for lot of clients after webhosts have upgraded MySQL version 4.1.13 which uses MySQLi ex More

€100 EUR in 6 days
(405 Reviews)
8.3
marchingantssl

Hi there, I am interested in more details that you can provide for the project. Message me to discuss in details. Please take a look at our client's experience with us here https://www.freelancer.com/u/marchinga More

€168 EUR in 7 days
(234 Reviews)
7.9
softservicesvw

Greetings, We would like to avail required solution. And can start immediately. To start provide, code and db with sample data. Best Regards.

€177 EUR in 3 days
(338 Reviews)
7.8
tlchung

I am a skilled developer, I can update your site to use mysqli rather than mysql. let discuss more via private message, thanks.

€111 EUR in 3 days
(469 Reviews)
7.4
shahid864

Hi, My name is Shahid, i am working in web development from past four years. Will provide you quality work and hopefully we will have long term relationship in web development. Let me know if i can help you. let's More

€100 EUR in 3 days
(558 Reviews)
7.1
ecommercejui

Hi, Let’s start. Visit my profile and see the reviews. I am highly interested to work on this project. I understand your requirements. I am 100% sure I can complete within timeline with quality Regards Jui

€250 EUR in 3 days
(97 Reviews)
6.9
cijagani

‌I have a lots of experience in PHP MVC,MySQL, Wordpress, Codeigniter, laravel and Web Designing. my aim to deliver quality products to our customers within specified deadline. If hired by you I will put in my best w More

€111 EUR in 4 days
(133 Reviews)
6.8
imranphp

Hi, My name is Imran and I have been working as a HTML/CSS/PHP/Wordpress Developer, Designer and Coder for the last 8 years. About Your Project: -------------------------- I have read your project details and More

€99 EUR in 3 days
(187 Reviews)
6.5
shihan033010

Hi I have understand what you need. Please accept the bid and send me the files. I am ready to start it. Thanks Shihan

€100 EUR in 4 days
(321 Reviews)
6.8
hasanjack

Hi sir I am Hasan Jack and I have more than 5 years of experience in PHP Development. As because of my prior experience I really feel that I can be best choice for this job. Looking forward to hear from you. Rega More

€150 EUR in 3 days
(56 Reviews)
6.3
glennwilkins

sir pm me i can do this .. sir pm me i can do this .. sir pm me i can do this .. sir pm me i can do this ..

€50 EUR in 1 day
(177 Reviews)
6.3
usin

PHP Program Developer 100% Satisfaction Guaranteed 7 Years Experienced Invite To Chat Discuss Further Details!

€150 EUR in 5 days
(85 Reviews)
6.3
prakash2813

Hi there, I have read the project details. This is an easy job for me. 2 days are more than enough for me. Message me, we can discuss over chat.

€180 EUR in 2 days
(45 Reviews)
5.8
romanapanovich

Updated php?)) I was in the same situation ok. I can do it. I will copy code into my server, work with it and then give it to You. ------------------------------------------------------------------------------------- More

€170 EUR in 2 days
(30 Reviews)
5.8
jiitendra

Hi, I have reviewed your requirement and I can do this job as per your requirement. I have a advanced skills in WORDPRESS ,PHP, API Integration, MYSQL, JavaScript, HTML, Jquery, Magento, HTML 5 ,YII frame, PSD to H More

€155 EUR in 3 days
(39 Reviews)
6.0
SolutionToday

I am dedicated developer who believe in providing quality work within time frame. I will serve you in following PHP, Jquery, Javascript, Ajax, HTML,CSS, Joomla, Cakephp, Worpress, PSD to Responsive HTML5. I am looking More

€55 EUR in 3 days
(71 Reviews)
5.5
suraj2

I have done mysql to mysqli upgrade to many sites and php version updates to php scripts. I have good experience. Thanks, Suraj

€150 EUR in 5 days
(45 Reviews)
5.6
amjadali4888

Greetings I have read your job description and I want to talk about more that regards that I can do that project within the time frame I have more than 3 years’ experience in web development skills like PHP WordPre More

€155 EUR in 3 days
(76 Reviews)
5.2
sergioeliot3

Hi there! I'm an experienced software developer working on both .net and php technologies. And I can help you doing this conversion from the deprecated mysql_* functions to the new recommended by php standards. I More

€219 EUR in 5 days
(49 Reviews)
5.7