I am new to PHP and i am looking at existing code trying to find out why the Name and meta description are not being pulled from the database correctly.
Like i said this site has been up and running for sometime now and we finally added google webmaster tool and saw that all of the category pages have the same title and are missing the meta descriptions. I took a look at the code and can see where it should be pulling this information but the only thing that is being populated is the "echo" information.
I know I am not very good at explaining things so if this does not make any sense please ask me any questions you need to.
Code:
Code: Select all
<?php
session_start();
include_once("include/configuration/config.php");
// if category was selected
if(isset($_REQUEST['id']) && $_REQUEST['id'] != "")
{
// get bond info
$sql = "
SELECT
tbl_bond. *,
tbl_cat.*
FROM
tbl_bond
INNER JOIN tbl_cat ON tbl_bond.cat_id = tbl_cat.c_id
WHERE
tbl_bond.cat_id = '" . $_REQUEST['id'] . "'
AND tbl_bond.is_active LIKE '%Y%'
ORDER BY
tbl_bond.b_name
";
$rs_bond = mysql_query($sql);
$SEARCH = "F";
}else{
// if no category then must be a failed auto complete search from home page
// so do full text search on tbl_bonds and show results
$query_search = "
SELECT
tbl_bond.*,
tbl_cat.c_name
FROM
tbl_bond,
tbl_cat
WHERE
tbl_cat.c_id = tbl_bond.cat_id
AND MATCH (b_name, b_desc) AGAINST ('" . mysql_escape_string(urldecode($_REQUEST['txtSearch'])) . "')
AND tbl_bond.is_active LIKE '%Y%'
ORDER BY
tbl_bond.b_name
";
$rs_bond = mysql_query($query_search);
$r_rows = mysql_num_rows($rs_bond);
// full text failed try again using LIKE search
if($r_rows == 0) {
$query_search = "
SELECT
tbl_bond.*,
tbl_cat.c_name
FROM
tbl_bond,
tbl_cat
WHERE
tbl_cat.c_id = tbl_bond.cat_id
AND b_name LIKE '%" . mysql_escape_string(urldecode($_REQUEST['txtSearch'])) . "%'
AND tbl_bond.is_active LIKE '%Y%'
ORDER BY
tbl_cat.c_name,
tbl_bond.b_name
";
$rs_bond = mysql_query($query_search);
}
$SEARCH = "T";
}
while($row_bond = mysql_fetch_assoc($rs_bond))
{
$bonds[] = $row_bond;
}
$num_bonds = count($bonds);
$half = floor(($num_bonds-1)/2);
?><!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">
<head>
<title><?
if($row_bond['c_title']) {
echo $row_bond['c_title'];
}
?></title>
<meta name="Keywords" content="performance, bonds, performance bond, surety, bond, contract bond, surety bonds, bonding, contract">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="<? if($row_bond['c_mdesc'] != "") { echo $row_bond['c_mdesc']; } ?>">
<meta name="Keywords" content="<? echo $row_bond['c_keywords']; ?>">
<?php include('include/meta.php'); ?>
<script language="JavaScript" type="text/JavaScript">