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
hyperlink from DB
Moderator: General Moderators
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: hyperlink from DB
Once you have the flink variable in the array returned from the database.
Just use...
Just use...
Code: Select all
<?php echo '<a href="'.$r['flink'].'">Link</a>'; ?>
Re: hyperlink from DB
thanks jaoudestudiosjaoudestudios 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>'; ?>
it just take the first letter not the whole FLINK value
$data=mysql_result($result,0);
<?php echo '<a href="'.$data['flink'].'">Link</a>'; ?>
-
mattpointblank
- Forum Contributor
- Posts: 304
- Joined: Tue Dec 23, 2008 6:29 am
Re: hyperlink from DB
$data = mysql_fetch_array($result);
Re: hyperlink from DB
The way your data is stored is different depending on the mysql function. If you use mysql_result
The faster (for more data) and more popular mysql_fetch_array
Code: Select all
$data=mysql_result($result,0,'flink');
$link=mysql_result($result,0,'reals');
<?php echo '<a href="'.$data.'">'.$link.'</a>'; ?>Code: Select all
$data = mysql_fetch_array($result);
<?php echo '<a href="'.$data['flink'].'">'.$data['reals'].'</a>'; ?>
Re: hyperlink from DB
thanks very muchEric! wrote:The way your data is stored is different depending on the mysql function. If you use mysql_result
The faster (for more data) and more popular mysql_fetch_arrayCode: Select all
$data=mysql_result($result,0,'flink'); $link=mysql_result($result,0,'reals'); <?php echo '<a href="'.$data.'">'.$link.'</a>'; ?>Code: Select all
$data = mysql_fetch_array($result); <?php echo '<a href="'.$data['flink'].'">'.$data['reals'].'</a>'; ?>