Hi guys, i have a problem about inserting data into the table. I dont
know why the output always said cannot be added to the database!
Anyone has idea for me?
i check the connect is ok, but dont know why.
The following is a function i will call to insert the database.
Thx!!!
function AddPart($Partnumber, $Partname, $Partdescription)
{
//Set the variables for the database
$DBName="krista";
$TableName = "parts";
$Link = mysql_connect("localhost","","") or die ('I cannot connect to
the database because: ' . mysql_error());
mysql_select_db($DBName,$Link);
$Query = "INSERT into $TableName (Part_Number, Part_Name,
Part_Description) values ($Partnumber, $Partname, $Partdescription)";
if (mysql_query($DBName, $Query, $Link)){
print("Your information is successfully added to the database!!
<BR>\n");
}
else{
print("Your information cannot be added to the database! <BR>\n");
}
//close MySQL
mysql_close($Link);
}
Krista