Jump to content

[SOLVED] mysql and screwy hyperlinks


Lambneck

Recommended Posts

I have a problem with selecting hyperlinks from mysql. How come when someone submits info containing a hyperlink to my database and then when that info(link) is selected and displayed onto a page it doesnt take me to the site in their link but to something like the following url:

 

http://mysite.com/"http://their-hyperlink.com/"

 

 

???

 

 

Link to comment
Share on other sites

yah i agree but what?

could be nl2br() somehow?

 

heres the selection code:

<?php

require_once('pageLoad.php');

if (!mysql_connect($db_host, $db_user, $db_pwd))
    die("Woops! YOU broke the system! Quick! Refresh the page!");

if (!mysql_select_db($database))
    die("Can't... se... select... data... base.");

$id = (int) $_GET['id']; 

$sql = "SELECT * FROM $table WHERE submission_id=$id";
$result = mysql_query($sql);

if(mysql_num_rows($result) == 1){
$row = mysql_fetch_array($result);

	echo "<table>";
	echo "<tr><td><strong>";
	echo stripslashes(htmlspecialchars($row['col_1']));
	echo "  |  ";
	echo date("l M dS, Y", $row['submission_date']);
	echo "  |  ";
	echo "Posted by: ";
	echo stripslashes(htmlspecialchars($row['name']));
	echo "</strong><hr></td></tr>";
	echo "<tr><td><br>".(nl2br($row['col_2']))."</td></tr>";
	echo "</table>";

}else{
echo 'Oops! Something went wrong! Try something else!';
}
?>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.