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
https://forums.phpfreaks.com/topic/145397-solved-mysql-and-screwy-hyperlinks/
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!';
}
?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.