Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6382363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:30:46+00:00 2026-05-25T02:30:46+00:00

Im creating a new task and assign the parentid as 100 to that task,

  • 0

Im creating a new task and assign the parentid as 100 to that task, once created the newtask id is 101..

Now again i create a new task and assign 100 or 101 to that new id which is being created(102)

Now when i create new task whose id is 104 then it should give me an option to select 100,101 as the parent task id but not 102 since 102 is connected to 101 and 101 is connected to 100 parent id

How i can do this two level access?
My table structure is taskid ,parenttask id where task id is autoincrement ,primary key

So while getting the values from database how can i filter.
Below is my code.

<select name="mastertaskid" size="1" id="mastertaskid" STYLE="width: 350px" >
<option>Select One</option>

<?php 

$q = "SELECT * FROM Tasks order by Task_id asc";        
$r = mysql_query ($db, $q

if (mysql_num_rows($r) > 0) {
  while ($row = mysql_fetch_array ($r, MYSQLI_NUM)) {
    echo "<option value=\"$row[0]\"";
    // Check for stickyness:
    if (isset($return_val['ParentTask_Id']) 
       && ($return_val['ParentTask_Id'] == $row[0]) ) 
       echo ' selected="selected"'; 
    echo ">$row[1](<b>$row[0]</b>)</option>\n";
  }
}                                   
?>
</select>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:30:47+00:00Added an answer on May 25, 2026 at 2:30 am

    this should do the trick:

    SELECT * FROM `Tasks` 
    WHERE `ParentTask_id` = 0 OR `ParentTask_id` IN 
    (SELECT `Task_id` FROM `Tasks` WHERE `ParentTask_id` = 0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been given a new task from the client which is basically creating
I am creating a task and then assign a thread that waits for the
I'm new to SharePoint workflows. When creating a new task and assign the TaskId
I have such view that handles user registration. After creating new user i want
Is it possible to change or assign new parent to the Model instance that
Is there an algorithm that checks whether creating a new thread pays off performance
I have some simple code in which the main Thread is creating a new
I am creating a new build process for a DotNet project which is to
I'm assigned with new task for creating chart application in iphone like.,(BarChart,PieChart,etc..,).But,i have no
I'm just wondering whether the new Task class in dot.net 4 is creating a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.