Hello guys,just new to PHP and MySQL.I'm trying to insert some data to the table that I created but no luck cannot.Below are the codes that I used,hope you guys can guide me through this.
<?php
require ("password.php");
if($category == "Windows"){
$Link = mysql_connect ($Host,$User,$Password);
@mysql_select_db(to88com_testing) or die( "Unable to select database");
$TableName = "Windows";
$query = "INSERT INTO $TableName VALUES ('', '$Question','$Answer')";
mysql_query($query);
}
else if($category == "Linux"){
$TableName = "Linux";
$Link = mysql_connect ($Host,$User,$Password);
@mysql_select_db(to88com_testing) or die( "Unable to select database");
$query = "INSERT into $TableName VALUES ('', '$Question','$Answer')";
mysql_query($query);
}
else{
$TableName = "General";
$Link = mysql_connect ($Host,$User,$Password);
@mysql_select_db(to88com_testing) or die( "Unable to select database");
$query = "INSERT into $TableName VALUES ('', '$Question','$Answer')";
mysql_query($query);
}
if(mysql_db_query($DBName,$Query,$Link)){
print("The query was succesfully!<BR>\n");
}
else{
print("The query was not succesfully made!<BR>\n");
}
mysql_close ($Link);
?>
The require.php files is the file that I store all my db hostname,passwrod and username and the db name.
The $category is one of the selection in the HTML form I created.
Best Regards,
Andy