application/json MySQL connection and query

Completed Posted Dec 15, 2015 Paid on delivery
Completed Paid on delivery

I need to get a script completed.

it will be used to query a mysql database.

Something like this;

script stay and work on my web server like below.

[login to view URL]<model_code>

it means;

[login to view URL]

After this request, script will answer like below :

{

"model_code": "4345edbf1e7713d8b48b14214e3248458167”,

"status": "printed”,

"num_prints": 1

}

Or

{

"model_code": "4345edbf1e7713d8b48b14214e3248458167”,

"status": "canceled”

}

Or

{

"model_code": "4345edbf1e7713d8b48b14214e3248458167”,

"status": "pending”

}

if the request hasn't been found ("Not found”) error should appear.

I made a draft writibg below, so you need to complete or write your own..

<

$servername = “mysql_ip";

$username = "username";

$password = "password";

$dbname = "myDB";

$conn = new mysql($servername, $username, $password, $dbname);

if ($conn->connect_error) {

die("Connection failed: " . $conn->connect_error);

}

$sql = "SELECT model_id, statue FROM table_name";

$result = $conn->query($statue);

if ($result = 1)

{

echo "model_code": $sql,

echo "status": "printed”,

echo "num_prints": "1"

}

else if ($statue = 2)

{

echo "model_code": $sql,

echo "status": “pending”,

}

else if ($statue = 3)

{

echo "model_code": $sql,

echo "status": “cancelled”,

}

else

{

echo “Not Found"

}

$conn->close();

?>

Java PHP Software Architecture

Project ID: #9124894

About the project

12 proposals Remote project Active Dec 15, 2015

Awarded to:

shahid864

Hi, My name is Shahid, i am working in web development from past five 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. Thank More

$25 USD in 1 day
(661 Reviews)
7.3

12 freelancers are bidding on average $26 for this job

MohanKumar28

Hi, I have good experience in working with php and mysql. We can do this. I can start now. Thanks, Mohan

$25 USD in 0 days
(135 Reviews)
6.1
SolutionToday

Hi, I am working as a web developer from the past five years. I believe in providing quality work with long term relation with clients . let discuss and start now. Please give a chance. thanks

$12 USD in 1 day
(71 Reviews)
5.5
thinkguru

transparent in my job, can complete in 0 days and in your budget. have a 5 years of experience as a lead developer.

$25 USD in 1 day
(6 Reviews)
4.6
sreekanthmk91

Hi.. I CAN DO THIS WORK IN LESS THAN 30 MINUTES I am an experienced web developer with an overall experience of 3 years in advanced technologies of web development . Kindly contact me if interested. Thanks More

$25 USD in 0 days
(13 Reviews)
4.5
emransl

A proposal has not yet been provided

$20 USD in 1 day
(18 Reviews)
3.8
HetalVyas

Dear Employer, * Your Requirements You need to fix your REST kind of API based on model id. I am sure to provide you the solution as per your desired output. * Time I can provide you work within 5 hours

$15 USD in 1 day
(13 Reviews)
3.8
MohamedIbrahimCS

We are Egyptian team, and i am sure that you will get our work is a great as you expect, all of team have a diploma in javaSE, JavaEE, JavaFX using many technologies like Struts1, Struts2, Hibernate, JPA, Spring, Sprin More

$55 USD in 1 day
(18 Reviews)
4.2
DennisAusOdessa

I am very thorough and ensure to complete each project with very high standards. I also speak some Spanish. I look forward to hearing back from you.

$25 USD in 3 days
(2 Reviews)
2.1
bonificial

A proposal has not yet been provided

$25 USD in 1 day
(0 Reviews)
2.0