logo
down
shadow

How to auto input MySQL data (input column 1 data to auto input column 2 data with same column) in php?


How to auto input MySQL data (input column 1 data to auto input column 2 data with same column) in php?

Content Index :

How to auto input MySQL data (input column 1 data to auto input column 2 data with same column) in php?
Tag : javascript , By : ZsA
Date : January 12 2021, 09:11 PM

seems to work fine Good News : I have answer to solve auto input MySQL data (input column 1 data to auto input column 2 data with same column) and support UTF8 in PHP with me.
Step to answer with coding.
CREATE DATABASE IF NOT EXISTS `mydatabase`;
CREATE TABLE `customer` (
  `CustomerID` varchar(4) NOT NULL,
  `Name` varchar(50) NOT NULL,
  `Email` varchar(50) NOT NULL,
  `CountryCode` varchar(2) NOT NULL,
  `Budget` double NOT NULL,
  `Used` double NOT NULL,
  PRIMARY KEY  (`CustomerID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- 
-- Dumping data for table `customer`
-- 

INSERT INTO `customer` VALUES ('C001', 'Win', 'win.weerachai@a.com', 'UK', 100000, 600000);
INSERT INTO `customer` VALUES ('C002', 'John', 'john.smith@a.com', 'UK', 200000, 80000);
INSERT INTO `customer` VALUES ('C003', 'Jame', 'jame.born@a.com', 'US', 300000, 60000);
INSERT INTO `customer` VALUES ('C004', 'Chalee', 'chalee.angel@a.com', 'US', 4000, 1000);
<?php
    ini_set('display_errors', 1);
    error_reporting(~0);

$mydb = new mysqli("localhost","root","", "mydatabase") or die( mysqli_connect_error());

mysqli_set_charset($mydb, "utf8");

$strSQL = "SELECT * FROM customer WHERE 1 AND Name = '".$_POST["sCusID"]."' ";
$result = $mydb->query($strSQL) or die ($mydb->error);
//$intNumField = $result->field_count();
$resultArray = array();
while($row = $result->fetch_assoc()){ // use assoc to have array with keyname not keynumber
    $resultArray[]=$row;
}
$mydb->close();
echo json_encode($resultArray);
?>
<html>
<head>
<style> 
input {
  padding: 12px 20px;
  margin: 8px 0;
  box-sizing: border-box;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){

    $("#txtName").change(function(){
            $.ajax({ 
                url: "returnCustomer2.php" ,
                type: "POST",
                data: 'sCusID=' +$("#txtName").val()
            })
            .success(function(result) { 

                var obj = jQuery.parseJSON(result);

                    if(obj == '')
                    {
                        $('input[type=text]').val('');
                    }
                    else
                    {
                          $.each(obj, function(key, inval) {

                               $("#txtName").val(inval["Name"]);
                               $("#txtEmail").val(inval["Email"]);
                          });
                    }

            });

        });
    });
</script>
</head>
<body>

<?php
    ini_set('display_errors', 1);
    error_reporting(~0);

    $serverName = "localhost";
    $userName = "root";
    $userPassword = "";
    $dbName = "mydatabase";

    $conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);

    $sql = "SELECT * FROM customer";

    $query = mysqli_query($conn,$sql);

    $sql2 = "SELECT * FROM customer";

    $query2 = mysqli_query($conn,$sql2);

?>

<form>

<h2>Name</h2>

  <input list="abc" id="txtName" name="txtName" size="30" autocomplete="off">
  <datalist id="abc">
    <?php 
    while ( $d=mysqli_fetch_assoc($query)) {
        echo "<option value='".$d['Name']."'></option>";
    }
    ?>
  </datalist>

<h2>E-mail</h2>

  <input list="abc2" id="txtEmail" name="txtEmail" size="30" autocomplete="off">
  <datalist id="abc2">
    <?php 
    while ( $d=mysqli_fetch_assoc($query2)) {
        echo "<option value='".$d['Email']."'></option>";
    }
    ?>
  </datalist>
</form>

</body>
</html>

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

EXCEL VBA: Column auto-fills even after specifying not to if input column is empty


Tag : vba , By : James Cary
Date : March 29 2020, 07:55 AM
hope this fix your issue I am new to VBA and this is my third code. It is a simple code which calculates when the next birthdate should be once I input the initial date of birth and also lets me know how many days are left before I need to make the necessary birthday preparations :) , Change Cells(nr, "C") = "" & Cells(nr, "D") = "" to
Cells(nr, "C") = "" 
 Cells(nr, "D") = ""

mysql load data infile it contain more data than there were input column


Tag : mysql , By : enginecrew
Date : March 29 2020, 07:55 AM
this one helps. It sounds like maybe LOAD DATA isn't properly picking up on your line breaks. Try adding LINES TERMINATED BY ... to your call:
LOAD DATA INFILE 'test.csv' INTO TABLE test
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'         -- use '\n' if on Linux
(ind, var)

SSRS cannot map the input column, to the lookup column because the data types do not match but both are int


Tag : reporting-services , By : user185949
Date : March 29 2020, 07:55 AM
Hope this helps There are different integers in SSIS. SSIS has to match multiple data sources and destinations so your 'Integer' is quite a broad term here. You need to check the metadata of columns that you are matching and ensure that the datatypes are the same. For example, a standard, 32-bit signed integer is displayed in SSIS as DT_I4 but bigint is DT_I8.

Can MYSQL keep track of multiple Auto Increments based on a column input value?


Tag : mysql , By : pttr
Date : March 29 2020, 07:55 AM
wish helps you Both MyISAM and InnoDB support only one auto-increment per table.
Managing any autoincrement-per-group feature cannot work in a storage engine that supports concurrent updates, because of race conditions.
mysql> create table MyTable (
    -> post_id int auto_increment primary key,
    -> tag_name varchar(10),
    -> tag_id int auto_increment,
    -> unique key (tag_name, tag_id)
    -> ) engine=myisam;
ERROR 1075 (42000): Incorrect table definition; there can be only one
auto column and it must be defined as a key

Input data into single mysql column on certain row


Tag : php , By : Reiner
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • How to Make a jQuery Table Cell(td) clickable to Run a Function?
  • Prevent the duplicate function onchange event jQuery
  • Reactjs Input Upload doesn't return local URL
  • An unexpected 'StartObject' node was found when reading from the JSON reader. A 'PrimitiveValue' node was expected
  • How to filter a JSON Array, with an eventListener input value at keyup
  • How to separate the different properties of filter in css?
  • Why dont work change event of bootstrap input spinner?
  • How to hide overflow text content in react
  • Is there another way to write line 6
  • Cypress - how to find by text content?
  • How to setstate for the dynamic checkboxes in a loop in react?
  • Is display:none safe?
  • How to create a form to change part of a href url of a button?
  • Put many function inside function in Javascript
  • how to exit from loop after a ajax call
  • Do Angular Reactive Form Validator.min/max check Perform Type Conversions before checking the value?
  • How to Replace Text Within Script Tags Using JQuery
  • add variable to object if not undefined using short-hand
  • How can I effectively curve my items inside a list?
  • Add new record Keyboard Shortcut on Kendo Grid Mvc
  • Time and Date running on page
  • Looping through page links puppeteer doesn't return values from the newly loaded page
  • Problem with Navigator.geoLocation.getCurrentPosition not working
  • Trying to change the id of an element with Javascript
  • Embedded Schema Inserting Blank in Meteor using Collection2
  • avoid useEffect to render at first load?
  • Why is this CSS transition only working correctly on the some clicks? How to solve it?
  • Interpolated values does not reflect the latest values in an Angular app
  • Javascript classes define attribute in constructor or outside the class
  • How to block scroll event passing through to iframe until iframe is active?
  • What is the purpose of "constructor" method in javascript?
  • Stencil JS not working with non-default imports
  • Are frameworks misleadingly named for marketing purposes?
  • React <Redirect> after transition not working
  • How to send multiple parameters in a function using EJS
  • React conditional style on custom click
  • Push a block of information to an array X times based on an external variable
  • How do I populate dropdown with names, and values (numeric ids)?
  • How to apply styling to elements created with .insertAdjacentHtml method
  • Positioning key:value of an object
  • Referencing DOM Elements with React Hooks
  • TypeError: Method "getRange" of null when using multiple scripts (Libraries) in Google scripts
  • Why can't I check if an environment variable is undefined?
  • Is there a way to find what parts are the same between two strings?
  • Every change done with magicscroll and greensock get reset when I hit the bottom of the page
  • Fix a 'Cannot read property handleClick of undefined error' (and issues related to deleting an item from the DOM)
  • Answer to message if sent within a period of time
  • Enabling a button based on selected values
  • Get All possible matches between forward slashes
  • get the CSS maxWidth value of the parent javascript
  • Async function returning existing array as undefined
  • Using drop-down list to change multiple values in separate table cells
  • How to remove nested empty objects in JavaScript?
  • Convert value from text field to paragraph
  • Sorting a list based on instructions in Javascript
  • Post request doesn't work in NodeJS, OK with Request
  • How to make footer align to center in nested component scenario in React
  • fresh installed pwa does not show content
  • Working around unset "length" property on partial functions created with lodash's partialRight
  • V8 console.log does not print
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com