Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP form and MSSQL
    primarykey
    data
    text
    <p>I have a PHP form that adds data to a MySQL DB, I now have to convert that PHP code so that it will work on a MSSQL DB. PHP is running fine on the server.</p> <p>Here's what I have so far, basically I changed everything that WAS mysql_ to mssql_ but it's not working. I have a line that I'm not showing that calls a config file that connects to the DB as well, I'm also not showing the HTML form unless you need it.</p> <pre><code> &lt;?php if (isset($_POST['vendor_id'])) { //Check for a field that is mandatory to do the inserted $vendor = mssql_escape_string($_POST['vendor_id']); $name = mssql_escape_string($_POST['name_id']); $version = mssql_escape_string($_POST['version']); $serial = (!empty($_POST['serial'])) ? $_POST['serial'] : 'NULL'; $productkey = (!empty($_POST['productkey'])) ? $_POST['productkey'] : 'NULL'; $department = mssql_escape_string($_POST['department']); $owner = mssql_escape_string($_POST['owner']); $computer = (!empty($_POST['computer'])) ? $_POST['computer'] : 'NULL'; $comments = (!empty($_POST['comments'])) ? $_POST['comments'] : 'NULL'; $acquired = (!empty($_POST['acquired'])) ? $_POST['acquired'] : 'NULL'; $retired = mssql_escape_string($_POST['retired']); $sql = "INSERT INTO dbo.keylist_detail (vendor_id,name_id,version,Serial,ProductKey,department_ID,owner,computer,Comments,acquired,retired) VALUES (''$vendor','$name','$version',$serial','$productkey','$department','$owner','$computer','$comments','$acquired','$retired'')"; mssql_query($SQL); if (mssql_query($sql)) { echo '&lt;strong&gt;&lt;em&gt;Your data has been submitted&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;'; } else { echo '&lt;p&gt;Error adding submitted info: ' . mssql_error(). '&lt;/p&gt;'; } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload