i am trying to insert into a database through a from i just cant see the problem. i am getting “No database selected” i dont even have that error cheking in the code…
[code=php]
<?
$host = “localhost”;
$username = “silvapro_franknu”;
$password = “abc123”;
$database = “silvapro_prueba”;
// artist..
$artist_name = addslashes($artist_name);
$artist_release= addslashes($artist_release);
$artist_bio = addslashes($artist_bio);
$artist_news= addslashes($artist_news);
$artist_extra= addslashes($artist_extra);
$artist_picture= addslashes($artist_picture);
$db=mysql_connect (“$host”, “$username”, “$password”) or die (‘I cannot connect to the database because: ‘ . mysql_error());
mysql_select_db (“$database”);
if(!$db)
{
echo ” Error: could not connect to database.”;
exit;
}
//business owner
$sql=”INSERT INTO `artist`(`artist_name`,`artist_release`,`artist_bio`,`artist_news`,`artist_extra`, `artist_picture`)
VALUES (‘”.$artist_name.”‘,'”.$artist_release.”‘,'”.$artist_news.”‘,'”.$artist_extra.”‘)”;
$result = mysql_query($sql);
echo mysql_error();
if($result)
{
echo mysql_affected_rows().” .artist information Inserted. <br>”;
}
?>
can anyone please help?