dgotti007
12-30-2010, 12:34 AM
Hello All I hope i am in the right place.
I am new to PHP and most of the time and get all of my stuff to work, but I am currently working with some one elses code and I am not able to get the dynamic Title, Meta Tag and Description to pull from the MYSQL Database.
The only "title" that shows is the echo. I have double checked in the database and all of the fields are filled in. Please ask as many questions as you need, I am pulling my hair out trying to get this to work.
Below is the code that I have been working with:
<?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['c_title']) {
echo $row['c_title'];
}else{
echo 'Surety1 - Buy Surety Bonds Fast!';
}
?></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">
I am new to PHP and most of the time and get all of my stuff to work, but I am currently working with some one elses code and I am not able to get the dynamic Title, Meta Tag and Description to pull from the MYSQL Database.
The only "title" that shows is the echo. I have double checked in the database and all of the fields are filled in. Please ask as many questions as you need, I am pulling my hair out trying to get this to work.
Below is the code that I have been working with:
<?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['c_title']) {
echo $row['c_title'];
}else{
echo 'Surety1 - Buy Surety Bonds Fast!';
}
?></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">