Creating Blog

Discussion in 'PHP' started by blink1007, Dec 27, 2009.

  1. #1
    Hi! Could someone help to find the error on line 11? I would very appreciate your help!

    <?php

    require("header.php");

    $sql="SELECT entries.*, categories.cat FROM entries, categories
    WHERE entries.cat_id=categories.id
    ORDER BY dateposted DESC
    LIMIT 1
    $result=mysql_query($sql);
    $row=mysql_fetch_assoc($result);
    echo "<h2><a href='viewentry.php?id=".$row['id']."'>
    ".$row['subject']. "</a></h2><br />";
    echo "<i> In <a href='viewcat.php?id=".$row['cat_id']. "'>
    ".$row['cat']."
    "</a> - Posted on" .date("D jS F Y g.iA", strtontime($row['dateposted']))."</i>";
    echo "<p>";

    require("footer.php");

    ?>
     
    blink1007, Dec 27, 2009 IP
  2. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try this
    <?php
    
    require ("header.php");
    
    $sql = "SELECT entries.*, categories.cat FROM entries, categories
    WHERE entries.cat_id=categories.id
    ORDER BY dateposted DESC
    LIMIT 1";
    $result=mysql_query($sql);
    $row=mysql_fetch_assoc($result);
    echo " < h2 > < a href = 'viewentry.php?id=".$row['id']."' > ".$row['subject']. " < / a > < / h2 > < br / > ";
    echo " < i > In < a href = 'viewcat.php?id=".$row['cat_id']. "' > ".$row['cat']."</a> - Posted on".date("D jS F Y g.iA", strtontime($row['dateposted'])).
    	"</i>";
    echo "<p>";
    
    require ("footer.php");
    
    ?> 
    PHP:
     
    JAY6390, Dec 27, 2009 IP
  3. blink1007

    blink1007 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sorry, the lines order were distorted. The error is somewhere on viewentry.php?id...
     
    blink1007, Dec 27, 2009 IP
  4. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ? The code above is valid (although your original code and html is somewhat poor)
     
    JAY6390, Dec 27, 2009 IP
  5. blink1007

    blink1007 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks, very very much for help. But now I just see a plain white page without anything. Of course, it is better than parse error. :D
     
    blink1007, Dec 27, 2009 IP
  6. blink1007

    blink1007 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I improved a bot. But now this happens:
    [home]
    < h2 > < a href = 'viewentry.php?id=1' > Welcome to my blog! < / a > < / h2 > < br / >
    Fatal error: Call to undefined function strtontime() in C:\xampp\htdocs\Blog\index.php on line 12

    Any helpful suggestions?
     
    blink1007, Dec 27, 2009 IP
  7. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Well strtontime isn't a function as the error clearly states
    You need to read some of the manual. These are simple errors, and it tells you the problem in plain english
     
    JAY6390, Dec 27, 2009 IP
  8. blink1007

    blink1007 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Now it works, but the output is not what was expected:
    < h2 > < a href = 'viewentry.php?id=1' > Welcome to my blog! < / a > < / h2 > < br / > < i > In < a href = 'viewcat.php?id=1' > Life - Posted onSun 27th December 2009 1.53PM
     
    blink1007, Dec 27, 2009 IP