Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP¦MySQL CONCAT() and null question

Status
Not open for further replies.

BlindPete

Programmer
Jul 5, 2000
711
US
I have a thread already going on this topic in the MySQL forum but I am hoping someone here might know the answer thread436-639237

Original Question:

Can anybody tell me why this query only returns null values for the field "test" ?

SELECT CONCAT( 'a', 'b', 'c') AS test, nid FROM someTable

test | nid
NULL | 1
NULL | 2
NULL | 3
NULL | 4
NULL | 5

Whats odd is that on our test server it correctly returns abc but on the live server i returns NULL.

Obviously I'm not intending to CONCAT( 'a', 'b', 'c') but I I kept simplifing it to figure which field was causing it until well I was left with no fields and three static strings.

Is there some setting on the Apache server or in MySQL that would cause this?



-Pete
Do you get a little guilty pleasure when a celebrity has a bad day?
Well then The Dead Pool is for you!
 
Reachin' aren't you ;)

What does your table and entries look like? I'll try to recreate it on my end.

·genoa

If a dog craps in the yard and buries it, is that considered steganography?
 
Oh yes, I'm desperate and definately reaching!

CREATE TABLE `spec_course` (
`corid` int(6) NOT NULL auto_increment,
`status` enum('Active','Retired') NOT NULL default 'Active',
`course_num` varchar(60) NOT NULL default '',
`ctitle` varchar(254) NOT NULL default '',
PRIMARY KEY (`corid`),
KEY `course_num` (`course_num`),
KEY `ctitle` (`ctitle`)
) TYPE=MyISAM;

SELECT corid, CONCAT(course_num, ' - ', ctitle) as caption FROM spec_course

What I get are nulls for the field caption... even if I do CONCAT('a','b','c') So i'm just stumped as to why?

-Pete
Do you get a little guilty pleasure when a celebrity has a bad day?
Well then The Dead Pool is for you!
 
That is odd. Sorry I can't help you with that one. I don't have any problems, and unfortunately without sitting in front of your system I couldn't troubleshoot it.

Hopefully someone in the MySQL AB forum will have an answer.

Sorry.


·genoa

If a dog craps in the yard and buries it, is that considered steganography?
 
The problem was that MySQL was using too high of a max_allowed_packet, and in addition to causing connections to be lost when large files were dumped/exported, some functions were weirdly temporarily rendered funky and broken, like CONCAT(). Don't really know why that variable being too high would make CONCAT break of all things, but changing it back down to the default seemed to magically set everything back to normal.

I would like to add that I have worked with several hosting companies over the years and this one has had the finest service of any of them. In addition to having competative rates they were very responsive to this problem and worked very quickly to resolve it.

-Pete
Do you get a little guilty pleasure when a celebrity has a bad day?
Well then The Dead Pool is for you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top