Hello everyone.
I am trying to eliminate all of the spaces in a value I am getting from my database.
For example: If I get "Hot Dog with Bun" from the database I want to trim it to look like "HotDogwithBun".
I've tried to use the TRIM() function in the Database query but it seems to delete the value:
$classQuery = "SELECT TRIM(className) WHERE "Web Developer" = 'Y' ORDER BY className ASC";
I have also tried to trim() the value in PHP but to no avail.
trim($classKey['className'], " ");
Any help would be great. Here is the code:
$classQuery = "SELECT TRIM(className), shortDesc, category, trainType, courseDuration, cost, materialLink, dueDate FROM aci_class WHERE " . $empTitle . " = 'Y' ORDER BY dueDate ASC";
$classResult = mysql_query($classQuery);
$numRows = mysql_num_rows($classResult);
if($classResult)
{
for($j=0; $j<$numRows; $j++)
{
$classKey = mysql_fetch_array($classResult);
bgCounterSwitch();
print "<tr>";
print "<td class=";
setRowAlt();
print "timeSheetDay><b>" . $classKey['className'] . "</b></td>";
$classArray[$j] = trim($classKey['className'], " ");
}
}