This PHP script establishes the connection to the MySQL database with ($conn), at which point the individual server data needs to be entered.
The crucial prepared statement part begins with the line "INSERT INTO MyCustomers (FirstName, LastName, Email) VALUES (?, ?, ?)”. The customer database “MyCustomers” will receive input (INSERT INTO) in the columns “FirstName”, “LastName” and “Email”. Placeholders are used for VALUES, which are marked using question marks.
Next, the parameters need to be bound (bind_parameters). In addition, the database also needs information about what type of data is being dealt with. The argument “sss” used here indicates that all three parameters will be strings. Some possible alternative data types would be:
- i: INTEGER (whole number)
- d: DOUBLE (also called a float, a number with a decimal point or a number in exponential form)
- b: BLOB (collection of binary data)