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

268 Like 12 Dislike
Previous php-forum Next php-forum
Other php-forum

Placing and array within an array then sorting it!
I have a page that runs two large mysql queries and saves the results into arrays, in php I then per

Upload Code Help
Hi everyone I need some help with a bit of code ive been working with for a while. I am completely s

Is there a quick way to do this?
Hi all,

I need to create a mysql table from php that goes a little something like this

Display a default image
I am trying to display generic image for items that don't have one, but I can't get it to display.

Displaying a clickable playername
I am going wrong somewhere with the mysql_query, can someone please put me straight?

$playern

Passing Variables
What I'm wanting to do is when the user clicks on Arenas it will know the name of the country it's w

Unable to display contents in Second Drop Down Box
Hi All,

What I am trying to do is 2 dependent drop down boxes and when user selects su

Code working in IE but not FireFox
I created a dynamic navigation list for my website based off of a table in my database. The code is

Problem displaying "scraped" XML data
I'm basicly having trouble displaying XML data scraped from an URL using cURL.

What the code

form problem
below in the form action, i've put "test.php?w=$sw&h=$sh" but when i input the for

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