Wednesday, September 19, 2012

Kreiranje MySQL tabele iz PHP-a

Kako da kreirate MySQL tabelu koristeći PHP kod?
 
<?
$mysql_db = "DATABASE NAME";
$mysql_user = "MYSQL USERNAME";
$mysql_pass = "MYSQL PASSWORD";
$mysql_link = mysql_connect("localhost", $mysql_user, $mysql_pass);
mysql_select_db($mysql_db, $mysql_link);
$create_query = "CREATE TABLE klijenti (
    COUNT_ID INT NOT NULL AUTO_INCREMENT,
    naziv VARCHAR(250),
    adresa VARCHAR(250),
    pib VARCHAR(250),
    datum DATETIME,
    PRIMARY KEY (COUNT_ID)
    )";
mysql_query($create_query, $mysql_link); print("Krieranje tabele <b>klijenti</b> je zavrseno!<p>"); ?>

No comments:

Post a Comment