Jump to content

Search the Community

Showing results for tags 'fetch_array()'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I'm using PHP 5.3.13. I am just using a very simple query to grab one column of results from a table. I would like to fetch them and then iteratively add them to a dropdown menu. I am trying to understand these methods/functions and seem to be missing something. My research on Google didn't give me any indication of what I'm doing wrong. I start with one of the simplest queries possible, which I know will return a data set as I have tested it in mysqladmin. The problem arises when I try to call the method on the mysqli_result object. $query = "SELECT `artist` FROM `bands`;"; $result = $mysqli->query($query); $bandArr = $result->fetch_all(); The error I'm getting from the above code is: Fatal error: "Call to undefined method mysqli_result::fetch_all()..." I researched this error and read somewhere that you need mysqlnd. Is that true? Do I need to look into my PHP configuration to get this to work? Is it worth it for this task? Then I tried fetch_array... $query = "SELECT `artist` FROM `bands`;"; $result = $mysqli->query($query); $bandArr = $result->fetch_array(MYSQLI_NUM); printf("%s\n%s", $bandArr[0], $bandArr[1]); And the above code for some reason returns an array with only one item, and this error: "Notice: Undefined offset: 1 in..." What am I missing here? Again, all I want is a small result set from one column which can be iterated and each value added to a drop down menu. Thoughts? Suggestions? Thanks in advance for any help you can offer...
×
×
  • 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.