User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 455,968 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,739 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1512 | Replies: 3 | Solved
Reply
Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

creating hyper link in php

  #1  
Nov 23rd, 2007
hi
i want to create the database retrieved datas as hyperlink using php.i have sent the code.please tell me how to edit the below code
<html>
<head>
</head>
<body>
<form>
<table>
<tr>
<td><font color="red">View All Posting</font>
</td>
</tr>
<tr>
<td><a href="care.php">Create New Users</a></td>
</tr>

<?php
$hostname = "localhost";
$username = "splendor_lydia";
$password = "jesus";
$dbid = "splendor_samp";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");

echo "<table width='60%' border='1' style='padding-right: 6px'>";
$result=mysql_query("SELECT jobtitle FROM please");
print "<tr><td>jobtitle </td></tr>";
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{

$line = mysql_fetch_row($result);
print "<tr><td>$line[0]</td></tr>";
}
echo "</table>";


mysql_close($link);
?>
</table>
</form>
</body>
</html>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2007
Location: Cavite,Philippines
Posts: 508
Reputation: ryan_vietnow is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 68
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: creating hyper link in php

  #2  
Nov 23rd, 2007
replace this part:

print "<tr><td>$line[0]</td></tr>";

with this part:

print "<td><tr><a href='".$line[0]."'>$line[0]</a></td></tr>";
"death is the cure of all diseases..."
http://ryantetek.wordpress.com
Reply With Quote  
Join Date: Nov 2007
Posts: 183
Reputation: lydia21 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
lydia21 lydia21 is offline Offline
Junior Poster

Re: creating hyper link in php

  #3  
Nov 24th, 2007
thanks it is working
Reply With Quote  
Join Date: Jan 2008
Posts: 3
Reputation: kanui is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
kanui kanui is offline Offline
Newbie Poster

Re: creating hyper link in php

  #4  
Jan 11th, 2008
Can anyone help me with this code? I have been trying to output the url as a link but I cannot manage to do so. The url comes out fine in text form but when I try to output the url as a link I either get an error message or all of the url is not in the link. The code works without errors as I have it posted here but all of the url does not appear in the link. It seems anything I add after video_id. either produces and error or the var lable is output instead of the var value. I have been working on this for hrs. I know it must be something simple but I just cannot figure it out.

Thanks in advance

Kanui

<?php

$txt = file_get_contents('http://youtube.com/watch?v=Z_qBWLAdKoE');

preg_match('/video_id:\'[\w]{11}\'/', $txt, $video_id_temp);
preg_match('/[\w]{11}/',$video_id_temp[0],$video_id_temp2);
$video_id = $video_id_temp2[0];

preg_match('/l:\'[\d]{1,15}\'/',$txt,$l_temp);
preg_match('/[\d]{1,15}/',$l_temp[0],$l_temp2);
$l = $l_temp2[0];

preg_match('/t:\'[\w]{32}\'/',$txt,$t_temp);
preg_match('/[\w]{32}/',$t_temp[0],$t_temp2);
$t = $t_temp2[0];

echo "http://youtube.com/get_video.php?video_id=".$video_id."&l=".$l."&t=".$t;
$url="http://youtube.com/get_video.php?video_id=";

print "<td><tr><a href='".$url.$video_id."'>   Download</a></td></tr>";




http://www.daniweb.com/forums/newrep...treply&t=98084
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 9:09 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC