Hello i am trying to pull the hosted domains from my sql database i am able to pull them and see them I just cant get the links to Phrase properly the link to the working script is here http://www.a1khosting.com/test/index2.php

as you can see the links are not correct when clicking on them. the php script is here

<html><head><title>Hosted Domains</title></head><body>
DataBase Info Removed

if (!mysql_connect($db_host, $db_user, $db_pwd))
    die("Can't connect to database");

if (!mysql_select_db($database))
    die("Can't select database");

// sending query
$result = mysql_query("SELECT domain FROM {$table}");
if (!$result) {
    die("Query to show fields from table failed");

$fields_num = mysql_num_fields($result);

echo "<h1>Hosted Sites</h1>";
echo "<table border='1'><tr>";

// printing table headers

for($i=0; $i<$fields_num; $i++)
    $field = mysql_fetch_field($result);
    echo "<td>Hosted Sites{$field->domain}</td>";
echo "</tr>\n";
// printing table rows
while($row = mysql_fetch_row($result))

    echo "<tr>";

    // $row is array... foreach( .. ) puts every element
    // of $row to $cell variable
    foreach($row as $cell)

echo "<td><a href=\"".$cell['$row']."\" target=\"_new\">$cell</a></td>";
    echo "</tr>\n";


i think ur code working fine,but the only prob is there in <a href="">
here is the code which is working according to ur requirement..jus change its table database name and fields name as per ur requirement...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<table width="70%" border="1" cellspacing="1" cellpadding="1">
   <td colspan="2">hosted sites</td>

$server = "localhost";
$username = "root";
$password = "";
$db_name = "links";
$db = mysql_connect($server,$username,$password) or DIE("Connection to database failed, perhaps the service is down !!");
$db1=mysql_select_db($db_name) or DIE("Database name not available !!");

$login = mysql_query("select domain_name,domain_link from hosted_links");

while ($row = mysql_fetch_array($login, MYSQL_ASSOC)) 
  echo "<td>" ;
  echo "<a href=" .$row["domain_link"]." >". $row["domain_name"] ."</a>";
  echo "</td>";
   echo "</tr>";


plz, let me know if ths code worked for u or not........

Getting this error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /removed/removed/removed/removed/removed on line 24

This is line 24

while ($row = mysql_fetch_array($login, MYSQL_ASSOC))

Apparantly the query is invalid on the line before. Try:

$login = mysql_query("select domain_name,domain_link from hosted_links") or die(mysql_error());

To see if you get an error message on the query.

Thanks all for your great support Danweb and there people Rock I have got the code working now

echo "<td><a class=\"mylink\" 'http://' href=\"http://" . $row['website'] . "\">" . $row['website'] . "</a></td>";

No problem. Please mark this thread as solved then.