Jump to content


This topic is now archived and is closed to further replies.


I Want URLs to Point to Their Specific Sites

Recommended Posts

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,

<?php require_once('Connections/url.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/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

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

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.