ID:               31175
 User updated by:  vortexx at freemail dot hu
 Reported By:      vortexx at freemail dot hu
-Status:           Feedback
+Status:           Open
 Bug Type:         MySQL related
 Operating System: Windows 2000 Server, SP4
 PHP Version:      5.0.3
 New Comment:

Sorry, but what do you mean "can't reporduce"? 

That you:
- need more info to be able to do so?
If so, please fire away, let me know what else you need, I would be
glad to provide any info necessary
- tried to reprodice but given the same circumstances the same code
worked fine for you?

Since this is MySQL related obviously I cannot "copy and paste" the
MySQL tables themselves here. I can only give info as to the nature of
tables involved.

To reporoduce just try ANY MySQL query in PHP 5.0.3+ with a CONCAT of a
field from a table plus a string:
SELECT CONCAT('this is a string',field_from_table) as test FROM
whatever_table

The point is that whenever a SELECT with a CONCAT of a string and a
table field is involved, the query returns nothing. If it's just a
CONCAT of 2 or more fields from a table, then it's fine. If it's a
CONCAT of 2 or more strings, no problem. As soon as it is a string plus
a field, no results are returned. BEFORE 5.0.3 the same queries all
worked just fine.

Is this any help? If not, please let me know what info I should send!


Previous Comments:
------------------------------------------------------------------------

[2005-01-29 21:10:35] [EMAIL PROTECTED]

Can't reproduce.
Check your code and provide more info if you're still experiencing this
problem.

------------------------------------------------------------------------

[2004-12-18 05:53:25] vortexx at freemail dot hu

Description:
------------
When a query containing CONCAT(...) with a string plus a reference to a
certain database field is run via PHP, no results and nop errors are
returned. The exact same query run via MySQL commandline returns
results as expected.

With 5.0.2 the exact same script (with ALL PHP configs the same, even
the same PHP.INI) returns results as expected. Thus I believe this is
not MySQL related but rather related to PHP5.0.3 and the php_mysql.dll
included with it?!

I also tried the latest PHP snapshot, but the same thing happens. 

Not sure what other info might be relevant and needed, I would be glad
to provide whatever info you may find necessary.

Reproduce code:
---------------
<%
/// Omitting the mysql_connect part of the code...!

/// This returns no results under PHP5.0.3,
/// while under PHP5.0.2 it returns results as expected.
$query = "SELECT CONCAT(tel,'blabla') as tel from hotels where
id='$id'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
print_r($row);

/// This, however, works!
/// Difference is that two ***fields*** are CONCAT-ed.
$query = "SELECT CONCAT(tel,name) as tel from hotels where id='$id'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
print_r($row);

/// This also works!
/// This time two ***strings*** are CONCAT-ed.
$query = "SELECT CONCAT('just test','blabla') as tel from hotels where
id='$id'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
print_r($row);
%>

Expected result:
----------------
I should get the telephone number of the hotel joined with the string
"blablabla".

Actual result:
--------------
Get no results from the MySQL query, but no errors either (MySQL or
PHP).


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31175&edit=1

Reply via email to