From: lhelmer at suezenergyna dot com
Operating system: Win2003
PHP version: 5.2.4
PHP Bug Type: MSSQL related
Bug description: MSSQL_BIND won't work with datetime parameter
Description:
------------
I'm trying to execute a MSSQL stored procedure from PHP and I need to pass
a datetime parameter... when I do this the sp fails.
My bind statement is as follows
mssql_bind($proc,"@RequestDate",$RecDate,SQLVARCHAR,false,false,10);
In a different situation I pass an integer parameter and that sp works.
That bind statement is as follows
mssql_bind($proc,"@Load",$MWLoad,SQLVARCHAR);
I know my stored procedure "CalculateDailyTotals" works because I use them
everday in a scheduled job. It seems the problem is related to passing a
datetime value to the stored procedure.
Reproduce code:
---------------
$RecDate=$_POST['RecalcDate']; // RecalcDate = 2007-10-25
$db = mssql_connect("***","sa","***") or die("Unable to connect to
server");
mssql_select_db("Reporting");
$proc = mssql_init("CalculateDailyTotals", $db);
mssql_bind($proc,"@RequestDate",$RecDate,SQLVARCHAR,false,false,10);
$Result = mssql_execute($proc);
if ($Result == 1){
echo "Succes";
} ELSE {
echo "Failure";
}
Expected result:
----------------
Success
Actual result:
--------------
Failure
--
Edit bug report at http://bugs.php.net/?id=43110&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43110&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43110&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43110&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43110&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43110&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43110&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43110&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43110&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43110&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43110&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43110&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43110&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43110&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43110&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43110&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43110&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43110&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43110&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43110&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43110&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43110&r=mysqlcfg