Jump to content

Multidimensional array


ram4nd

Recommended Posts

I would like to create a multidimensional array. Whith 2 existing arrays. Just put them together in 1 array.

 

Theese are my arrays:

$results1 = $mysql->doQueryA("SELECT name FROM category_id");
$results2 = $mysql->doQueryA("SELECT name FROM subcategory_id");

Link to comment
Share on other sites

Umm, what do you mean by table setup?

I think the point of the question is to determine whether a subcategory is associated with a specific category, because you may be able to execute a single SQL query to retrieve data from both tables in one go

 

Yeah thats what i was getting at...

Link to comment
Share on other sites

Umm, ok it is not associated.

category - id name

subcategory- id name category_id

suggests that it is associated, on category_id.

 

Alternatively, you could use a UNION in your query:

SELECT ID,
       NAME
  FROM CATEGORY
UNION
SELECT ID,
       NAME
  FROM SUBCATEGORY

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.