Link to home
Start Free TrialLog in
Avatar of Isaac
IsaacFlag for United States of America

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($database) 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');
}
Avatar of shivsa
shivsa
Flag of United States of America image

syntex error again.
$sql = "INSERT INTO serer(s_Name, Desc) VALUES('$s_name', '$desc')";
to
$sql = "INSERT INTO server(s_Name, Desc) VALUES('$s_name', '$desc')";
also u do not have name $desc, it is $description. on the same line.
ASKER CERTIFIED SOLUTION
Avatar of lozloz
lozloz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Isaac

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')";
Avatar of Isaac

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($database) or die( "Unable to select database");

-TheInnovator-
Avatar of Isaac

ASKER

I have to wait to give you your points.
When I try to Accept your answer.  i get an 'Internal Database Error'.
But still u have these error which i pointed out.