Jump to content

Php Array from query


thecableguy2011

Recommended Posts

Hi

 

I am trying to store the results of a mysql query into a php array. Here is the code i am using

 

$test = implode(",",$_GET['checkbox']);

        $query = mysql_query("SELECT categoryTitle FROM `category` where categoryid in ($test)");

        $test2 = array();

        while ($result = mysql_fetch_assoc($query))

        {

            $test2[] = $result;

       

        } 

        $test3 = implode(", ",$test2);     

        print_r($test3);

 

Everything works fine until implode the array. When i try to print after the implode the result is "Array, Array". if i remove the implode it prints "Array ( [0] => Array ( [categoryTitle] => Escalators & Lifts ) [1] => Array ( [categoryTitle] => Human Resource/Payroll/ Training ) )"

The values here are ture. Im thinking that its storing an array inside another array so cannot implode. Is there something i can do to solve this

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.