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($Partnu mber, $Partname, $Partdescriptio n)
{
//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_Descriptio n) values ($Partnumber, $Partname, $Partdescriptio n)";
if (mysql_query($D BName, $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($Li nk);
}
Krista
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($Partnu mber, $Partname, $Partdescriptio n)
{
//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_Descriptio n) values ($Partnumber, $Partname, $Partdescriptio n)";
if (mysql_query($D BName, $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($Li nk);
}
Krista
Comment