Questions tagged [addslashes]

A PHP function to add backslashes (\) in front of each quote characters (" and ') and backslash characters (\).

82 questions
0
votes
2 answers

mysql text value with apostrophe not showing up correctly

I'm inserting the following TEXT value into MySQL using.. $groupname = addslashes($_POST['groupname']; When getting the value from Mysql I'm using $name = $row['groupname']; echo $name; And this show correctly as "Mr. Davis's Group" but when this…
DobotJr
  • 3,929
  • 9
  • 36
  • 49
0
votes
1 answer

How can I addslashes() to elements of a multidimensional array? (php)

I have a multidim array from my $_POST but I have to serialize() then save to the database... Normally, I can serialize but I got some problem with slashes (apostrophe and double quote). My array seems like this: $array["hu"]["category"]["food"] =…
Zsolt Takács
  • 368
  • 4
  • 14
0
votes
1 answer

Qt based addSlashes version equivalent

I just wrote a Qt based php addSlashes function like, I wont to see any improvements, suggestions to it. I am planing to use this function to fill a file with hundred of insert query, to be more specific, I am going to create php database dump…
SIFE
  • 5,567
  • 7
  • 32
  • 46
0
votes
1 answer

Add slash before double quotes php

$string = 'Link'; echo addcslashes($string, '"'); but the output is Link instead should be like this Link or if this is not the right…
Francis Alvin Tan
  • 1,057
  • 3
  • 21
  • 42
0
votes
1 answer

Laravel 5.7 - Query builder not escaping quotes or backslashes correctly when using updateOrInsert()

I have an array with some strings and special caracter in the values. If I use the insert method it works good. $result = DB::connection('host1')->table('tblName')->insert($data); If I use the update method it works good. $result =…
IgorAlves
  • 5,086
  • 10
  • 52
  • 83
0
votes
1 answer

Escaping MySQL UPDATE (IF LENGTH)

I've created an UPDATE statement that updates only if the string's length is greater than 0. I'm trying to escape quotes within my UPDATE statement once the condition is met. I've been using addslashes($name), but with this new condition addslashes…
Joshua N
  • 17
  • 1
  • 6
0
votes
3 answers

addslashes and json_encode not working together

$val = "I'm string"; For this type of string I am using the addslashes function, which convert string into like this: "I\'m string" and store into the database. When I get all data from database in array of fields and passed array in…
Chaitanya Desai
  • 333
  • 3
  • 17
0
votes
1 answer

issuewith single,double quotes inside string in php

I will print the string in PHP, but in a string in there middle of in string double quotes, single quotes string also .So I will not get the expected output. My code Below:
0
votes
2 answers

How to make file_get_contents return an unique result

I am new to php and would like to ask you for some help returning an unique result from file_get_contents(). The reason is I want to give each photo an unique name, so that later it will be possible to delete just one of them and not all. $file…
0
votes
1 answer

PHP addslashes to a $_POST array

I try put addslashes on a $_POST array. However, google returns me "Chrome detected unusual code on this page and blocked it to protect your personal information (for example, passwords, phone numbers, and credit cards)." Any one knows how to fix…
Reece Mak
  • 101
  • 2
  • 9
0
votes
2 answers

Making POST values dynamic within a loop to store as an array?

I've been working on trying to write a function that will grab the POST values of any given form submission, pop them into an array, loop through the array using trim, addslashes etcetera pass that value back to a variable where it can then be…
zealisreal
  • 495
  • 2
  • 8
  • 20
0
votes
3 answers

How do I escape characters in href of anchor tag

I want to escape three characters these are single quote (') double quote (") backslash () my href value is test.html?key="test' me'"&event=3 I want to fix it as we do in php by calling addslashes function
Kuldeep Dangi
  • 4,126
  • 5
  • 33
  • 56
0
votes
2 answers

Escaping quotes in PHP from MySQL result (PDO)

The string to display comes from a MySQL table. I use PDO queries. The string contains double quotes: Older spelling (from French). The modernized "petty larceny" is now preferred. This is a definition of a dictionary entry that is displayed if…
cheeseus
  • 369
  • 3
  • 21
0
votes
2 answers

return input field with qoute values not working

I have a function that creates input fields. $string = ''; return $string $field_value holds a string with…
FamousWolluf
  • 568
  • 1
  • 3
  • 25
0
votes
1 answer

SQL request with addslashes but error in firebug

I have a sql request and in firebug I have an error. This is my sql request : $sql = "UPDATE public.".$tableBDD." SET ".$champsDB." WHERE ".$idTable."='".$idUpdate."'"; And before that, I have this : $champsDB.=…
Erlaunis
  • 1,433
  • 6
  • 32
  • 50