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>

Recommended Answers

All 3 Replies

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>";

thanks it is working

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/newreply.php?do=postreply&t=98084

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.