PHP to MSSQL connection

A

Anonymous

Guest
I have an existing PHP application that I'm trying to make it so the data goe sto mssql rather than an email. The final step of the application goes to a step 6 that is the process for the email. I added a statement $this->sendtodb(); so it will also populate the database. It looks like this:

function processStep6 ()
{

$message = $this->buildEmailMessage();

$this->sendEmail($message);
$this->displayThankYou();
$this->sendtodb();

return;
} // processStep6

Not sure if this will work but I call the funtion for the database below:

function sendtodb ()
{

$db = mssql_connect("Myserver", "My ID", "Mypassword");
mssql_select_db("Mydatabase",$db);
$sql = "INSERT INTO My table (FirstName, MidName, LastName) VALUES
('fname','mname','lname')";

$result = mssql_query($sql);

The form works but no data is passed to the database. Any ideas? I don't receive any errors either.

Thanks,
Rob
return;
} :?
 
HI,

Please print the query and let me know.

I think there may be problem with single quote.
 
Back
Top