Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="jquery-3.1.0.min.js"></script>
- <script>
- $(document).ready(function() {
- $('#submit').click(function(e){
- e.preventDefault();
- $.ajax({
- type:"POST",
- data:{idheadcode: $('#headcode').val(), idlocation: $('#location').val()},
- url: "headcode_Db_connect.php",
- success: function(data){
- $("#content").html(data);
- }
- });
- });
- });
- </script>
- </head>
- <body>
- <form name="input">
- HeadCode: <input type="text" id="headcode">
- End Location:<input type="text" id="location">
- <input type="submit" id="submit">
- </form>
- <div id="content"></div>
- <?php
- $headcode = $_POST['headcode'];
- $location = $_POST['location'];
- $host="localhost"; // Host name
- $username="root"; // Mysql username
- $password="789852"; // Mysql password
- $db_name="work"; // Database name
- $tbl_name = "headcodes";
- // Connect to server and select database.
- $link = mysql_connect("$host", "$username", "$password")or die("cannot connect");
- mysql_select_db("$db_name")or die("cannot select DB");
- $sql = "SELECT * FROM $tbl_name WHERE headcode= '$headcode'AND (location1= '$location' OR location2 = '$location' OR location3= '$location' OR location4 = '$location' OR location5 = '$location')" ;
- $result1 = mysql_query($sql, $link);
- if($result1){
- //echo "Successful";
- }
- else {
- echo "ERROR";
- }
- while ($row = mysql_fetch_assoc($result1)){
- $number = $row['number'];
- }
- $myJson = json_encode ($number);
- echo $number;
- echo "10";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement