Page 1 of 1

mssql stored procedure execution failed

Posted: Tue Sep 07, 2010 12:52 pm
by mikeHUN
Hi!

I would like to call MSSQL stored procedure from PHP, but it doesn't work. I get the following warning. Could somebody help me with this problem?
Warning: mssql_execute() [function.mssql-execute]: stored procedure execution failed in /var/www/aXXXX.uXXX.YY/public_html/db_test/index.php on line 71
The PHP code:

Code: Select all

$connection = mssql_connect(10.x.x.x:1xxx\yyyPRyyy, 'username', 'password');

if ($connection) {
    if (mssql_select_db('sPublic')) {
        $stmt = mssql_init('ADD_USER', $connection);

        $company_name  = 'Test Customer';
        $post_code          = '1122';
        $city                   = 'Tiszarocsoge';
        .........
        $country             = 'Magyarorszag';
        $tax_number       = '11223344-5-11';
        $tax_number_eu  = 'HU11223344';

        mssql_bind($stmt, '@company_name', $company_name , SQLVARCHAR, false, false, 255);
        mssql_bind($stmt, '@post_code', $post_code , SQLVARCHAR, false, false, 50);
        mssql_bind($stmt, '@city', $city , SQLVARCHAR, false, false, 255);
        ..........
        mssql_bind($stmt, '@country', $country , SQLVARCHAR, false, false, 255);
        mssql_bind($stmt, '@tax_number', $tax_number , SQLVARCHAR, false, false, 50);
        mssql_bind($stmt, '@tax_number_eu', $tax_number_eu , SQLVARCHAR, false, false, 50);

        $result = mssql_execute($stmt, $connection);
        $data = mssql_fetch_assoc($result);

        mssql_free_statement($stmt);
        mssql_close($connection);
    } else {
        print("Could not select database!\n");
    }
} else {
    print("Could not connect to database!\n");
}