ViewUserData.php
<?php
$DatabaseServer = "localhost";
$DatabaseUsername = "root";
$DatabasePassword = "root";
$DatabaseName = "demo";
$Connection = mysqli_connect($DatabaseServer , $DatabaseUsername , $DatabasePassword , $DatabaseName);
if($Connection=== false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
$SQL = mysqli_query($Connection, "SELECT * FROM User");
$Result = array();
while($Row = mysqli_fetch_assoc($SQL)) {
$Result[] = array(
'FirstName' => $Row['FirstName']
);
}
echo json_encode($Result);
?>
Output:
JSON Array:
[{"UserID":"1","FirstName":"Ram","LastName":"Sri"}]
ViewUserData.html
<Html>
<head>
<script language="JavaScript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script>
$(document).ready (function () {
$.getJSON ("ViewUserData.php",
function (json) {
for (var i = 0; i < json.length; i++) {
$("#UserID").append("<option>" + json[i].FirstName+ "</option>");
}
});
});
</script>
</head>
<body>
<select id='UserID'>
//Your Json Array comes here
</select>
</body>
</html>
Output:
MySQL: Run these two queries
CREATE TABLE `user` (
`UserID` int(12) NOT NULL,
`FirstName` varchar(48) NOT NULL,
`LastName` varchar(48) NOT NULL,
`Email` varchar(128) NOT NULL,
`City` varchar(48) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `user` (`UserID`, `FirstName`, `LastName`, `Email`, `City`) VALUES
(1, 'Ram', 'Sri', 'zzz@zzz.com', 'Delhi'),
(2, 'Krishna', 'Vasudev', 'yyy@yyy.com', 'Delhi');
Good blog, its really very informative, do more blog under good concepts.
ReplyDeleteData Science Course in Chennai
Data Science Courses in Bangalore
Data Science Training in Bangalore
Best Data Science Courses in Bangalore
Data Science Institute in Bangalore
Data Science Training Institutes in Bangalore
Data Science Training in BTM
AWS Training in Bangalore
DevOps Training in Bangalore
PHP Training in Bangalore
I have to agree with everything in this post. Thanks for useful sharing information.
ReplyDeleteArtificial Intelligence Course in Chennai
AI courses in Chennai
Python Training in Bangalore
Python Course in Bangalore
Angularjs Training in Bangalore
Web Development courses in bangalore
salesforce institute in bangalore
Python Training in Chennai
Python Training in Coimbatore
Python Training in Hyderabad
Thanks Friend!
ReplyDeleteI have seek solution for the same what you have posted friend.., share some more.it may help us a lot
Ai & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
who has implemented it earlier as well and is a certified partner. Here the help of Salesforce domain experts can provide you complete guidance and can implement the Salesforce successfully as well. So you must look for the right partner for your organization, Salesforce interview questions and answers
ReplyDeleteSEO for Dental Clinics
ReplyDeleteSEO for Pharma Companies
SEO for Healthcare
SEO Company in Chennai
Digital Marketing Training in Chennai
SEO Consultant Chennai
Web Designing in Chennai
I have been exploring for a little bit for any high-quality articles or blog posts on this kind of area . Exploring in Yahoo I at last stumbled upon this web site. Reading this information So i am happy to convey that I have an incredibly good uncanny feeling I discovered just what I needed. I most certainly will make certain to do not forget this site and give it a glance regularly.garmin fenix
ReplyDeleteWhat’s Going down i'm new to this, I stumbled upon this I've found It positively helpful and it has aided me out loads. I'm hoping to give a contribution & aid different users like its helped me. Great job.casket in singapore
ReplyDeletereally useful.thank you for blogging
ReplyDeletePython Training in chennai | Python Classes in Chennai
Looking a more unique post from your article.Great Article, very useful information, thank you !!
ReplyDeleteReactjs Training in Chennai |
Best Reactjs Training Institute in Chennai |
Reactjs course in Chennai
thank you for sharing this post it is knowledgeable information mcafee.com/activate If you want any information related to the game, then visit this website.
ReplyDeleteThank you for your post, myself very happy to read it because it can give me more insight, thanks.. Visit my blog..thankyou
ReplyDeleteNaga777
Hokibet77
Wonderful beat ! I wish to apprentice while you amend your web site, how could i subscribe for a blog web site? The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear idea
ReplyDeleteSlot Fafafa Uang Asli
Fa Fa Fa Uang Asli
Megawin77
Mega777 Slot
Slotwin88
Cricut.com/setup
ReplyDeleteTurbotax.ca/download
Cricut.com/setup
Turbotax.ca/download
itv.com/hub/pair
www.itv.com/hub/pair
Hp officejet pro 8600 driver - We provided easy instruction for hp officejet pro 8600 setup, install, Driver Download, WPS Setup Troubleshooting.Driver and Manuals downloads From 123.hp.com/laserjet.
ReplyDeletewww.hp.com/go/wirelessprinting - Download and install your printer driver software. Install your HP printer by visiting 123.hp.com/setup. Make connections to the network.
ReplyDeleteNeed to download Brother Printer drivers open solutions.brother.com/windows to download latest & updated drivers for Brother Printer all models.
123.hp.com/laserjet Start installing, setting up and Print at 123.hp.com/setup. Download drivers and printer software assistance from 123.hp.com/laserjet.
hbomax.com/tvsignin - HBO Max is the newly released app, where you can watch endless content. This video-streaming services supports downloads for offline viewing, so that you can stream anywhere.