Jump to content

billy61

Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Posts posted by billy61

  1. im running this query:

    $query     = "SELECT * FROM articles LIMIT 8 ORDER BY id DESC";
    $dbquery   = mysql_query($query)
    	or die('Could not query :<br/>' . mysql_errno() . " : " . mysql_error());

     

    and getting this error:

     Could not query :
    1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY id DESC' at line 1

    every mysql and php reference i can find on the web uses this same syntax, but for me its returning this error.

     

    can anyone help me?

  2. alright, so i'm workin on the comment system for my blog im building.....
    things are going smoothly, but i cannot seem to find the culprit of this error:

    Parse error: parse error, unexpected T_STRING in c:\appserv\www\bi30\tables2\comment.php on line 49

    comment.php:
    [code]
    <body>
    <?php
    $connect  = mysql_connect(localhost, root)
            or die('Could not connect :<br/>' . mysql_errno() . " : " . mysql_error());



    $dbconnect = mysql_select_db(content)
            or die('Could not find db :<br/>' . mysql_errno() . " : " . mysql_error());
    $query1  = "SELECT * FROM articles WHERE id='" . $id . "'";
    $result1 = mysql_query($query1)
            or die('Could not query :<br/>' . mysql_errno() . " : " . mysql_error());
    while($r1 = mysql_fetch_array($result1)) {
        $title   = $r1['title'];
        $author  = $r1['author'];
        $date    = $r1['date'];
        $article = $r1['message'];
        
        echo "<b>" . $date . "</b>" . "<br/><br/>";
        echo "<h1><b>" . $title . "</b></h1>" . "<br/><br/>";
        echo $author . "<br/><br/>";
        echo $article;
    }

    $date   = date('g') . ":" . date('i a M jS');
    $insert = "INSERT INTO comments(article_id, name, date, comment, ip) VALUES ('$id', '$name', '$date', '$message', '$ip');

    echo '<br/><br/>';
    $query2  = "SELECT * FROM comments WHERE article_id='" . $id . "'";
    $result2 = mysql_query($query2)
            or die('Could not query :<br/>' . mysql_errno() . ' :; . mysql_error());
    while($r2 = mysql_fetch_array($result2)) {
        $article_id = $r2['article_id'];
        $comment_id = $r2['comment_id'];
        $name       = $r2['name'];
        $date       = $r2['date'];
        $comment    = $r2['comment'];
        $ip         = $r2['ip'];

        echo $date;
        echo $comment . "<br/><br/>";
    }
    ?>[/code]
    i cut out some css styling at the top to save space, so the line numberings are off from my real document, line 49 is:
    [code]$query2  = "SELECT * FROM comments WHERE article_id='" . $id . "'";[/code]
    any suggestions or solutions?
×
×
  • 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.