Results 1 to 6 of 6

Thread: getting data from DB

  1. #1
    Join Date
    Aug 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation getting data from DB

    I get the following error when i try to get the data from my SMF forum Database

    PHP Code:
    Parse errorparse errorexpecting `','' or `';'' in D:\Program Files\xampp\htdocs\posts.php on line 10 
    And the script is:

    PHP Code:
    <?php
    include 'config.php';

    $query  "SELECT subject FROM smf_messages LIMIT 8 BY DESC"."SELECT ID_MSG FROM smf_messages LIMIT 8 BY 

    DESC"
    ."SELECT ID_TOPIC FROM smf_messages LIMIT 8 BY DESC";
    $result mysql_query($query);

    while(
    $row mysql_fetch_array($resultMYSQL_ASSOC))

    {
        echo 
    "<font color=grey size=2>><a 

    href="
    http://l2rt.coolc.biz/forum/index.php/topic,{$row['ID_TOPIC']}.msg{$row['ID_MSG']}.html#msg{$row['subject']}">

    {$row['subject']}</a></font><br>";

    }


    include 'close.php';
    ?>
    I could not find the problem.. any help is appercited thanks!

  2. #2
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    try this:
    PHP Code:
    <?php
    include 'config.php';

    $query  "SELECT subject FROM smf_messages LIMIT 8 BY DESC"."SELECT ID_MSG FROM smf_messages LIMIT 8 BY DESC"."SELECT ID_TOPIC FROM smf_messages LIMIT 8 BY DESC";

    $result mysql_query($query);

    while(
    $row mysql_fetch_array($resultMYSQL_ASSOC)) {
        echo 
    "<font color=grey size=2><a href=\"http://l2rt.coolc.biz/forum/index.php/topic,{$row['ID_TOPIC']}.msg{$row['ID_MSG']}.html#msg{$row['subject']}\">{$row['subject']}</a></font><br>";

    }


    include 
    'close.php';
    ?>
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  3. #3
    Join Date
    Aug 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Code:
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\Program Files\xampp\htdocs\posts.php on line 8
    Dosen't work...

  4. #4
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    Code:
    <?php
    include 'config.php';
    
    $query  = "SELECT subject FROM smf_messages LIMIT 8 BY DESC "."SELECT ID_MSG FROM smf_messages LIMIT 8 BY DESC "."SELECT ID_TOPIC FROM smf_messages LIMIT 8 BY DESC";
    
    $result = mysql_query($query);
    
    while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        echo "<font color=grey size=2><a href=\"http://l2rt.coolc.biz/forum/index.php/topic,{$row['ID_TOPIC']}.msg{$row['ID_MSG']}.html#msg{$row['subject']}\">{$row['subject']}</a></font><br>";
    
    }
    
    
    include 'close.php';
    ?>
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  5. #5
    Join Date
    Aug 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    1. dont work
    2. lol its the same.. :|

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    mysql_query() only does one query at a time. Also, validate your HTML.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •