Hello,

I have a page on my website that takes too long to load because of the outdated script I'm using to pull the results from my database.

This same code below is copied 22 times over on the same page so that it pulls the results. Is there any way to speed up this process?

The page is located at www.vancouverprofile.com/business/index.php

PHP Code:
<?php 

// Set the variables for the database access:

$Host "";
$User "";
$Password "";
$DBName "";
$Link mysql_connect ($Host$User$Password);

$Query "SELECT id,name,ogtableid,catid FROM category WHERE ogtableid = '1' ORDER by name";
$Result mysql_db_query ($DBName$Query$Link);

// Fetch the results from the database.

while($Row mysql_fetch_array($Result)){

$catid "$Row[catid]";

print (
" <a href=\"http://www.vancouverprofile.com/business/agricultural/category.php/catid/$Row[catid]\" class=\"link\">$Row[name]</a>");
?>
<?php 

// Set the variables for the database access:

$Host23 "";
$User23 "";
$Password23 "";
$DBName23 "";
$Link23 mysql_connect ($Host23$User23$Password23);

$Query23 "SELECT count(id) FROM profiles WHERE productcodes1='$catid' OR productcodes2='$catid' OR productcodes3='$catid' OR productcodes4='$catid' OR productcodes5='$catid' OR productcodes6='$catid' OR productcodes7='$catid' OR productcodes8='$catid' OR productcodes9='$catid' OR productcodes10='$catid' OR productcodes11='$catid' OR productcodes12='$catid' OR productcodes13='$catid' OR productcodes14='$catid' OR productcodes15='$catid'";
$Result23 mysql_db_query ($DBName23$Query23$Link23);
$num_rows23 mysql_result($Result23,0,"count(id)");

// Fetch the results from the database.

echo "$num_rows23";

mysql_close ($Link23);

?> )
<?
}

?>