(solved)define field type using php?
Moderator: General Moderators
(solved)define field type using php?
is it possible to define a filed type in a database( i use mysql and easyphp) as hyperlink using php so dat when displayed the field it can be clicked and used as a link?
Last edited by lostinphp on Wed Aug 24, 2005 5:16 am, edited 1 time in total.
Re: define field type using php?
Hmmm...can we have the english version please, i read that 3 times and still not sure what you are wanting to dolostinphp wrote:is it possible to define a filed type in a database( i use mysql and easyphp) as hyperlink using php so dat when displayed the field it can be clicked and used as a link?
Re: define field type using php?
ok i have a field called linksPimptastic wrote:Hmmm...can we have the english version please, i read that 3 times and still not sure what you are wanting to dolostinphp wrote:is it possible to define a filed type in a database( i use mysql and easyphp) as hyperlink using php so dat when displayed the field it can be clicked and used as a link?
i have a text box where i enter a url and this url gets updated in the links field in the database
so when i display the contents of the database id like to be able to click on the url and redirect me to dat page.
so id like to know if there is a way to re define a field type as a hyperlink using php code.
i hope this is english enuf for u..lol i agree my question was pretty incomprehensible.
Last edited by lostinphp on Wed Aug 24, 2005 4:48 am, edited 1 time in total.
something like this
Code: Select all
<?php
$query = "SELECT links FROM database_name";
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result) == 0) {
echo "There are no links in the database.";
} else {
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo '<a href="'.$row['link'].'" target="_blank">'.$row['link'].'</a><br />';
}
}
?>