Isaac
asked on
PHP
I thought the problem was solved but it's not.
When I run the below. I get no errors at all. But nothing is being inserted in the Database.
I just get 'Not Inserting'.
Somebody please help.
$s_name = $_post['s_name'];
$description = $_post['description'];
$username = "dca";
$password = "abv132";
$database = "spa";
$dbcnx = @mysql_connect('localhost' ,$username ,$password );
//@mysql_select_db($databa se) or die( "Unable to select database");
if (!$dbcnx) {
echo('unable to connect');
echo(mysql_error());
exit();
}
$sql = "INSERT INTO serer(s_Name, Desc) VALUES('$s_name', '$desc')";
if (@mysql_query($sql)){
echo('Connected');
}else
{
echo('Not Inserting');
}
When I run the below. I get no errors at all. But nothing is being inserted in the Database.
I just get 'Not Inserting'.
Somebody please help.
$s_name = $_post['s_name'];
$description = $_post['description'];
$username = "dca";
$password = "abv132";
$database = "spa";
$dbcnx = @mysql_connect('localhost'
//@mysql_select_db($databa
if (!$dbcnx) {
echo('unable to connect');
echo(mysql_error());
exit();
}
$sql = "INSERT INTO serer(s_Name, Desc) VALUES('$s_name', '$desc')";
if (@mysql_query($sql)){
echo('Connected');
}else
{
echo('Not Inserting');
}
also u do not have name $desc, it is $description. on the same line.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Could you please point it out. I don't see it.
so the new line will be,
$sql = "INSERT INTO server(s_Name, Desc) VALUES('$s_name', '$description')";
$sql = "INSERT INTO server(s_Name, Desc) VALUES('$s_name', '$description')";
ASKER
Thanks lozloz!!
When I added that debug line, I found out what the problem was.
I had an important line in my code commented.
//@mysql_select_db($databa se) or die( "Unable to select database");
-TheInnovator-
When I added that debug line, I found out what the problem was.
I had an important line in my code commented.
//@mysql_select_db($databa
-TheInnovator-
ASKER
I have to wait to give you your points.
When I try to Accept your answer. i get an 'Internal Database Error'.
When I try to Accept your answer. i get an 'Internal Database Error'.
But still u have these error which i pointed out.
$sql = "INSERT INTO serer(s_Name, Desc) VALUES('$s_name', '$desc')";
to
$sql = "INSERT INTO server(s_Name, Desc) VALUES('$s_name', '$desc')";