gingera
asked on
MYSQL PHP: How do we remove or escape ; (semi-colon) in data retrieved from a MySQL table field?
PHP MYSQL
Hello,
In a MySQL table field, I have ; (semi-colon) in it. When I retrieve the data in a PHP script, I get premature termination of the script because of the ; (semi-colon)
Example of table field:
"The quick brown fox jumps over the lazy dog; so does the elephant"
(semi-colon after dog)
Example of PHP script:
...
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result) ) {
extract($row);
echo "$contents";
}
What do I do?
Hello,
In a MySQL table field, I have ; (semi-colon) in it. When I retrieve the data in a PHP script, I get premature termination of the script because of the ; (semi-colon)
Example of table field:
"The quick brown fox jumps over the lazy dog; so does the elephant"
(semi-colon after dog)
Example of PHP script:
...
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)
extract($row);
echo "$contents";
}
What do I do?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Ray, sorry for the delay. I've just managed to test out the suggestions.
Your help is very much appreciated!
Your help is very much appreciated!
ASKER
THANKS!!!
why dont you try this
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)
//extract($row);
echo "$row->contents";
}