From:             jimmybrock at yahoo dot com
Operating system: Windows 2000
PHP version:      4.3.4
PHP Bug Type:     MSSQL related
Bug description:  mssql_query fails to insert row

Description:
------------
problem:

mssql_query does not like foreign keys and primary keys that are set to
varchar. It will not insert a new row and it does not return an error
(returns true)



solution:

change datatype for foreign key and primary key to 'tinyint'

change underlying data to match new data types

voila! a new row is inserted

Reproduce code:
---------------
// groupName is set to varchar(25) in database

// administators is already in the table group

// so the print statement should execute

$g='administrators';



if not exists (select groupName from groups where groupName='$g')

begin

   INSERT INTO $this->dbtable

   (groupName) 

   VALUES ('$g')

end

else

print 'Group Name already exists in table groups'

Expected result:
----------------
if the variable passed into the query exists in the current table I
excepted the query NOT to execute, and that the print statement would be
returned.

Actual result:
--------------
mssql_query returns True, but does not insert a new row.

-- 
Edit bug report at http://bugs.php.net/?id=27493&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27493&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27493&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27493&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27493&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27493&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27493&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27493&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27493&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27493&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27493&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27493&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27493&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27493&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27493&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27493&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27493&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27493&r=float

Reply via email to