get multiple rows


Posted on 16th Feb 2014 07:03 pm by admin

Hi I want to get multiple rows from a db

I am using this for the db query
Code: public function getCeleb($product_id) {
Did you know?Explore Trending and Topic pages for more stories like this.

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_celeb WHERE product_id = '" . (int)$product_id . "'");


foreach ($query->rows as $result) {
$celeb_id = $result['celeb_id'];
}

return $celeb_id;
}
and this to display the returned data

Code: 'celeb_id' => $result['celeb_id']
print_r ($celeb_id);

the problem is i only get one result from the database and i have multiple entries with the same id

thanks in advance
No comments posted yet

Your Answer:

Login to answer
268 Like 12 Dislike
Previous forums Next forums
Other forums

get url?
how do i get the url of the page i'm currently on, on my website.. i think its get header.. how do i

close site for maintenance
i get a tutorial, saying the following code can put our site offline, and only the developer can vie

SCO Unix
I know this might not be the place to ask, but, can anyone tell me if SCO Unix comes with PHP built

FTP issues
Hi all,


I am currently facing some serious problems with a script and really need some ad

Help with simple query
Hi,

I'm trying to do a Query with a Union where I want to print the number of rows $tc conta

Setting/Modify Headers using mail() function
I have a question about setting email headers when using mail() in a php script.

When I send

Price in PR
Dear Experts,
Why we have to enter the price in the PR, and why there is no free goods indicato

How to update this array?
I am saving a string that looks this: username1, username2, username3...
into a single cell in a

Calling a Procedure with IN & OUT Parameters
Hello,

I usually call my procedures using the following way

declare variable e

Bar charts using Graphical Framework.
I am using Graphical Frameworks(GFW) to create a chart Graphic . There is no problem with the data d

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash