List:General Discussion« Previous MessageNext Message »
From:Mogens Melander Date:September 22 2009 8:02pm
Subject:Wierd PHP/MySQL result
View as plain text  
Hi guys

I'm getting rather confused on this thing.

Results returned from mysql console/query-browser is
different from what's returned from same query in PHP.

Maybe someone smarter than me could shed some light on
what's going on. I'm clueless :(

Environment is as follow:

Mysql Server version: 5.1.22-rc-log Source distribution
PHP 5.2.9 (cli) (built: Mar 31 2009 18:41:50)
Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8k DAV/2 PHP/5.2.9

The SQL:

select c.id, c.owner, if(c.owner > 0, s.name, 'Unknown') oname
, c.fname, c.lname, c.addr1, c.addr2, c.zipcode, c.city
, c.phone, c.mobile, c.email, c.web, c.saldo
from customer c
left join shop s on s.id=c.owner
where c.id = 1;

Result from PHP:

"id":"1"
,"owner":"2"
,"oname":null  <======= Problem data
,"fname":"Jane"
,"lname":"Doe"
,"addr1":"Solvej 1"
,"addr2":""
,"zipcode":"1234"
,"city":"Sommerby"
,"phone":"11 22 33 44"
,"mobile":""
,"email":""
,"web":""
,"saldo":"-7500.00"

Result from MySQL console/query-browser:

1
, 2
, 'Long description' <==== Correct data
, 'Jane'
, 'Doe'
, 'Solvej 1'
, ''
, '1234'
, 'Sommerby'
, '11 22 33 44'
, ''
, ''
, ''
, -7500.00

-- 
Later

Mogens Melander



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Thread
Wierd PHP/MySQL resultMogens Melander22 Sep
Re: Wierd PHP/MySQL resultMogens Melander22 Sep
  • Re: Wierd PHP/MySQL result (Solved)Mogens Melander22 Sep
  • Re: Wierd PHP/MySQL resultMark Goodge22 Sep
    • Re: Wierd PHP/MySQL resultMogens Melander22 Sep