PHP MySQL Warning #1265

[expired user #11155]'s profile image [expired user #11155] posted 6 years ago in General Permalink

I am trying to write a Software Licensing php app and am working with curl. I have most thigns working but my generated HardwareID is as follows.......

74be16979710d4c4e7c6647856088456

That key goes into MySQL table as truncated to the following

74be16979710d4c4e7c6

When I try to add it to mysql table, I get the HardwareID truncated. My table structure is as follows...

Column Type Null Default Comments UserID int(11) No
FullName varchar(60) No
HardwareID varchar(20) No
Software varchar(100) No
LicenseKey varchar(144) Yes NULL
Validated enum('Y', 'N') No
Indexes Keyname Type Unique Packed Column Cardinality Collation Null Comment PRIMARY BTREE Yes No UserID 2 A No

i have run the following code in my query window:

SHOW VARIABLES LIKE 'sql_mode'

Variable_name Value sql_mode

Any help on this would be greatly appreciated.

[expired user #2814]'s profile image [expired user #2814] posted 6 years ago Permalink

Your HardwareID is truncated at 20 chars because you declared your HardwareID column as being 20 chars wide ('HardwareID varchar(20) No'). Just make it 32 chars or more and you're done.

[expired user #11155]'s profile image [expired user #11155] posted 6 years ago Permalink

Your correct...What a dumb ass. I kept changing the value of my License Key column.....

How stupid I feel right now.

[expired user #2814]'s profile image [expired user #2814] posted 6 years ago Permalink

It's Christmas time... too much food to digest and the blood flow gets diverted from the brain to the stomach :-)

Personally, I abstain from writing code until the eat-and-drink-too-much season is over

ansgar's profile image ansgar posted 6 years ago Permalink

Writing code is a good chance to do something different as eating and drinking. I personally had too much dry wine this evening, one from Italy and one from California (because the first one was empty). Well, tastes well, but just too much :)

[expired user #11155]'s profile image [expired user #11155] posted 6 years ago Permalink

Thanks again. That was so the issue.

kalvaro's profile image kalvaro posted 6 years ago Permalink

I always set a strict SQL mode to avoid this kind of errors:

SET @@SESSION.sql_mode='TRADITIONAL,NO_AUTO_VALUE_ON_ZERO';

Merry Christmas!

Please login to leave a reply, or register at first.