RE: What am I doing wrong?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[snip]
I can't seem to understand PHP error trapping...I have it turned on in
php.ini, and on the page in question, I have "error_reporting(E_ALL);"
on the page in question below - the following code does NOT generate any
errors, but it doesn't perform the insert either....the stored procedure
exists, but even if I purposely misspell the stored procedure name, no
errors are raised...any advice?

<?php
error_reporting(E_ALL);
//submit the request

//write entry into database
$fname = $_POST[fname];
$lname = $_POST[lname];
$dept = $_POST[dept];
$phone = $_POST[phone];
$super = $_POST[super];
$groups = $_POST[groups];

//Assign the server connection to a variable
$connect = mssql_connect('SERVERNAME,1433', 'username', 'password');
 
//Select your database and reference the connection
mssql_select_db('DBName', $connect);

// Create a new stored prodecure
$stmt = mssql_init('sp_name');

// Bind the field names
mssql_bind($stmt, '@fname',$fname,SQLVARCHAR,false,false,25);
mssql_bind($stmt, '@lname',$lname,SQLVARCHAR,false,false,25);
mssql_bind($stmt, '@dept',$dept,SQLVARCHAR,false,false,50);
mssql_bind($stmt, '@phone',$phone,SQLVARCHAR,false,false,25);
mssql_bind($stmt, '@super',$super,SQLVARCHAR,false,false,50);
mssql_bind($stmt, '@groups',$groups,SQLVARCHAR,false,false,8000);

// Execute 
mssql_execute($stmt);

header("Location: done.php");
exit;

?>
[/snip]

No PHP error occurs that is why you do not get an error. Insert this

http://us.php.net/manual/en/function.mssql-get-last-message.php 

after the execute and you should get a message back from SQL Server

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux