Convert MySQL PHP Code to include MySQLi Prepared Statements

In Progress Posted Oct 19, 2015 Paid on delivery
In Progress Paid on delivery

ONLY BID IF YOU CAN START AND COMPLETE IMMEDIATELY!

Simple Task - Convert this short piece of code to include prepared statements for efficiency and security. I'm aware it's poorly designed thats what I need you to fix. Plenty more work for best cost and quality work,

$mysqli = new mysqli($servername, $username, $password, $dbname);

/* check connection */

if ($mysqli->connect_errno) {

printf("Connect failed: %s\n", $mysqli->connect_error);

exit();

}

if ($_GET['sort'] == 'date') { $sort_query = 'outbounddeparture ASC';}

else {$sort_query = 'priceperadult ASC';}

$form_airport = $_GET['form_airport'];

$form_lessthan = $_GET['less-than'];

$from_month = $_GET['month'];

$date = $from_month;

$startdate = date("m", strtotime ( $date ) );

$enddate = date("m", strtotime ( '+1 month' , strtotime ( $date ) ));

$destination = $_GET['form_destination'];

if ($from_airport == 'LON') {$airport_query = " AND outbounddepartureairport IN ('LHR','LGW','STN','LTN','SEN')";}

else{$airport_query = "AND outbounddepartureairport = '{$form_airport}'";}

$query = "SELECT MIN(priceperadult), hotelname, priceperadult, duration, outbounddepartureairport, deeplinkurl, hotelidentifiercode, outbounddeparture

FROM search_results

WHERE priceperadult < '{$form_lessthan}'

".$airport_query."

AND outbounddeparture >= '2016-{$startdate}-01'

AND outbounddeparture < '2016-{$enddate}-01'

AND outbounddeparture < '2016-{$enddate}-01'

AND holidayresort = '{$destination}'

GROUP BY hotelname

ORDER BY {$sort_query}

";

$result = $mysqli->query($query);

while ($row = $result->fetch_assoc()) :?>

...........

MySQL PHP

Project ID: #8716830

About the project

15 proposals Remote project Active Oct 19, 2015

15 freelancers are bidding on average £16 for this job

rajeshsonisl

Hello! With 98% to 99% completion rate, 850+ successfully completed projects, and a 5.00 reputation (maximum possible, 5.0) (Yes, not even 4.99 average rating, can be verified on my profile page [login to view URL] More

£27 GBP in 1 day
(672 Reviews)
7.8
techvolcano

Hi, We can convert it into mysqli or pdo with proper placeholder in sql Ready to start now. Regards

£20 GBP in 1 day
(224 Reviews)
6.6
rockeinstone

A proposal has not yet been provided

£18 GBP in 1 day
(115 Reviews)
6.2
bestphpjobs

I read your project description and that make sense , at there you described issue very well. I know all stuff good that you want for this job, PHP, javascript, mysql, html, etc very well. I can manage this job very we More

£13 GBP in 1 day
(149 Reviews)
6.2
kotharigaurav90

Hello, i have checked your project and would like to have your project. I am confident to fulfill your requirements in timely manner, along with quality work. Please check your pmb.

£18 GBP in 1 day
(42 Reviews)
5.7
avenaz

A proposal has not yet been provided

£20 GBP in 1 day
(15 Reviews)
4.6
mrRawal

A proposal has not yet been provided

£13 GBP in 0 days
(16 Reviews)
3.8
clagtech

Dear Sir I am ready to convert this short piece of code to include prepared statements for efficiency and security right away. Please discuss details in chat. Waiting for your early reply. Thanks

£13 GBP in 0 days
(5 Reviews)
2.8
williamyose

Hi Sir, I already worked with PHP and MySQL for various projects. I can do it today. I will use PDO PHP tutorial to create prepared statement to make neater query. Once approved I will start. Thanks

£13 GBP in 1 day
(8 Reviews)
2.8
mikeorozco94

As requested, I can start on this immediately and have it delivered as soon as it is completed. Conversion of this to prepared statements would require testing, so if possible, can you send me the schema of your dat More

£13 GBP in 1 day
(7 Reviews)
2.1
NavnitK

A proposal has not yet been provided

£13 GBP in 1 day
(2 Reviews)
1.3
rakeshsiva91

Hi, This task is perfect for me. i can finish it in few minutes. please send me a message if you are interested.

£12 GBP in 1 day
(1 Review)
0.3