SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: MySQL Trouble

  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Location
    Durham, North Carolina
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL Trouble

    I have the following query :

    Code:
    $anviews = $DB_site->query("SELECT views FROM AnnouncementViews WHERE KY=1");
    However whenever I put $anviews, like in an echo statement it returns Resource ID #8,

    This is the code I used to create the database :

    Code:
    CREATE TABLE AnnouncementViews (Views int(10) unsigned DEFAULT "1" NOT NULL, KY int(10) unsigned DEFAULT "1" NOT NULL ,PRIMARY KEY (KY))
    Code:
    INSERT INTO AnnouncementViews VALUES(1,1)
    BTW $DB_Site->query I belive is a function specific to vBulletin (a PHP script) that sends MySQL commands to the configured database. The database is configured right, but when I put the variable $anviews somewhere again all it returns is Resource ID #8
    Last edited by damicatz; Nov 4, 2001 at 18:37.

  2. #2
    This is all Mumbo Jumbo Amit's Avatar
    Join Date
    Oct 2001
    Location
    New Delhi, India
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this ...
    PHP Code:
    while ($row mysql_fetch_array($anviews))
    {
        echo 
    $row['views'];
        
    // if you views is multiple line you may want to use the following instead of the above
        
    echo nl2br$row['views'] );
    }
    mysql_free_result($anviews); 


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
  •