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) {

$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

how to load php class from another domain?
how to load php class from another domain?

form submit at godaddy?
Trying to test form submission at GoDaddy and it does not seem to work. Here's the page...

h

php include email form with attachment
I have had no luck with finding a email form all over the Internet for various reasons. Some insecur

PHP5 - AJAX help
I've been following the tutorial on w2schools (http://www.w3schools.com/php/php_ajax_database.asp) a

Sending UDP Raw socket
I truly need help on this. I am trying to write a test program that simulate a network environment

how to easy edit text, with box? Help.
Hi.
I have a little problem. I'm doing a webpage for my aunt and I would like to make it as easy

login form can you find my error?
registrationform.php seems fine send data to registration.php
registration.php seems fine checks

show random images
hey guys

can someone please suggest a way in which the following code can be edited so it onl

simple php table loop
Hi all,

I've the following code

<?php // Create category options

void* and sizeof()
Hi,

Using void* and sizeof is it possible to get the value of the object ?

I understan

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