NogDog wrote:Do you do a mysql_connect() earlier in your code? If so, do you verify that the connection is successful?
This is my entire code. Thanks for any help
<?php
$host="mysql";
$database="Music";
$dbusername="xxx";
$dbpassword="xxx";
$x=mysql_connect($host,$dbusername,$dbpassword);
$x1=mysql_select_db($database);
$query="select song from Discography where song='".$song."'";
$result=mysql_query($query);
if($row=mysql_fetch_array($result))
{
die(" Sorry that song " .$song. " already exists ! <br>");
}
$query="select MAX(artistid) as artistid from artistinfo";
$result=mysql_query($query) or die("Query failed ($query): " . mysql_error());
if($row=mysql_fetch_array($result))
{
$artistrid = ++$row["artistid"];
}
else
{
die("something wrong - artistinfo table!");
}
$query="INSERT into artistinfo VALUES('".$artistid."','".$name."','".$genre."')";
$result=mysql_query($query);
if (!($result))
{
die(" Artist information could not be stored");
}
$query ="INSERT into Discography VALUES('".$name."','".$song."','".$artistid."')";
$result=mysql_query($query);
if (!($result))
{
die("Artist song could not be stored ");
}
$query ="INSERT into login VALUES('".$artistid."','".$song."','".md5($password)."')";
$result=mysql_query($query);
if (!($result))
{
die(" Artist authentification information could not be stored");
}
echo " <center>Artist Added Successfully </center><br>";
echo " <hr><br><br>";
echo " Artistid/Login ID : <b>".$artistid."</b><br>";
echo $name,"<br>";
echo " song : ",$song,"<br>";
echo " Password : ";
for ($i=0;$i<strlen($password);$i++) {echo "*";}
echo "<br>\n";
echo " Genre : ",$genre,"<br>";
?>