Adding <br>'s
I have the following saved in one column of a mySQL table:
Like
Overcome
Vested
Embrace
It is an anagram for the word Love
I am querying the table to display the results. I am needing help with
the formatting part of this.
I have this line of code:
$anagram=mysql_result($anagram_result,$i,"anagram");
I need help adding <br>'s so each word will be on a new line. Within
the table column each word is on a separate line. It would also be
really cool if the first letter was in bold (ie <b>X</b> )
echo stripslashes($anagram)
Thanks,
Ron
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Adding <br>'s
Check this function out for the line breaks:
http://us.php.net/nl2br
Not quite sure what to do for the bold thing.
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
Ron Piggott wrote:
> I have the following saved in one column of a mySQL table:
>
> Like
> Overcome
> Vested
> Embrace
>
> It is an anagram for the word Love
>
> I am querying the table to display the results. I am needing help with
> the formatting part of this.
>
> I have this line of code:
>
> $anagram=mysql_result($anagram_result,$i,"anagram");
>
>
> I need help adding <br>'s so each word will be on a new line. Within
> the table column each word is on a separate line. It would also be
> really cool if the first letter was in bold (ie <b>X</b> )
>
> echo stripslashes($anagram)
>
> Thanks,
>
> Ron
>
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Adding <br>'s
$loopsize = mysql_num_rows();
$anagram = "";
for ($i = 0; $i < $loopsize; $i++) {
$cell = mysql_result($anagram_result, $i, "anagram");
$anagram .= "<b>" . $cell{0} . "</b>" . substr($cell, 1) . "
\n";
}
On Mon, Sep 1, 2008 at 2:09 AM, Ron Piggott <ron.php [at] actsministries.org> wrote:
> I have the following saved in one column of a mySQL table:
>
> Like
> Overcome
> Vested
> Embrace
>
> It is an anagram for the word Love
>
> I am querying the table to display the results. I am needing help with
> the formatting part of this.
>
> I have this line of code:
>
> $anagram=mysql_result($anagram_result,$i,"anagram");
>
>
> I need help adding <br>'s so each word will be on a new line. Within
> the table column each word is on a separate line. It would also be
> really cool if the first letter was in bold (ie <b>X</b> )
>
> echo stripslashes($anagram)
>
> Thanks,
>
> Ron
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Adding <br>'s
It is not clear if all four words are one string separated by line breaks,
or if they are stored separately.
If you have one long string, with linebreaks, use:
$ anagram = preg_replace("/^(.)/mi", "<br/><b>$1</b>", $ anagram);
Simcha Younger
p.s. I think you meant an acronym.
-----Original Message-----
From: Ron Piggott [mailto:ron.php [at] actsministries.org]
Sent: Monday, September 01, 2008 2:09 AM
To: PHP DB
Subject: [PHP-DB] Adding <br>'s
I have the following saved in one column of a mySQL table:
Like
Overcome
Vested
Embrace
It is an anagram for the word Love
I am querying the table to display the results. I am needing help with
the formatting part of this.
I have this line of code:
$anagram=mysql_result($anagram_result,$i,"anagram");
I need help adding <br>'s so each word will be on a new line. Within
the table column each word is on a separate line. It would also be
really cool if the first letter was in bold (ie <b>X</b> )
echo stripslashes($anagram)
Thanks,
Ron
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.169 / Virus Database: 270.6.14/1643 - Release Date: 30/08/2008
17:18
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php