Jump to content

i can count internal links but how do i do external links help? this is my code


mattm1712

Recommended Posts

<html>

<?php

 

 

 

 

$id = $_GET['id'];

 

$dbusername="web148-matt";

$dbpassword="matt";

$dbdatabase="web148-matt";

mysql_connect(localhost,$dbusername,$dbpassword);

@mysql_select_db($dbdatabase) or die( "Unable to select database");

 

mysql_query("UPDATE count SET clicks=clicks+1 WHERE id='$id'");

 

$sql = mysql_query("SELECT link FROM count WHERE id='$id'");

$fetch = mysql_fetch_row($sql);

 

 

$result = mysql_query("SELECT * FROM count");

 

while($row = mysql_fetch_array($result))

  {

 

  echo "<a href=" .$row['link'].  ">Link</a>";

 

  }

 

 

?>

 

 

<a href='http://www.google.com'>Google</a>

<a href='/index.php?id=2'>link2</a>

</html>

You can use MySQL substr but personally if I wanted to distinguish from internal and external URLs I would add a field to the table and call it 'external' and set it to a boolean. This way you could use WHERE external = 1 to find the external or WHERE internal = 0 to find the internal links.

Archived

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

×
×
  • Create New...

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.