|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-03-04 13:29 UTC] fmk@php.net
[2004-03-04 14:40 UTC] jimmybrock at yahoo dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 20 19:00:01 2025 UTC |
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.