Jump to content

Emran

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Emran's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hi all i am new in PHP. think i have 2 table category(ID, name, type) feature(ID, categoryID, sentence) mysql_connect("localhost", "root", ""); mysql_select_db("cost"); $categories = mysql_query("SELECT * FROM category") or die(mysql_errno()." : ".mysql_error()); while($catRow = mysql_fetch_array($categories)) { echo("<B>$catRow[name]</B><BR />"); $features = mysql_query("SELECT * FROM feature WHERE categoryID = $catRow[iD]") or die(mysql_errno()." : ".mysql_error()); while ($featureRow = mysql_fetch_array($features)) { if ($catRow[type] == 0) { echo("<input type=\"radio\" id=\"_$featureRow[iD]\" /><lable for=\"_$featureRow[iD]\">$featureRow[sentence]</lable>"); } else { echo("<input type=\"checkbox\" id=\"_$featureRow[iD]\" /><lable for=\"_$featureRow[iD]\">$featureRow[sentence]</lable>"); } echo ("<BR />"); } } mysql_close(); i use code blow, but when i have 2 category, it will show first category content and second category content will not show. i debug code and i see when second while finished when again want to start mysql_fetch_array($features) will returen false, why? note : category.ID is PK and feature.categoryID is FK
×
×
  • 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.