Jump to content

PHP and MySql inserting hyphens


jabns

Recommended Posts

Hi there,I am having some trouble inserting hyphens into my SQL statments and was wondering how to get arround it. Before we start it works on myphpadmin so it is just the SQL statment.So far i have got://Page Startinclude "ladies_config.php";$sValue = stripslashes( $_POST['FCKeditor1'] ) ;$tValue = $_POST['getUNID2'];mysql_connect($server,$db_user,$db_pass) or die ("Failed to connect to server because: ".mysql_error());mysql_select_db($database) or die ("Failed to select database because: ".mysql_error()); $result = mysql_query("UPDATE $table SET news = $sValue WHERE UNID = '$tValue'")or die ("Could not read data because ".mysql_error());// Page EndNow then the HTML from the editor goes like($sValue variable)://Start<p>From the women... We're pushing ourselves to the limits in this rugby match</p>//ENDSo i was just wondering how do you get that into your sql statment without the hypens affecting it?Do you have to put a \ behind every hyphen like \' that?Thanks for the help in advance?

Link to comment
Share on other sites

Figured it out all i have to do is change:$sValue = stripslashes( $_POST['FCKeditor1'] ) ;$tValue = $_POST['getUNID2'];to:$sValue = stripslashes( $_POST['FCKeditor1'] ) ;$tValue = $_POST['getUNID2'];$text = addslashes($sValue);Many ThanksJames Barlow

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...