This query returns BLANK with PHP!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ifedi
    New Member
    • Jan 2008
    • 60

    This query returns BLANK with PHP!

    I've a project (medical stuff based on PHP/apache) where I need to run this query:
    Code:
    SELECT CONCAT_WS(" ", CONCAT(pregNo,':'),  del_year, MONTHNAME(CONCAT('2000-',del_month,'-01')), concat('@',ga,'wk'), CONCAT('in', UCWORDS(place)), IF(fetal_no = 1, "Singleton", IF(fetal_no=2, 'Twins', IF(fetal_no > 2, 'Multiple' , '')) ) , CONCAT(labour_length, 'hrs'), CONCAT('Onset: ',onset), CONCAT('Complications: ',an_complications), CONCAT('lasted: ',labour_length), CONCAT('Third Stage:',third_stage), IF(bld_trans, 'Transfused', ''), CONCAT('Perineum:',perineum), CONCAT('Hospitalized for: ', hosp_duration, 'days')) phrase FROM hx_obsdetails WHERE hx_id=2
    Problem is this query returns blank; absolutely nothing in the result set. No error message or number.
    To crosscheck, I pasted this in phpmyadmin query window, no problem. I pasted this in MySQL Command Line Client, no problem. Back to PHP, my script just went blank from that point down. No message from either MySql or PHP.
    I need serious help, please.
    Ifedi.
  • ifedi
    New Member
    • Jan 2008
    • 60

    #2
    The problem was the double quotes!
    I just realized that the double-quotes within CONCAT_WS(" " and that enclosing "Singleton" were conflicting with the double-quotes enclosing the entire query statement. They needed to be either escaped or converted to single quotes. I did the latter.
    Thanks anyway.

    Comment

    Working...