PHP Code:
$sql = 'INSERT INTO tbl_jobs VALUES
(
{$_POST["id"]},
{$_POST["company"]},
{$_POST["location"]},
{$_POST["title"]},
{$_POST["desc"]},
{$_POST["exper"]},
{$_POST["edu"]},
{$_POST["link"]}
)';
When debugging, print out your strings:
If you have issues with the above, try swapping the " with ' and vice versa.

Originally Posted by
mjkomidar
I have used MySQL and PHP for sever years with no problems, but this is my first time using MSSQL and PHP and I am having some trouble and can't seem to figure out what is wrong.
When running the follow script/SQL query, I get --> MSSQL error: Invalid pseudocolumn "$_POST"
$server = '***';
$connect = mssql_connect($server, 'sa', '***');
mssql_select_db('db_jobs', $connect);
$sql = 'INSERT INTO tbl_jobs VALUES
(
$_POST["id"],
$_POST["company"],
$_POST["location"],
$_POST["title"],
$_POST["desc"],
$_POST["exper"],
$_POST["edu"],
$_POST["link"]
)';
$query = mssql_query($sql);
if (!$query)
{
die('MSSQL error: ' . mssql_get_last_message());
}
What is the problem?
It goes without saying that I'm able to connect to my server and perform other simple tasks, like create the database and tables using php, but I can't add data using the above script.
Bookmarks