Unable to connect to the database server.

"); exit(); } if (!(@mysql_select_db($db_name))) // If can't connect to database, error and exit(). { echo("

Unable to locate the $db_name database.

"); exit(); } $orig = array(".html" , "/"); $ournew = array("" , ""); $brand = str_replace($orig, $ournew, $PHP_SELF); $limit = 30; if (!($record)){ $record = 0;} // Default record value. $numresults = mysql_query("SELECT * FROM pricelist WHERE brand LIKE '%". $brand ."%'"); // the query. $numrows = mysql_num_rows($numresults); // Number of rows returned from above query. if ($numrows == 0){ echo("No results found matching your query - $require $find"); // bah, modify the "Not Found" error for your needs. exit();} $pages = intval($numrows/$limit); // Number of results pages. // $pages now contains int of pages, unless there is a remainder from division. if ($numrows%$limit) { $pages++; } // has remainder so add one page $current = ($record/$limit) + 1; // Current record number. if (($pages < 1) || ($pages == 0)) { $total = 1;} // If $pages is less than one or equal to 0, total pages is 1. else { $total = $pages;} // Else total pages is $pages value. $first = $record + 1; // The first result. if (!((($record + $limit) / $limit) >= $pages) && $pages != 1) { $last = $record + $limit;} //If not last results page, last result equals $record plus $limit. else{ $last = $numrows;} // If last results page, last result equals total number of results. ///////////////// Generate new header twice month basis ///////////////////////////// if ($monthofyear=="") { $monthofyear = date(m); } $thismonthbase = (($monthofyear/2)+0.5)-1; $thismonth = intval((($monthofyear/2)+0.5)+$record)-1; $results = mysql_query("SELECT description FROM pricelist WHERE brand LIKE '%". $brand ."%' LIMIT $thismonth, 1") or die(mysql_error());; $subtitle = mysql_fetch_array($results); if (($subtitle["description"]==" ") || ($subtitle["description"]==" ") || ($subtitle["description"]==" ")) { $nextresult = $thismonth+2; $results = mysql_query("SELECT description FROM pricelist WHERE brand LIKE '%". $brand ."%' LIMIT $nextresult, 1") or die(mysql_error());; $subtitle = mysql_fetch_array($results); } elseif ($subtitle["description"] == "") { $results = mysql_query("SELECT description FROM pricelist WHERE brand LIKE '%". $brand ."%' LIMIT $record, 999") or die(mysql_error()); $numofrecs = mysql_num_rows($results); // Number of records $lastrec = $record + ($numofrecs-1); $results = mysql_query("SELECT description FROM pricelist WHERE brand LIKE '%". $brand ."%' LIMIT $lastrec, 1") or die(mysql_error()); $subtitle = mysql_fetch_array($results); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////// $results = mysql_query("SELECT * FROM header WHERE fname LIKE '%". $brand ."%' LIMIT 0, 1") or die(mysql_error());; $maintitle = mysql_fetch_array($results); $subtitle["description"] = " - " . $subtitle["description"]; ?> <?=$maintitle["title"]?> <?=$subtitle["description"]?> " /> " />


Results - of   Page of

NoCategoryProductDescriptionPriceWarranty
           

back \n"); } else { echo("back \n"); } } for ($i=1; $i <= $pages; $i++) // loop through each page and give link to it. { $ppage = $limit*($i - 1); ////////////////////////////////////////////////// $backlink = intval($ppage + $thismonthbase); $results = mysql_query("SELECT description FROM pricelist WHERE brand LIKE '%". $brand ."%' LIMIT $backlink, 1") or die(mysql_error()); $data = mysql_fetch_array($results); $linktext[$i] = $data["description"]; if (($linktext[$i]==" ") || ($linktext[$i]==" ") || ($linktext[$i]==" ")) { $nextresult = $backlink+2; $results = mysql_query("SELECT description FROM pricelist WHERE brand LIKE '%". $brand ."%' LIMIT $nextresult, 1") or die(mysql_error());; $data = mysql_fetch_array($results); $linktext[$i] = $data["description"]; } elseif ($linktext[$i] == "") { $results = mysql_query("SELECT description FROM pricelist WHERE brand LIKE '%". $brand ."%' LIMIT $ppage, 999") or die(mysql_error()); $numofrecs = mysql_num_rows($results); // Number of records $lastrec = $ppage + ($numofrecs-1); $results = mysql_query("SELECT description FROM pricelist WHERE brand LIKE '%". $brand ."%' LIMIT $lastrec, 1") or die(mysql_error()); $data = mysql_fetch_array($results); $linktext[$i] = $data["description"]; } ///////////////////////////////////////////////// if ($ppage == $record){ ///////////////////////////////////////////////// $linktext[$i] = " [" . $i . "] " . $linktext[$i] . "\n"; ///////////////////////////////////////////////// echo("$i \n"); } // If current page don't give link, just text. else{ if ($ppage == 0) { ///////////////////////////////////////////////// $linktext[$i] = " [" . $i . "] " . $linktext[$i] . "\n"; ///////////////////////////////////////////////// echo("$i \n");} else { ///////////////////////////////////////////////// $linktext[$i] = " [" . $i . "] " . $linktext[$i] . "\n"; ///////////////////////////////////////////////// echo("$i \n");} } } if (!((($record+$limit) / $limit) >= $pages) && $pages != 1) { // If last page don't give next link. $next_page = $record + $limit; echo(" next\n");} ?>


Other Products In This List:

 
"); $count=1; } else { echo (""); $count=0; } } ///////////////////////////////////////////////// ?>
" . $linktext[$i] . "" . $linktext[$i] . "