I am working on a cms that will pull content from the database (dah) but when I pull the content it displays improperly. I've saved the content using a 'long text' field in the database. Here's what gets displayed:
Basic Camera Operation And Basic Field Production:

Basic knowledge of how to use a camcorder to videotape your event. Step by step breakdown on camcorder use, and do�s and don�ts of camera operations.
Training will cover the following:

Battery and AC use and applications (1 HR.)

* Tape loading
* Basic Auto settings for immediate recording
* Camera movement (do�s and don�ts)
      o Panning left to right[/COLOR]

The page is not rendered with the CSS and those funky characters show up instead of ' or ". Is there somewhere where I should use something to 'decode' the content in the database?
Here's the PHP:

 <div id="content">
		<?php
			$page = (isset($_GET['page'])) ? $_GET['page'] : "1";
			$sql = "SELECT content FROM pages WHERE id='$page'";
			$result = $conn -> query($sql) or die(mysqli_error());
				if($result) {
				$row = $result->fetch_object();
					echo $row->content;
				}   

	?>
    </div>

    The "funky" quotes are likely a result of copying and pasting the text from an application such as MS Word that uses "directional" quotes. See http://www.charles-reace.com/blog/2008/10/15/filtering-ms-word-text/ for one approach to dealing with this.

    As far as the CSS not being applied, there's not enough info here for me to have any idea why, unless the code you've shown us is everything, in which case I do not see any place where you load the CSS stylesheet.

      Thanks NogDog, Here's what I did. I am changing a static website to dynamic with TinyMCE editor for the client to edit content. I use Dreamweaver CS3 building pages. So I copied the following html from one of the pages and pasted it into the database field 'content':

       <p class="headtext">Welcome to Saugus Community Television</p>
      <hr />
      <p class="regtext">
      Saugus Community Television, Inc., (SCTV) is an independent non-profit 501 (C)(3) SCTV operates and oversees the PEG (Public, Educational, and Government) access channels on the cable television system in Saugus, Massachusetts. Channels we presently operate are Channel 8 and Channel 10. We are now operating out of Saugus High School, 1 Pearce Memorial Drive, at the rear of the High School.
      <p class="headtext">Mission</p>
      <p class="regtext">Our Mission at SCTV is to provide: “Television by the people, for the People”. People TV. We wish to provide our viewing public, our citizens, and institutions, located in Saugus, the equipment, training, and cable broadcast time necessary to communicate programming of interest. At the same time we wish to encourage and empower the individual and the community by ensuring First Amendment expression through the use of television. We look forward to helping you achieve your goals. Get involved. We want to put “you” back into community.</p>

      The 'headtext' and 'regtext' classes are not working. Here's the CSS

      .regtext {
      	font-family: Arial, Helvetica, sans-serif;
      	font-size: 13px;
      	color: #525252;
      }
      
      .headtext {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 18px;
      font-weight: bolder;
      color: #d11101;
      }

        But where does the generated page load the CSS file? It needs a <head> section with a <link> tag that will load it. You may need to include it in the PHP script:

        <html>
        <head>
        <title>Page Title</title>
        <link rel="stylesheet" href="http://www.example.com/styles/stylesheet.css" />
        <!-- any other 'head' stuff you want here -->
        </head>
        <body>
            <div id="content">
                <?php
                    $page = (isset($_GET['page'])) ? $_GET['page'] : "1";
                    $sql = "SELECT content FROM pages WHERE id='$page'";
                    $result = $conn -> query($sql) or die(mysqli_error());
                        if($result) {
                        $row = $result->fetch_object();
                            echo $row->content;
                        }   
        ?> </div> </body> </html>

          Here's the entire index.php page:

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
          <html lang="en">
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
          <link href="css/saugustv2.css" rel="stylesheet" type="text/css" />
          
          <title>Saugus TV</title>
          </head>
          <body>
          <div id="minHeight"></div><!--Opera and IE8 min-height fix-->
          <div id="wrapper">
              <div id="header">
                  <img class="logo" src="http://saugustv.org/images/logo2.jpg" width="779" height="155" />
              </div>
              <div id="container">
                  <div id="left-nav">
                  <div id="menu1">
          <ul>
          <?php
          	require("connections/dbconn.php");
          	$sql = "SELECT name, url, title FROM nav";
          	$result = $conn -> query($sql) or die(mysqli_error());
          		if($result) {
          		while($row = $result->fetch_object()) {
          			echo "<li><a href='{$row->url}' title='{$row->title}'>{$row->name}</a></li>";
          		}
          	}
          ?>
          </ul>
          </div></div>
                  <div id="content">
          		<?php
          			$page = (isset($_GET['page'])) ? $_GET['page'] : "1";
          			$sql = "SELECT content FROM pages WHERE id='$page'";
          			$result = $conn -> query($sql) or die(mysqli_error());
          				if($result) {
          				$row = $result->fetch_object();
          					echo $row->content;
          				}   
          
          	?>
              </div>
          </div><!--end container--> 
          </div><!--end wrapper-->    
          <div id="footer"> 1 PEARCE MEMORIAL DRIVE • SAUGUS, MA 01906<br />PHONE - 781.231.2883 • FAX - 781.233.3433 </div> </body> </html>

          The CSS for the menu works fine so I know the css is attached. I must be doing something wrong when I copy and paste the data (using PHPMyAdmin) into the database field

            Write a Reply...