Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: Reading news from table on server

  1. #21
    Join Date
    Jan 2006
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I have put
    PHP Code:
    $result mysql_query($query)
    or die(
    "<b>A fatal MySQL error occured</b>.\n<br />Query: " $query "<br />\nError: (" mysql_errno() . ") " mysql_error()); 
    There is no error shown. so, this works Problem is:
    1.it gives me just first row
    2.only first column has correct link like:
    http://mywebsite/article.php?id=1
    It should have all columns above link

    I have put echo count($rec)."<br>"; and number is 14

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

    Default

    In this case, I would ask you to give the URI to the page in question.
    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!

  3. #23
    Join Date
    Jan 2006
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Dear Twey,
    I have now tested and tested. I have code and it shows me all rows and columns.
    First column (ID for article) shows correct link like: http://www.mywebsite/article.php?ID=1 (for first row) and ID=2 for second row)


    Do you have any suggestions how to do that also other columns will have this link?

    Code is the following for while:
    PHP Code:
        while (list($key$value) = each($row))
        {
            
    $i++;
            if(!(
    $i%2))
               echo 
    "<td><b><a href='?order=$key'>$key</a></td>";
        }
        echo 
    "</tr>";
        
    $result=mysql_query($sqlQuery);
        
    // Make rows for records
        
    while($rec=mysql_fetch_array($result))
        {
            echo 
    "<tr>";
            for(
    $i=0;$i<count($rec);$i++)
            {
                if(
    $rec[$i])/*continue;*/


    $query "SELECT ID FROM news where ID = '$rec[$i]' ";
    $s mysql_query($query);
    //echo(mysql_error($s));

    $result2 mysql_fetch_assoc($s);
    $ID=$result2['ID'];

                    echo 
    '<td><a href="article.php?id='.$ID.'"><B>'.$rec[$i].'</B></A></td>';
            }
            echo 
    "</tr>";
        }
        echo 
    "</table>";

    Last edited by toplisek; 03-28-2006 at 09:53 PM.

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
  •