Results 1 to 2 of 2

Thread: Dynamic fields not showing

  1. #1
    Join Date
    Dec 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Dynamic fields not showing

    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:
    Code:
    <?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">
    Last edited by dgotti007; 12-30-2010 at 12:35 AM. Reason: spelling error

  2. #2
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 21 Times in 21 Posts

    Default

    In the code you have shown the variable $row has not been given a value anywhere from any query. So either it has been wrongly coded before or the code for the title is in another php page.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •