SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    trouble with mysqli & fetch_assoc()

    I am trying to move some code to php5 & mysqli objects and I am running into a problem with getting a row in an associative array.

    The keys to not seem to be coming over correctly. I have included the code I am using and the var_dump() of one of the rows I get back from the $result->fetch_assoc() line.

    PHP Code:
      $query "SELECT * FROM news WHERE Topic LIKE '$topic' ORDER BY Date DESC" ;
                 
               
    $result $this->mysqli->query($query);
             
                 
    $returned_ID = array();
             
                 while ( 
    $row $result->fetch_assoc() ) {
                        
                     
    var_dump($row);
                     
                     
    $returned_ID[] = $row['ID'];
                        
                 }
    // end while rows returned       
             
            
    return $returned_ID
    var_dump result - (this is a news story I am pulling from the database with fields ID, date, category, title, and body)
    array(5) { [" B"]=> string(2) "51" [""]=> string(10) "2004-11-14" [" @"]=> string(3) "All" [""]=> string(15) "EMAIL BACK UP!!" [""]=> string(726) " Due to a power outage hosing our email server late Thrus. night we had to move to a new system. It is in place and the link to your email from the front page will work to get you to the new system.

    Your username is the same, please either email me from another account or call me at 810-441-6454 (cell) to get your new password.

    I am still working on recovering the old email messages and I will get those to everyone as soon as I can save what I can.

    I cannot apologize enough for this trouble and if there is anything I can do to help ease the trouble this has caused don't hesitate to ask.

    Rick Hading
    The MSU/FAME Tech Team
    Last edited by deuce868; Nov 23, 2004 at 15:30.
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  2. #2
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I tried this on my windows dev machine and I don't get this problem. So I ran phpinfo() on the server and there are some differences in what the mysql and mysqli sections report.

    Anyone see anything wrong with this?

    [mysql]
    MySQL Support enabled
    Active Persistent Links 1
    Active Links 1
    Client API version 4.1.7
    MYSQL_MODULE_TYPE external
    MYSQL_SOCKET /var/run/mysqld/mysqld.sock
    MYSQL_INCLUDE -I/usr/include/mysql MYSQL_LIBS -L/usr/lib -lmysqlclient

    [mysqli]
    MysqlI Support enabled
    Client API version 4.1.7
    MYSQLI_SOCKET /var/run/mysqld/mysqld.sock
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."


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
  •