Flumps
04-29-2006, 04:48 AM
hello peeps,
im trying to store a link inside a database any ideas how I go about it? the link im trying to store is an external link to another website....
basically the general idea is the user comes on the website fills in a form with his or her website presses submit and it stores it onto the db, and then another file i made reads the info onto a page with the link that the user can click on...
but im doing somthing wrong....not sure...
im sotirn ghte link in a text feild.... just not sure how to display it....
the file looks like this that reads it...
<?
$db_name = "*****";
$table_name = "*****";
$connection = @mysql_connect ("", "", "") or
die("could'nt connect.");
$db = @mysql_select_db($db_name, $connection) or die("Could'nt select database.");
$sql = "
SELECT name, contact, title, description, url
FROM $table_name
ORDER BY id
";
$result = @mysql_query($sql,$connection) or die("couldnt execute query") ;
while ($row = mysql_fetch_array($result)) {
$name = $row['name'];
$contact = $row['contact'];
$title = $row['title'];
$description = $row['description'];
$url = $row['url'];
$display_block .= "
<p><b>Aurthor:</b> $name</p>
<b>Contact:</b> $contact<br />
<b>Title:</b> $title <br />
<b>Description:</b> $description <br />
<b>Direct Link:</b> $url <br />
<br />
";
}
?>
<span class="title"><p>Student's Portfolio</p></span>
<span class="content"><? echo "$display_block"; ?></span>
it works fine but just doing link correctly... am i right in thinking I need to setup another display block and have somthing like
<span class="content"><a href="<? "$otherdisplay_block"; ?>"></span>
or am i on the wrong lines....not sure what I have to do here to get links to work....
anyhelp would be great thanks.
im trying to store a link inside a database any ideas how I go about it? the link im trying to store is an external link to another website....
basically the general idea is the user comes on the website fills in a form with his or her website presses submit and it stores it onto the db, and then another file i made reads the info onto a page with the link that the user can click on...
but im doing somthing wrong....not sure...
im sotirn ghte link in a text feild.... just not sure how to display it....
the file looks like this that reads it...
<?
$db_name = "*****";
$table_name = "*****";
$connection = @mysql_connect ("", "", "") or
die("could'nt connect.");
$db = @mysql_select_db($db_name, $connection) or die("Could'nt select database.");
$sql = "
SELECT name, contact, title, description, url
FROM $table_name
ORDER BY id
";
$result = @mysql_query($sql,$connection) or die("couldnt execute query") ;
while ($row = mysql_fetch_array($result)) {
$name = $row['name'];
$contact = $row['contact'];
$title = $row['title'];
$description = $row['description'];
$url = $row['url'];
$display_block .= "
<p><b>Aurthor:</b> $name</p>
<b>Contact:</b> $contact<br />
<b>Title:</b> $title <br />
<b>Description:</b> $description <br />
<b>Direct Link:</b> $url <br />
<br />
";
}
?>
<span class="title"><p>Student's Portfolio</p></span>
<span class="content"><? echo "$display_block"; ?></span>
it works fine but just doing link correctly... am i right in thinking I need to setup another display block and have somthing like
<span class="content"><a href="<? "$otherdisplay_block"; ?>"></span>
or am i on the wrong lines....not sure what I have to do here to get links to work....
anyhelp would be great thanks.
