Baza de date MySQL
Scris: Sâm Mai 08, 2010
Va salut!
Am facut o baza de date.
Am facut un test sa vad daca ma pot conecta la baza de date:
Conexiune efectuata cu success!
Am incercat sa fac un tabel in baza de date:
Imi de erori:
Warning: mysql_query() [function.mysql-query]: Access denied for user '...' (using password: NO)
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established
Cum sa fac?
Am facut o baza de date.
Am facut un test sa vad daca ma pot conecta la baza de date:
Cod: Selectaţi tot
<?
mysql_connect('serverul MySQL','utilizator','parola') or die("Nu m-am putut conecta la serverul MySQL");
mysql_select_db('nume BD') or die("Nu m-am putut conecta la baza de date");
echo "Conexiune efectuata cu success";
?>
Am incercat sa fac un tabel in baza de date:
Cod: Selectaţi tot
<?php
header("Content-type: text/html; charset=utf-8");
$host = "...";
$utilizator = "...";
$parola = "...";
$numebd = "...";
$sql = "CREATE TABLE `catalog` (id0 VARCHAR(30), id1 VARCHAR(20), id2 VARCHAR(10), id3 VARCHAR(10), id4 VARCHAR(15), id5 VARCHAR(40), CHARACTER SET utf8 COLLATE utf8_general_ci";
if (mysql_query($sql))
echo '<br /><br /><br /><center><h4>Tabelul <u>catalog</u> a fost creat.</h4></center><br />';
else
echo '<br /><br /><br /><center><h4>Tabelul <u>catalog</u> nu a putut fi creat deoarece - '. mysql_errno(). ' : '. mysql_error(). '</h4></center>';
mysql_close();
?>
Warning: mysql_query() [function.mysql-query]: Access denied for user '...' (using password: NO)
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established
Cum sa fac?