Connect Mysql error, where?
Posted: Thu Dec 31, 2009 12:00 pm
Please i'm newbie and i want to connect to a mysql database: here is my code:
<?php
/* conexão à base de dados vendas*/
$mysql_id = mysql_connect('localhost', 'curso', '123');
mysql_select_db($mysql_id, 'vendas');
if (!$mysql_id){
die ('ops erro');
}
if (!$mysql_select_db){
die ('erro no slee '.mysql_error());
}
?>
The result in my webbrowser is:
Warning: mysql_select_db() expects parameter 1 to be string, resource given in C:\xampp\xampp\htdocs\vendasphp\vendas.php on line 6
erro no slee
Why? What i'm doing wrong?
Thank you
mario
<?php
/* conexão à base de dados vendas*/
$mysql_id = mysql_connect('localhost', 'curso', '123');
mysql_select_db($mysql_id, 'vendas');
if (!$mysql_id){
die ('ops erro');
}
if (!$mysql_select_db){
die ('erro no slee '.mysql_error());
}
?>
The result in my webbrowser is:
Warning: mysql_select_db() expects parameter 1 to be string, resource given in C:\xampp\xampp\htdocs\vendasphp\vendas.php on line 6
erro no slee
Why? What i'm doing wrong?
Thank you
mario