Jump to content

trim() function help


SF23103

Recommended Posts

Hello,

 

I have been messing around with this and can't seem to figure out what I'm doing wrong.  I'm pretty new to php, so it might be something silly.

 

Original code:

$a1=mysql_result($result,$i,"question"); //Question
$a2=mysql_result($result,$i,"answer"); //Answer
$a3=mysql_result($result,$i,"submission_id"); //submission id
$a4=mysql_result($result,$i,"category"); //submission id

echo "<a name=\"$a3\"></a><strong>$a1</strong>$a2";

 

Prints:

 

Question

 

Category

 

What I want is:

 

Question

Category

 

I have tried using the trim functions but nothing seems to help:

 

$a1=mysql_result($result,$i,"question"); //Question
$a2=mysql_result($result,$i,"answer"); //Answer
$a3=mysql_result($result,$i,"submission_id"); //submission id
$a4=mysql_result($result,$i,"category"); //submission id
$a1 = rtrim($a1);
$a2 = ltrim($a2);

echo "<a name=\"$a3\"></a><strong>$a1</strong>$a2";

 

Ideas?

Link to comment
https://forums.phpfreaks.com/topic/249582-trim-function-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.