Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Contributor: Ravishankar ChavareInsert Data into Php
#1
PHP Code:
<?php
$servername 
"localhost";
$username "username";
$password "password";
$dbname "databasename";

// Create connection 
$conn mysqli_connect($servername$username$password$dbname);
// Check connection
if (!$conn) {
    die("Connection failed: " mysqli_connect_error());
}

$sql "INSERT INTO subscriber(firstname, lastname, email)
VALUES ('pro', 'tutr', 'protutr@gmail.com')"
;

if (
mysqli_query($conn$sql)) {
    echo "New record created successfully";
} else {
    echo "Error: " $sql "<br>" mysqli_error($conn);
}
?>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)