jabns Posted September 4, 2006 Share Posted September 4, 2006 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 More sharing options...
jabns Posted September 4, 2006 Author Share Posted September 4, 2006 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 More sharing options...
justsomeguy Posted September 5, 2006 Share Posted September 5, 2006 Also, just for the record, that character is an apostrophe or single-quote, a hyphen is "-". Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now