ID:               27493
 User updated by:  jimmybrock at yahoo dot com
 Reported By:      jimmybrock at yahoo dot com
-Status:           Bogus
+Status:           Closed
 Bug Type:         MSSQL related
 Operating System: Windows 2000
 PHP Version:      4.3.4
 New Comment:

duh! bad snytax


Previous Comments:
------------------------------------------------------------------------

[2004-03-04 13:29:24] [EMAIL PROTECTED]

The query returns true as everything was performed ok (that is if you
add the missing end to your sample code). You can use
mssql_get_last_message() to get the message you are printing. This is
not returned as a result but as a message from the server.

------------------------------------------------------------------------

[2004-03-04 08:18:50] jimmybrock at yahoo dot com

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 this bug report at http://bugs.php.net/?id=27493&edit=1

Reply via email to