php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43110 MSSQL_BIND won't work with datetime parameter
Submitted: 2007-10-26 20:05 UTC Modified: 2013-10-15 11:54 UTC
Votes:13
Avg. Score:4.9 ± 0.3
Reproduced:12 of 12 (100.0%)
Same Version:8 (66.7%)
Same OS:7 (58.3%)
From: lhelmer at suezenergyna dot com Assigned:
Status: No Feedback Package: MSSQL related
PHP Version: 5.2.4 OS: Win2003
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lhelmer at suezenergyna dot com
New email:
PHP Version: OS:

 

 [2007-10-26 20:05 UTC] lhelmer at suezenergyna dot com
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-21 22:36 UTC] leo dot avatar at hoptmail dot com
execute stored procedure of mssql server with php5 using parameters type datetime
 [2013-08-02 00:35 UTC] yohgaki@php.net
-Status: Open +Status: Feedback
 [2013-08-02 00:35 UTC] yohgaki@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 15:01:29 2024 UTC