Re: Re: Calling MSSQL Stored Procedure
| From: | M. Sokolewicz | Date: | Fri, 16 Sep 2005 13:46:55 +0000 |
| Subject: | Re: Re: Calling MSSQL Stored Procedure | ||
| References: | 1 2 3 4 5 | Groups: | php.windows php.windows |
| Request: | Send a blank email to php-windows+get-26342@lists.php.net to get a copy of this message | ||
Alf Stockton wrote:
Mark Rees wrote:Please suggest what data type you would use. In the database the requisit field is a datetime but I cannot find in either adodb or php document a datetime type. A little further down in the manual you refer to above it says interalia:- [$*type*] Consult mssql_bind <http://php.net/mssql_bind> and ocibindbyname <http://php.net/ocibindbyname> docs at php.net for more info on legal values for type. and neither mssql_bind <http://php.net/mssql_bind> nor ocibindbyname <http://php.net/ocibindbyname> led me to a list of types but looking at GetType gave me the following list????? *I get 2005/09/16 10:09:22 AM which is exactly the same format as it appears in the database table when viewed via Enterprise Manager.I wouldn't set too much store by how it looks in EM. It is a datetime value, so its internal representation will be quite different. It seems likely that $actualdate isn't actually a datetime by the time it gets to the database, for whatever reason. Note this line from the adodb docs: (I am presuming you are using ADODB for PHP here) If $type parameter is set to false, in mssql, $type will be dynamicly determined based on the type of the PHP variable passed (string => SQLCHAR, boolean =>SQLINT1, integer =>SQLINT4 or float/double=>SQLFLT8). http://phplens.com/lens/adodb/docs-adodb.htm I would look into supplying the data type when adding the parameter"*boolean* <http://www.php.net/manual/en/language.types.boolean.php>" (since PHP 4)*"*integer* <http://www.php.net/manual/en/language.types.integer.php>"*"*double* <http://www.php.net/manual/en/language.types.float.php>" (for historical reasons "double" is returned in case of a *float* <http://www.php.net/manual/en/language.types.float.php>, and not simply "float")*"*string* <http://www.php.net/manual/en/language.types.string.php>"*"*array* <http://www.php.net/manual/en/language.types.array.php>"*"*object* <http://www.php.net/manual/en/language.types.object.php>"*"*resource* <http://www.php.net/manual/en/language.types.resource.php>" (since PHP 4)*"*NULL* <http://www.php.net/manual/en/language.types.null.php>" (since PHP 4)*"user function" (PHP 3 only, deprecated)*"unknown type"Please tell me what I should use ? use a string. Besides, forget all about types in PHP. PHP converts between them automatically... what would you need to know what "type to use" anyway? :) I can't (or barely) imagine any PHP code in which you can *define* what type something is supposed to be (except by casting something to another type explicitly; which is usually pretty pointless)