Jump to content

'while' help!


someguy9

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.