Login | Register | FAQ
Anonymous

\ Problem...

+ Post a reply

5 posts Page 1 of 1


\ Problem...

by ari » Sun Jun 24, 2012 9:26 pm

I host a site called converser, http://converser.hostei.com, and when a user chats and puts a " or a ', there is a backslash output. I use PHP. I know of a software called PHPBB, and it doesn't have the backslash problem. How do you do it?
User avatar

ari

  • Posts: 15
  • Joined: Fri Apr 06, 2012 5:59 pm

Re: \ Problem...

by XainPro » Mon Jun 25, 2012 5:40 am

i did not clearly understand what are you saying i have checked its working AND YOU can convert back slash \ to forward slash from php coding str_replace('\', '/' $variable);
User avatar

XainPro

  • Posts: 3575
  • Joined: Fri Feb 17, 2012 8:10 pm

Re: \ Problem...

by jessedotnet » Mon Jun 25, 2012 3:19 pm

I tested the site and couldn't create a chat with quotes. Are you, perhaps, using SQL? If so this excerpt from the tutorial might help:


SQL statements with quotes or backslash

If you try to insert text that contains the characters single quote ('), double quote (") or backslash (\), the record may not be inserted into the database. The solution is to add backslashes before characters that need to be quoted in database queries.

This can be done with the function addslashes this way:


<?php

$strText = "Is your name O'Reilly?";
$strText = addslashes($strText);

?>
User avatar

jessedotnet

  • Posts: 20
  • Joined: Thu Jun 07, 2012 7:04 pm

Re: \ Problem...

by ari » Mon Jun 25, 2012 4:07 pm

I am not using SQL. I am just writing to an html file that displays your chats.
User avatar

ari

  • Posts: 15
  • Joined: Fri Apr 06, 2012 5:59 pm

Re: \ Problem...

by XainPro » Tue Jun 26, 2012 5:16 am

use double backslash \\ for single back slash \ appearance.
Simple !
User avatar

XainPro

  • Posts: 3575
  • Joined: Fri Feb 17, 2012 8:10 pm


+ Post a reply

Page 1 of 1

?>