Note that there are some explanatory texts on larger screens.

plurals
  1. POQuery works in SQL-server but not with php-input
    primarykey
    data
    text
    <p>I'm writing a web application in php (which I have a decent knowledge of) and have been given queries to stored procedures in a SQL Server database. This is how I have used one of them:</p> <pre><code> function exampleFunction ($productId, $serialNbr, $companyName1, $companyName2, $companyName3) { return ' exec dbo.getStuffFromDatabase @product_id = ' . $productId . ', @serial_id = ' . $serialNbr . ', @is_company_name1 = ' . $companyName1 . ', @is_company_name2 = ' . $companyName2 . ', @is_company_name3 = ' . $companyName3; } </code></pre> <p>I have never worked with database programming before, and possibly I am making some simple misstake, but I can't get this to work. I was wondering if there is something I have missed with the $companyName-variables - as far as I can tell they are like booleans (bit:s) that can take the value 0 and 1. I have tried using true/false, integers and strings for these values, none worked. When I execute this query in SQL Server Manager it works fine.</p> <p>Thanks!</p> <p>Edit: </p> <p>The script in Server Management Studio:</p> <pre><code>declare @product_id varchar(16) declare @serial_id int declare @is_company_name1 bit declare @is_company_name2 bit declare @is_company_name2 bit set @product_id = 'all' set @serial_id = 9999999 set @is_company_name1 = 0 set @is_company_name2 = 0 set @is_company_name2 = 1 exec [dbo].[getStuffFromDatabase] @product_id = @product_id, @serial_id = @serial_id, @is_company_name1 = @is_company_name1, @is_company_name2 = @is_company_name2, @is_company_name3 = @is_company_name3 </code></pre>
    singulars
    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.
 

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