$connect=mysqli_connect("localhost","db-user","my_pass","my_db");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_query($connect, SELECT * FROM имя таблицы")VALUES ('то что надо выбрать')");
mysqli_query($con,"INSERT INTO имя таблицы );
mysqli_close($con);
ну или PDO :
<?php
$servername = "localhost";
$username = "username";
$password = "password";
try {
$conn = new PDO("mysql:host=$servername;dbname=myDB", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
?>