I have a mysql database with user input fields. Some of these varchar fields contain commas as part of the data. When I try to display these fields they are treated as arrays and display only the first "element". This occurs both with mysql_fetch_row() and mysql_fetch_array(). I'm chagrined I haven't run into this before, perhaps because commas have generally been limited to text fields. Any help on this would be appreciated.
scottholmes
12
Light Poster
Recommended Answers
Jump to Postuse the function mysql_escape_string();
It will make sure all the characters are escaped and safe to use in a mysql query
escaping a character is adding a \ in front of a character. Eg: \'
Hope that fixes your problem.
Jump to PostTry peeking inside the row result with something like this.
echo "<pre>\n"; print_f($this->result); // or whatever the result set var is called. echo "</pre>\n";
All 5 Replies
FireNet
64
Posting Whiz in Training
scottholmes
12
Light Poster
MickRip
0
Newbie Poster
scottholmes
12
Light Poster
scottholmes
12
Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.