1

I have a notification system on my website where users will be notified of a certain event. The message of the notification will be stored in a MySQL database.

When I insert links into the message, it returns a MySQL error saying it cannot insert links.

How can I achieve that? I am using php.

2
  • MySQL won't complain that it can't insert links. Post your code - in all likelihood, it is incorrect string quoting or something of that nature. (or the code specifically locates and prohibits links) Commented Apr 9, 2012 at 17:51
  • Strange .. can we see your code ? Commented Apr 9, 2012 at 18:06

1 Answer 1

1

Almost all links will include characters that will be interpreted by a sql database in an odd manner, leading to unpredictable results based on the varied input. You should ensure these characters are properly escaped:

$some_input = getInputFromWebPage();
$safe_input = mysql_real_escape_string($someInput);
insertIntoDB($safe_input);

That is just an example, and obviously not working code, but hopefully it heads you in the right direction. There are several functions that will add escape characters to strings for you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.