Jump to content

Recommended Posts

Ok here is my code:

 

$gettype = mysql_query("SELECT * from type ORDER BY name asc LIMIT 20");

$getxxxxx = mysql_query("SELECT * from xxxxx ORDER BY name asc");

$typeamount = mysql_num_rows($gettype);

echo "We have $typeamount xxxxx Catagories.<br />";

while ($type = mysql_fetch_array($gettype)){

$xxxxx = mysql_fetch_array($getxxxxx);

echo ("<h2>".$type[name]."</h2>");

 

if ($xxxxx[type] == $type[id]){

while ($xxxxx2 = mysql_fetch_array($getxxxxx)){echo "$xxxxx2[name]<br />";};

echo "<br />";}

 

else{echo "None. . .";};

 

};

 

____________________

 

the part i am having trouble with is the part in bold.

 

I have tried using a 'for' there also.

 

Im trying to get items form my database to list under certain categories they have in type.  ???

 

Thanks in advance.  :)

Link to comment
https://forums.phpfreaks.com/topic/55040-while-help/
Share on other sites

I want to basically list

 

TYPE['name']

-ITEM['name']

 

 

TYPE['name']

-ITEM['name']

 

 

I have a table for the type and a table for the Items.

Want the items to while loop show it shows them

and I also want the categories (types) to while loop.

 

Like how a message board works with the categories and subcategories

 

Is there a sample anywhere that I can see this?

Link to comment
https://forums.phpfreaks.com/topic/55040-while-help/#findComment-272158
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.