|
PHP креирање на табела во база на податоци
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "mojaDB";
$conn = new
mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error)
{
die("Neuspesna
konekcija: " . $conn->connect_error);
}
$sql
= "CREATE TABLE Ucenici
(
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
ime VARCHAR(30) NOT NULL,
prezime VARCHAR(30) NOT NULL,
email VARCHAR(50)
)";
if ($conn->query($sql)
=== TRUE) {
echo
"Tabelata Ucenici
uspesno kreirana ";
} else {
echo
"Greska vo kreiranje na
tabela: " . $conn->error;
}
$conn->close();
?>
|
|