On 11 Apr 2001, at 11:40, Daniel Fairs wrote:

> Hi,
> I'm trying to insert a row into an MSSQL7 table using the SQL string:
> INSERT INTO person (birthdate,deathdate,sname,othername,motherid,fatherid)
> VALUES ('1978-10-06',NULL,'Fairs','Daniel',NULL,NULL) SELECT @@identity AS
> last_identity
> The actual PHP code is
> $oRes = mssql_query("SET NOCOUNT ON " . $sSQL, $this->iConnIndex) ;
> if ($oRes) echo "yea" ; else echo "nay" ; die() ;
> ... and 'nay' gets printed....
> I've tried both SET NOCOUNT ON and SET NOCOUNT OFF, and also omitting the
> SET NOCOUNT completely. Any ideas why I'm not getting the last id back?
Maybe the problem is simpler: on some version of mssql API 
(maybe all?), I've verified that mssql_returns non-zero only for 
SELECT statements (returns the number of rows selected, to be 
more precise). All other statements return zero, so you could see 
that darn "nay" even if the query worked perfectly :-(...

HTH, bye!

Fabrizio Ermini               Alternate E-mail:
C.so Umberto, 7               [EMAIL PROTECTED]
loc. Meleto Valdarno          Mail on GSM: (keep it short!)
52020 Cavriglia (AR)          [EMAIL PROTECTED]

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to