Jump to content

Display page title dynamically?


Recommended Posts

I have this inkling this a no-brainer, but my culling through this forum, Google and two Dummies books hasn't brought me to a solution, so I thought I'd give a shout out.

Using Dreamweaver and my Yahoo! MySQL 4.1.14 hosted database, I'm trying to display a record with the page's title taken from database values. The values are inserted into the table fine, located within the body of the page. My strong suspicion is the problem is the <title> tag sits in the head area, thus it's confused.

Or, I'm confused. Thinking {Picture => 1000 words}, the code is below. But the notion is the desired result would be <title>Star Wars (1977)</title> with variables inserted, taken from <title><? $title ?> (<? $year ?></title>.

[code]<?php require_once('Connections/spoil.php'); ?>
<?php
$colname_spoiler_page = "-1";
if (isset($_GET['id'])) {
  $colname_spoiler_page = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}

if (isset($_GET['id'])) {
  $colname_duckscore = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_spoil, $spoil);
$query_spoiler_page = sprintf("SELECT * FROM titles WHERE id = %s ORDER BY id ASC", $colname_spoiler_page);
$spoiler_page = mysql_query($query_spoiler_page, $spoil) or die(mysql_error());
$row_spoiler_page = mysql_fetch_assoc($spoiler_page);
$totalRows_spoiler_page = mysql_num_rows($spoiler_page);

mysql_select_db($database_spoil, $spoil);
$query_duckscore = sprintf("SELECT * FROM titles right join ducks on titles.ducksid = ducks.id where titles.id = %s", $colname_duckscore);
$duckscore = mysql_query($query_duckscore, $spoil) or die(mysql_error());
$row_duckscore = mysql_fetch_assoc($duckscore);
$totalRows_duckscore = mysql_num_rows($duckscore);
?>

<head>
<title>Frank's Spoiled Movie Endings | <?php echo $row_spoiler_page['title']; ?> (<?php echo $row_spoiler_page['year']; ?>)</title>
... other code ...
</head>

<body>
... code here...
          <td width="500"<strong>Title</strong></td>
          <td width="60"><strong>Year</strong></td>
          <td width="60"><strong>Length</strong>(Minutes)</td>
          <td width="50"><strong><MPAA Rating</strong></td>
          <td width="110"><strong>My Rating</strong></td>
        </tr>
        <tr valign="top">
          <td width="500"><strong><?php echo $row_spoiler_page['title']; ?></strong></td>
          <td width="60"<?php echo $row_spoiler_page['year']; ?></td>
          <td width="60"<?php echo $row_spoiler_page['min']; ?></td>
          <td width="50"<?php echo $row_spoiler_page['rating']; ?></td>
          <td><img src="<?php echo $row_duckscore['url']; ?>" alt="<?php echo $row_duckscore['alt']; ?>" /></td>
        </tr>
... more code there...
[/code]
Link to comment
Share on other sites

(whew)... well, at least I'm not losing my marbles in the process. :)

What it does, presently, is...

... yeah, now its working. And I pinky promise I've done nothing between this moment and the last hour when it no workie.

Thanks for your validation, Andy, that I wasn't losing it. And like so many public leaders, I won't question success, merely take credit for it (however misplaced it is in this case). Thanks again!
Link to comment
Share on other sites

[!--quoteo(post=376836:date=May 24 2006, 07:03 PM:name=pmg206)--][div class=\'quotetop\']QUOTE(pmg206 @ May 24 2006, 07:03 PM) [snapback]376836[/snapback][/div][div class=\'quotemain\'][!--quotec--]And I pinky promise I've done nothing between this moment and the last hour when it no workie. [/quote]

Glad it worked out for you. Let's blame the earlier problem on Microsoft [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.