Hi,
I have a set of data transferred from a csv to a db table.
The data goes into the varchar field fine when converted but when i manipulate the data to store it into a relational table using php i get any string which is like:
" hello
a double quote without end double quotes stored as
"
hello
in a varchar field in mysql, which is strange
when i insert into a db table i use the following to store the data to a string:
<?php
$stu_alt_tel = mysql_escape_string($EMERGENCY);
?>
any ideas how i can put any string no matter what format on one line and escape any kinds of problems?
double quotes in varchar
Moderator: General Moderators
i have tested this, it goes in database ok
BUT
the problem is when i out put it in a
with $get_stuP['stu_alt_tel'] equal to "fddfgfdg
with the speech mark and no end speech mark it does not get displayed?
BUT
the problem is when i out put it in a
Code: Select all
<input type="text" name="field1" value="<?php echo stripslashes($get_stuP['stu_alt_tel']);?>">with the speech mark and no end speech mark it does not get displayed?
When you output anything to an HTML page (that you don't want to be treated as HTML), you should use:
This changes double quotes (") into &quot; and so won't break the input tag by closing it early.
Code: Select all
htmlspecialchars($var);