I had posted about this before here, but looks like i need to be more basic on what i want, so really it comes down to I need to get data from mysql database and put it to where it will show in the title of the page.

In my mysql database my news program stores the title of each story we write as "titletext" so now i need to have "titletext" show up on the pages of news. I know theres a way im just not as advance to figure this out without help.

    $somevar=$some_variable_that_clues_the_db_which_story_you_are_showing;
    
    $sql="select titletext from my_database where story_id=$somevar;";
    $result=mysql_query($sql);
    if (!$result) {
       die("No result from database.  Error text: ".mysql_error());
    } 
    $title=mysql_result($result,0);
    
    echo "<title>$title</title>";

    HTH,

      ha! perfect timing, i had just found some help on another site and wrote that very code with a bit more added with the 'id' and other inputs that i needed, but i do have it working just right now.

      Thanks!

        Write a Reply...