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

GMail like Chat in ASP.NET
Hi,Can anyone suggest me, how to incorporate GMail like chat in my existing ASP.Net application.I wa

Creating Images from images in PHP
Okay well I am trying to make a 'dynamic' calender image with PHP.

I have images like this:

phpMailer will not connect using SMTP
I am trying to use phpMailer with smtp:

Code: [Select]$mailer = new PHPMailer();
$mailer-&

What exactly is net neatrality?
What exactly is it? I think it's anti-censorship and... stuff... but I don't really understand it

Array question
Does anyone know how to create a program that takes the $ amount for 8 different departments and gi

My query is being run with no results.
I have this.

Code: function DropUser($duser_id, $user_email, $user_username) {

Disable Scrollbar in TableControl
Hello everbody,

please can anybody help me - outherwise i'm going to become desperate :P<

DataTable Help Required
Hi all I am creating an app that utilises and MS Access back end and queries it quite a bit at vario

How to Detect it is public_html or httpdocs?
How to check whether it is cPanel or Plesk?

If it found public_html perform <?php incl

PHP mail() with images
I'm trying to get images to send along with my HTML e-mail sent through PHP mail(). I only tried vie

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