Jump to content

How can i remove the backslashes?


fekaduw

Recommended Posts

hello everyone,

 

i just used the addslashes() function while inserting a text into my db(MySql). but when i try to display the text back, it adds the backslashes. (eg: \\\\\\\"My Text\\\\\\\") I use the stripslashes function, but it didn't work out.

 

is there any other way out to avoid the backslashes?

 

thanks a lot

Link to comment
https://forums.phpfreaks.com/topic/41514-how-can-i-remove-the-backslashes/
Share on other sites

sorry again,

 

the data in the db and the text that is displayed on the page is similar. i think the stripslashes is not working. it simply displays without removing the backslashes. i also tried three stripslashes, but it didn't work.

 

thanks for your help

is it similar, or is it EXACTLY the same? those are two completely different statements, and in order to help you, we need to know accurate information. post MORE code. not just a couple of lines. let's see the whole document.

hello there,

here are some of the codes that i used.

 

	$vtitle=addslashes($_POST["title"]);
$vdescription=addslashes($_POST["Message2"]);
$vpicture=addslashes($_POST["Picture"]);
$vpicfilename=addslashes($_POST["Picname"]);	
$vshort_desc=addslashes($_POST["shortdesc"]);	

 

I tried to look into the content of the db and a sample data looks something like this:

 

<P class=MsoNormal style=\"\"\"\"\"\"\"MARGIN: \" \\\\? 0in \\? \\\\\\\\? \\\\\\\\\\\\\\\\? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\? 0pt\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?><SPAN style=\"\"\"\"\"\"\"FONT-SIZE: \" \\\\? \\? FONT-FAMILY: 9pt; \\\\\\\\? \\\\\\\\\\\\\\\\? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\? Arial\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?>This edition marks the fifth anniversary of SPECIFY: Building Product Information Catalogue. Since its introduction five years ago, the number of companies listed in the Catalogue has doubled and has made available diverse products and services to its users.<SPAN style=\"\"\"\"\"\"\"mso-spacerun: \" \\\\? \\? \\\\\\\\? \\\\\\\\\\\\\\\\? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\? yes\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?>  </SPAN>With the increased expansion of the building industry, the need for organized information is becoming even more crucial year by year.</SPAN><SPAN style=\"\"\"\"\"\"\"FONT-SIZE: \" \\\\? \\? FONT-FAMILY: 9pt; \\\\\\\\? \\\\\\\\\\\\\\\\? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\? Arial\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?><?xml:namespace prefix = o ns = \"\\\"\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"urn:schemas-microsoft-com:office:office\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"\\\\\\\\\\\\\\\"\\\\\\\"\\\"\" /><o:p> </o:p></SPAN></P>
<P class=MsoNormal style=\"\"\"\"\"\"\"MARGIN: \" \\\\? 0in \\? \\\\\\\\? \\\\\\\\\\\\\\\\? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\? 0pt\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?><SPAN style=\"\"\"\"\"\"\"FONT-SIZE: \" \\\\? \\? FONT-FAMILY: 9pt; \\\\\\\\? \\\\\\\\\\\\\\\\? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\? Arial\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?>In 2005  introduced a website based catalogue complementary to the paper catalogue. With all its flexibility and versatility, the digital version is an ideal medium to promote building products and services.<o:p></o:p></SPAN></P>
<P class=MsoNormal style=\"\"\"\"\"\"\"MARGIN: \" \\\\? 0in \\? \\\\\\\\? \\\\\\\\\\\\\\\\? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\? 0pt\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?><SPAN style=\"\"\"\"\"\"\"FONT-SIZE: \" \\\\? \\? FONT-FAMILY: 9pt; \\\\\\\\? \\\\\\\\\\\\\\\\? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\? Arial\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?><o:p></o:p></SPAN></P>
<P class=MsoNormal style=\"\"\"\"\"\"\"MARGIN: \" \\\\? 0in \\? \\\\\\\\? \\\\\\\\\\\\\\\\? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\? 0pt\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?><SPAN style=\"\"\"\"\"\"\"FONT-SIZE: \" \\\\? \\? FONT-FAMILY: 9pt; \\\\\\\\? \\\\\\\\\\\\\\\\? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\? Arial\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\?>This edition has listed entries that range from roofing tiles, electro-mechanical products, sanitary fittings, wooden doors, internal and external finishes, decorative plaster, motorized shutters and gates, earth-moving equipments, curtain walls, furnishings, auditorium seats with built-in public address and voting systems, low voltage products and to aluminums products.<o:p></o:p></SPAN></P>

 

I have used the stripslashes function while retrieving the data:

 

$description=$description."<tr><td><table border='0' width='100%' cellspacing='0'><tr><td valign='top' class='header-home'>".stripslashes($row["title"])."</td><td align='right' valign='top' class='header-postdate'>Posted on: ".date("M d, Y",$row["postdate"])."</tr></table></td></tr>";
			$description=$description."<tr class='body-home'><td valign='top' class='justifiedtext'><span style='float:right'>  <img src='admin/upload/".stripslashes($row["imagename"])."' border='1'></span>".stripslashes($row["Description"])."</td></tr>";
                                	$description=$description."<tr class='body-home'>
                  			         <td align='right'>
						<table border=0>
							<tr>
								<td align='right' class='nav_home'><a href='index.php'>  Back  </a>			                                    </td>
							</tr>
						</table>
				</td>
				</tr>";

			$description=$description."<tr><td valign='top' height='10'> </td></tr>";
echo $description;

 

any help highly appreciated

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.