MYSQL permalinks

Discussion in 'MySQL' started by saadi123, Aug 2, 2010.

  1. #1
    I am trying to give my each blog posts a permalink where upon clicking the blog post's title on the main page the database exclusively shows the respective blog post. I have used the following PHP code, but the result is a blank page. Obviously there are errors in the code. So please help me debugging it so that it works effectively. The code is as:

    $result = mysql_query("SELECT post_title, post_body From posts ORDER BY post_no DESC $limit");
    while($row = mysql_fetch_array($result))
    {
    $title = $row[0];
    $content = $row[1];
    $perma_link = mysql_query("SELECT post_title, post_body FROM posts WHERE post_title = $row[0]");
    echo("<h3>"'<a href="{$_SERVER['PHP_SELF']}?$perma_link">$title</a> ."</h3><hr style='color: brown'><br/> .$content" ."<hr style='width: 80%; align: center; color: brown'><br/><br/><br/>");
    };

    $result = mysql_query($query, $con_mysql_db) or trigger_error("SQL", E_USER_ERROR);
     
    saadi123, Aug 2, 2010 IP
  2. freshdevelopment

    freshdevelopment Notable Member

    Messages:
    1,303
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    240
    #2
    You have quite a few errors in thaqt script, starting at where you try to set $perma_link... what do you want $perma_link to contain?
     
    freshdevelopment, Aug 4, 2010 IP