user1104854
user1104854

Reputation: 2167

inserting hyperlink into sql database - php

I'm trying to insert a hyperlink into a mysql databse which will then be retrieved by the user through a messaging system. I can't get the hyperlink to work; the output is just text saying "click here to respond".

So, when a user is invited to something(an event in this case), they will receive a message saying something like "Click here to respond." When the user clicks the link it will display the event. I echo'd this link on a page and I know it works, I just can't figure out how to get it to display once pulled fromt he database. It's being stored in a column that is of type varchar.

The inputs from code above this chunk have been sanatized using mysql_real_escape_string. Just thought I'd throw that out there before anyone mentions it.

$to = $userExplode[$i];
$from = "0";
$eventNumber = mysql_fetch_array($eventNum);
$title = "Event Invitation";
            $message =  '<a href= http:/localhost/loginsystem/viewevent.php?eventID = ' . $eventNumber['eventID'] . '> Click here </a> to respond.';
$sql = mysql_query("Insert INTO messages (title,message,to,from) VALUES ('New Message','$message','$to','$from')");

edit: I got it to work, it was tricky. I had to hard-code my messaging system to check if the system sent a message. Then it would echo the parts of the URL and insert the link after href="..."

Upvotes: 1

Views: 6683

Answers (1)

Joe
Joe

Reputation: 15802

Put quotes around the href and give http:// the full two slashes, not just one :P Other than that, post your code to output it.

Upvotes: 1

Related Questions