Forum Moderators: coopster

Message Too Old, No Replies

Help with PDO

PDO bug possibly

         

xKillswitchx

5:23 am on Jan 3, 2010 (gmt 0)

10+ Year Member



I am working with a forum using PDO for database interactions. Basically, I am trying to update a forums description. It works absolutely fine...

Until the word "only" exists in the text I am about to add. Here's what I tried...

"Moderators and administrators ONLY!"

When updated, the string is cut off to show "moderators and administrators >"

The field type this is being stored in is just text. I am also using Xajax to process this, but when I debug, I can see teh value is being sent correctly. When I tried again but left out the word "only" it went right on through, no problems.

Can anyone help with this, is this a bug in PDO or is there a way to escape it if so? I've never ran into this type of problem before.

coopster

2:09 pm on Mar 17, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



When you say it "went right on through, no problems" are you saying that with the word ONLY in the text it is failing? Or merely being truncated? Is the table column definition large enough to handle the length of the string? I know you said it is a text field, but of type TEXT, or CHAR(30), or ... ? If it is only 30 characters it may be getting truncated.

Matthew1980

3:22 pm on Mar 17, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there coopster & xKillswitchx,

The suggestion of truncation seems the likely cause of this, it has caught me out before when storing md5() in a table, I had on specified varchar(20) in the table and obviously when the data is hashed, the string is 32 chars long ;-p

I think that if you were to try subsituting the word ONLY with any char, the same would happen! As coopster says check the allowed char length that you specified in the table..

Cheers,
MRb