Jump to content

Paste problem


HueyJib

Recommended Posts

Hi.

 

I scripted my own pastebin site in php and I'm using a mysql database to store pastes. The problem is, I post the content like this:

 

This

Is

The

Content

 

And it shows up just like that in the db table. Now, when I echo that content to the site, it shows up like this:

 

This Is The Content

 

How do I fix that?

 

This is what I use to get the info from the table.

$host="...";
$username="...";
$password="...";
$db_name="...";
$tbl_name="...";

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$pn=$_GET['pn'];

$sql="SELECT * FROM $tbl_name WHERE pn='$pn'";
$result=mysql_query($sql);

$rows=mysql_fetch_array($result);

<tr>
<td width="100%" align="center" bgcolor="#E6E6E6"><font face="Verdana" size="2"><strong>Content</strong></font></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><font face="Verdana" size="2"><? echo $rows['text']; ?></font></td>
</tr>

Link to comment
https://forums.phpfreaks.com/topic/125674-paste-problem/
Share on other sites

Sorry for double post but I have a new question.

 

One time I pasted a php/html code and it turned out it actually did the code as if I wanted it to work. For example, if I pasted this:

<a href="http://www.phpfreaks.com/forums">PHP Help Forum</a>

 

It would come out like this:

PHP Help Forum

 

How do I turn script code into raw text so it doesn't do the example above.

Link to comment
https://forums.phpfreaks.com/topic/125674-paste-problem/#findComment-649907
Share on other sites

Sorry for double post but I have a new question.

 

One time I pasted a php/html code and it turned out it actually did the code as if I wanted it to work. For example, if I pasted this:

<a href="http://www.phpfreaks.com/forums">PHP Help Forum</a>

 

It would come out like this:

PHP Help Forum

 

How do I turn script code into raw text so it doesn't do the example above.

i guess it kinda depends on how you want it to be viewed/stored.  do you just want the link name and not the href attached with it?

Link to comment
https://forums.phpfreaks.com/topic/125674-paste-problem/#findComment-651243
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.