Hey everybody,

I'd like to get some specific, but not all rows of a MySQL DB into an array, like those I get if I use mysql_fetch_array().
But feth_array, fetch_row, fetch_object, etc... just returns one row. There are many search functions in the internet, so it must be possible. I don't want to check every object in the table because it's pretty big and that takes a while.

~ StuntHacks

Recommended Answers

All 2 Replies

The fetch functions return one row of the result set, which is returned by a query you execute against that big table. Make the right query so the database server does all the hard work.

I think provided your query is correct, use a while loop to output the rows like

$query = //this is your SQL statement;

while ($row = $query->fetch_object()) {
    echo $row->id, '<br>';
    echo $row->the name of your column you selected;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.