pmg206 Posted May 24, 2006 Share Posted May 24, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/10387-display-page-title-dynamically/ Share on other sites More sharing options...
AndyB Posted May 24, 2006 Share Posted May 24, 2006 There's no obvious reason why your code wouldn't do exactly what you want. Does it do something different? What do you see when you view the generated html code? Quote Link to comment https://forums.phpfreaks.com/topic/10387-display-page-title-dynamically/#findComment-38718 Share on other sites More sharing options...
pmg206 Posted May 24, 2006 Author Share Posted May 24, 2006 (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! Quote Link to comment https://forums.phpfreaks.com/topic/10387-display-page-title-dynamically/#findComment-38731 Share on other sites More sharing options...
AndyB Posted May 24, 2006 Share Posted May 24, 2006 [!--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\" /] Quote Link to comment https://forums.phpfreaks.com/topic/10387-display-page-title-dynamically/#findComment-38733 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.