Search the Community
Showing results for tags 'escape'.
-
Hello. I have a problem when I send an article to DB from the server (in localhost everything is working fine). So, the news_post (textarea) is sending backslashes before single and double quotes, broking embed elements (images, videos, etc.). The articles are sent to DB throught this coide:
- 6 replies
-
- backslashes
- php
-
(and 2 more)
Tagged with:
-
Greetings all, I have a question about escaping characters prior to entering a field into a database and than echo'ing that escaped data back onto a page. My problem is that the slash marks are echo'ing out of the database onto another page. For instance if I were to do something along the lines of: $hpintrotitle = mysqli_real_escape_string($connect, trim($_POST['hpintrotitle'])); $q = "UPDATE homepage SET mstitle='$hpintrotitle' WHERE msid='1' LIMIT 1"; $r = @mysqli_query($connect, $q); If I place the word "You've" or "Isn't" into that field when I echo it out from the database it comes back as "You\'ve" or "Isn\'t" I know this is probably basic stuff but I apparently missed this lesson in school. Any help would be appreciated. Side note: I am bringing this data back as an array using something along these lines: $rowintro = mysqli_fetch_array ($rintro, MYSQLI_NUM); echo $rowintro[0]; echo $rowintro[1]; and so on.... Thanks for taking a look.
-
Hi Guys, I am currently writing some pretty messy code and I am having problems with it. I bascially have a script which will change the source of an image using jquery, but all of this is generated through a PHP file. So basically I have this being called using ajax: $sql="select * from vehicle_image where vehicle_id=".$_REQUEST["id"].""; $sql_res=mysqli_query($conn, $sql) or die(mysqli_error($conn)); while($array=mysqli_fetch_array($sql_res)) { $src=$array['image_src']; $variable = "\"../timthumb.php?src=images/" . $src. "&w=66.6&h=66.6\""; $content .= "<img onclick=\"changeImage(" . $variable. ")\" style=\"float:left;\" src=" . $variable . ">"; } echo $content; The line I am having the problems with is the $content .= line. specifically the onclick=" this bit here " part. However I write the code, however I escape the characters, it causes an error with different bits of the code, at the moment the problem with this is that is doesnt form the variable in the function properly. I am using FireBug to check that things are workly properly as when you use jQuery the source code does not update. Firebug says there is something wrong after changeImage( so I can only assume its my character escaping, but I really dont know. Any help on this would be great!