Page 1 of 1
hyperlink from DB
Posted: Fri Jul 03, 2009 2:57 am
by amao
Hi all
I have this statement
$query4="SELECT flink,reals FROM tb_links ORDER BY id DESC LIMIT 1 ";
I need to make the href=flink and hyperlink real like
<a href=Flink>reals</a>
please help
Re: hyperlink from DB
Posted: Fri Jul 03, 2009 6:09 am
by jaoudestudios
Once you have the flink variable in the array returned from the database.
Just use...
Code: Select all
<?php echo '<a href="'.$r['flink'].'">Link</a>'; ?>
Re: hyperlink from DB
Posted: Fri Jul 03, 2009 6:50 am
by amao
jaoudestudios wrote:Once you have the flink variable in the array returned from the database.
Just use...
Code: Select all
<?php echo '<a href="'.$r['flink'].'">Link</a>'; ?>
thanks jaoudestudios
it just take the first letter not the whole FLINK value
$data=mysql_result($result,0);
<?php echo '<a href="'.$data['flink'].'">Link</a>'; ?>
Re: hyperlink from DB
Posted: Fri Jul 03, 2009 7:19 am
by mattpointblank
$data = mysql_fetch_array($result);
Re: hyperlink from DB
Posted: Fri Jul 03, 2009 8:03 am
by Eric!
The way your data is stored is different depending on the mysql function. If you use mysql_result
Code: Select all
$data=mysql_result($result,0,'flink');
$link=mysql_result($result,0,'reals');
<?php echo '<a href="'.$data.'">'.$link.'</a>'; ?>
The faster (for more data) and more popular mysql_fetch_array
Code: Select all
$data = mysql_fetch_array($result);
<?php echo '<a href="'.$data['flink'].'">'.$data['reals'].'</a>'; ?>
Re: hyperlink from DB
Posted: Fri Jul 03, 2009 9:41 am
by amao
Eric! wrote:The way your data is stored is different depending on the mysql function. If you use mysql_result
Code: Select all
$data=mysql_result($result,0,'flink');
$link=mysql_result($result,0,'reals');
<?php echo '<a href="'.$data.'">'.$link.'</a>'; ?>
The faster (for more data) and more popular mysql_fetch_array
Code: Select all
$data = mysql_fetch_array($result);
<?php echo '<a href="'.$data['flink'].'">'.$data['reals'].'</a>'; ?>
thanks very much