Jump to content


Photo

I Want URLs to Point to Their Specific Sites


  • Please log in to reply
No replies to this topic

#1 khaferi

khaferi
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 29 August 2006 - 12:02 PM

Hello,
I am doing a simple directory in PHP MYSQL. I want to list all websites in a particular country. The challenge is how to return the website  results as links to the corresponding sites.
e.g. if there is a website www.almond.co.ke, how do I add a link so it points to the variable site?
I am using a dreamweaver mx 2004 trail version to train meself. Following is the code. Anyone with an idea?

I am new in php and this one beat me.

Warm Regards,
Kangari


<?php require_once('Connections/url.php'); ?>
<?php
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_url, $url);
$query_Recordset1 = "SELECT * FROM urls";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $url) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="104">id</td>
    <td width="125">name</td>
    <td width="293">url</td>
    <td width="293">&nbsp;</td>
  </tr>
  <?php do { ?>
    <tr>
      <td><?php echo $row_Recordset1['id']; ?></td>
      <td><?php echo $row_Recordset1['name']; ?></td>
      <td><?php echo $row_Recordset1['url']; ?></td>
      <td><?php echo $row_Recordset1['url']; ?>"> /td>    </tr>
    <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users