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

Help with page encoding issue and weird characters
I'm trying to write a screen scraper and when I pull out the lines of the html file that I'm interes

Session login issue
I'm wondering how to fix a problem I'm having with a session-based login system

Say I go to h

How do I replace any number of character occurences with one occurrence?
How do I replace any number of character occurences with one occurrence?

Let's say I have:

Rss feed question
Hi

My blog and my website are different. Am i able to take my rss feed
from my blog and p

Call Screen statement Error
Dear Experts,

is there any setting that needs to be done before creating any dialog progr

PO Release Strategy Issue
Hi Experts,

I am facing an issue related to PO release strategy. The details are-
<

iMatch stored value with the current value in a loop
Hello,

I have a MySQL db were I store articles in.

I have a form to fill these article

A little help needed passing hidden values to next page
I have a page that has hidden values in a form.

example
Code: <input name='signupID

first id from db not showing
I have a php script which displays the content of a mysql table as a html table with sorting, delete

How to restrict the display of report variants
Hello All,

I want t know how to restrict the display of report variants.
I mean, whe

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