Jump to content

buffsteve24

Members
  • Posts

    3
  • Joined

  • Last visited

buffsteve24's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks I will try that when I finish work and let you know if it solved it
  2. Hi, Thanks that worked a charm amazing it's always the little things like that you miss
  3. Ok so basically I have created a simple blog for my website which does what I want it to do pretty much I'm having a problem with the date though If I echo the date out in to my page it just shows the main body of my content and not the actual date :/ the other problem is when I am echoing the blog into my page It is showing the same content two or three times instead of selecting the other content in the db I currently have two articles in my db but it will only show the article with the id of 1 instead of outputting id 1 and id 2 into there respective places on the page <?php $mysql = new mysqli('localhost', 'root', 'root', 'blog') or die('There was a problem connecting to the database'); $stmt = $mysql->prepare('SELECT id, title, date, author, category, LEFT(body, 600) AS excerpt, body from posts ') or die('Problem preparing the query'); $stmt->execute(); $stmt->bind_result($id, $title, $body, $author, $category, $excerpt, $date); while($row = $stmt->fetch()) : $lastspaceindex = strrpos($excerpt, ' '); ?> <?php endwhile; ?> then where I am echoing them out here my code is <div class="extra-wrap"> <span class="text3"><a href="blog.php?id=<?php echo $id; ?>" class="link1"><?php echo $title; ?> </a></span> <div class="inner4"> <p> Posted by <b><?php echo $author; ?></b> in <b><?php echo $category; ?></b> </p> </div> </div> <div class="clear"></div> <div class="page2-box2"> <figure class="page2-img1"><img src="images/page2-img2.jpg" alt=""></figure> <div class="extra-wrap"> <?php echo substr($excerpt, 0, $lastspaceindex) . "<a href='blog.php?id=$id'>...</a>"; ?><br> <span class="text3"><?php echo substr() . "<a href='blog.php?id=$id'>Read More</a>"; ?></span> </div>
×
×
  • 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.