First off i'm not sure if this post goes in mysql or php so if this is the wrong place please move this post for me.

I am setting up a page with a list of commands that are pulled from a mysql database. I have the page that displays all the commands setup and am working on setting up a page to add new commands to the database. I have followed the same syntax that i've used on several other pages for inserting a new row into the database but it's not working and I am unsure why.

I have pasted my query into phpmyadmin and it works fine directly from the database. When clicking submit to add the new command it executes the section of code that is suppose to insert to the database but the new info does not go in the database. I know this because I have the values of the fields in my form printed on the screen right after it adds the info the db. I know it is connected to the db because it pulls the command list from the db with no problems. I thought it didn't have write permissions so I tried using the same file and db on a different server and db where i knew the db user has write permissions but i still get the same result.

Here is the code. Attached is my sql file in case there is something in my db with a problem.

}else{

$Syntax = $_POST[Syntax];
$Description = $_POST[Description];
$Instructions = $_POST[Instructions];
$category = $_POST[cat];

mysql_query("INSERT INTO `command` SET active='0' Syntax='$Syntax',  

Description='$Description', Instructions='$Instructions', 

cat='$category'");


echo $Syntax;
echo $Description;
echo $Instructions;
echo $category;

echo 'The command has been created.';
}

cat is an integer, so it doesn't need the quotes. But if you do

mysql_query(..) or die(mysql_error());

you can see what's wrong.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.