Results 1 to 2 of 2

Thread: PHP Select From Multiple Table with Separated Comma

  1. #1
    Join Date
    Apr 2020
    Thanked 0 Times in 0 Posts

    Default PHP Select From Multiple Table with Separated Comma

    I have two tables in MySql.. First table's name is ANIMAL and second table's name is DESCRIPTION

    HTML Code:
     -----|------      ------|-------------|--------
        ida  | name        idb  | desc        | barcode
        -----|------      ------|-------------|--------
        1    | eagle        1   | bla bla bla | 1,3,4
        2    | lion         2   | cla cla cla | 3,4
        3    | bird         3   | dla dla dla | 1,2,3
        4    | bee          4   | ela ela ela | 2,4
        -----|------      ------|-------------|--------
    then I want to get all desc value from DESCRIPTION that related with bird in ANIMAL table. I tried with the following line code:

    $check = mysqli_query($dbconnection, "SELECT desc FROM description LEFT OUTER JOIN animal ON description.barcode=animal.ida WHERE'bird'");
    while($data=mysqli_fetch_array($check)) {
    $result = $data['desc'];

    but no result from my above line code. I have search in many tutorial but still no result too. Any solution how to get the data as I need? thanks before.

  2. #2
    Join Date
    Jan 2007
    Davenport, Iowa
    Thanked 120 Times in 118 Posts


    Your post accidentally got flagged as spam. Our spam filter can be overly strict with new visitors.

    One thing that I note, and it may cause troubles later if not already, is you have one column labeled as desc, which in MySQL is a command to sort values from highest to lowest and I'll admit is confusing me a bit.

    It looks like you are trying to work with a normalized table. Is that correct? Please see this useful introductory article on Normalized tables here.

    It seems obvious, but just to be sure, I take it that ida corresponds with idb?

    EDIT: I tried to recreate your table for DESCRIPTION and I was flagged for trying to use a reserved word (desc) as a column name.

    To help me out a bit more, could you list a couple example results and change the content you have in the desc column to more relevant data?
    Last edited by james438; 04-16-2020 at 09:31 PM.
    To choose the lesser of two evils is still to choose evil. My personal site

Similar Threads

  1. Replies: 1
    Last Post: 06-29-2013, 07:10 PM
  2. Replies: 4
    Last Post: 03-23-2010, 01:35 AM
  3. Select IN table
    By Master_script_maker in forum MySQL and other databases
    Replies: 6
    Last Post: 10-25-2009, 06:41 PM
  4. Resolved select from table
    By Feckie in forum MySQL and other databases
    Replies: 0
    Last Post: 09-05-2009, 10:45 AM
  5. Multiple emails validation in one text box with comma
    By giselle2008 in forum JavaScript
    Replies: 2
    Last Post: 06-12-2009, 10:28 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts