Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Formatting data as HTML to get the same appearance as mysql select return

by pokemonk (Scribe)
on Jul 20, 2001 at 01:09 UTC ( [id://98238] : perlquestion . print w/replies, xml ) Need Help??

pokemonk has asked for the wisdom of the Perl Monks concerning the following question:

yo brothers,

so i'm working on a cgi-script, i just started using mySql, and i have a problem i can't fix.

this is part of my code:
$song=getdb("SELECT lyrics FROM song WHERE id=$form{id}"); print "<textarea>$song&lt;/textarea>";

so when i use type in mysql administrator:

SELECT lyrics FROM song WHERE id=$form{id}

it returns:

I was alone i was all by myself no on was lookiiing i was thinking of you.
but when i view it in the browser i see this:
<textarea>I was alone i was all by myself no on was lookiiing i was thinking of you.&lt;textarea>

yeh, that's my problem. ohh yeah, i used fetchrow_array() in the dbi module, alright dudes, thanks a bunch.

oh yeah, and i have another lil quiestion: is
$blah{one}=~s/a/b/g; $blah{two}=~s/a/b/g; == $blah{'one','two'}=~s/a/b/g;
????

alright, later kids.


Edit ar0n 2001-07-19 -- removed pre tags.
Edit kudra, 2001-07-20 Changed title from HELP x3

Replies are listed 'Best First'.
Re: HELP HELP HELP
by adamsj (Hermit) on Jul 20, 2001 at 01:13 UTC
    You think it might be this?

    print "<textarea>$song&lt;/textarea>"; ^^^

    Update: And as to the second question, what's wrong with:

    print "$blah{'one'}\t$blah{'two'}\n";

    adamsj

    They laughed at Joan of Arc, but she went right ahead and built it. --Gracie Allen

Re: HELP HELP HELP
by andye (Curate) on Jul 20, 2001 at 01:32 UTC
    For
    $blah{one}=~s/a/b/g; $blah{two}=~s/a/b/g;
    I'd suggest
    s/a/b/g foreach @blah{'one', 'two'} ;

    andy.