i've problem while i make an insert function using php. i dont know how to give a validation while inserting data to database. my insert function using of the other data table from the database (copying data from other table to another).
somebody know how to give a validation with that data. not from a textbox value or input value from the form. but validation from the data in the database. please help me out my trouble. im very appreciated when you give me an example.
this is my code for insert data (copying data from the other table to another).
<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "root", "", "silo");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Attempt insert query execution
$sql="Insert into termocouple
Select * from temp1";
if(mysqli_query($link, $sql)){
echo "Records inserted successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// Close connection
mysqli_close($link);
?>