Super simple query:
mysql_connect($server ,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT RTRIM(a.Name), a.Age, a.Sex, a.GunTime, a.Pace, b.Name as Race,
a.RaceDate from 5K as a Join RaceIDs b on a.RaceID = b.ID Order By GunTime asc";
$result=mysql_query($query);
When this query executes, all of the columns return except for a.Name. If I remove theRTRIM() then the a.Name column returns as expected. Likewise, if I pass UPPER(a.Name), then that one column is empty. If I remove the UPPER(), then a.Name returns just fine.
Any clue why I can’t wrap these table-aliased arguments in standard MYSQL (v5.1) functions?
Provide a column alias for the function-wrapped columns:
Now when you fetch results (either
mysql_fetch_assoc()ormysql_fetch_array()) theNamecolumn will exist in your result row.($row['Name'])Otherwise, the column is technically there, but you would have to reference it as
RTRIM(a.Name)when fetching in PHP:($row['RTRIM(a.Name)'])