The information you provide is not correct, so I'll show you a code that you take from the php documentation
I do not know if you use PDO or mysli.
<?php
include_once "conexion.php";
try {
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->beginTransaction();
$pdo->exec("insert into users (name, last_name, email, password) values ('Joe', 'Bloggs', '[email protected]','123445')");
echo "Datos agregados! :)";
$pdo->commit();
} catch (Exception $e) {
$pdo->rollBack();
echo "Fallo: " . $e->getMessage();
}
?>
Of course once the connection is made you include it in your project.
in this case when calling this php file, I run the script.
my database provider, in my case it is Postgresql.
using PDO .
DB postgresql
you can look for more examples. in the php documentation
I hope I help you.