Finalizat

php mysql search parent_id until match

Job Description:

i have php and mysql need help

my table customers as below

id | parent_id | position |

------|--------------------|------------------------|

1 | 0 | position 1 |

2 | 1 | position 2 |

3 | 2 | position 3 |

4 | 3 | position 3 |

5 | 3 | position 5 |

6 | 4 | position 2 |

7 | 2 | position 4 |

8 | 1 | position 6 |

9 | 4 | position 6 |

10 | 3 | position 3 |

11 | 10 | position 2 |

12 | 8 | position 4 |

13 | 6 | position 5 |

14 | 13 | position 4 |

15 | 13 | position 5 |

How to loop out id when id(15) parent_id upward until first match position = position 2 ?

example

=======

i need to search start from id(15), parent_id id(15) is id(13), this not match cause position id(13) = position 5, not match position 2, so will continue search, then we search id(13), parent_id id(13) is id(6), and position id(6) = position 2, so match and stop here return result

I tried the below code but can't return only can echo out can't return result, or need a class?

function display_children2($id, $position_check, $position_end) {

$result = tep_db_query("SELECT * FROM customers WHERE parent_id='".$id."'");

while ($row = tep_db_fetch_array($result)) {

if($row['position']==$position_check){

$found = $row['id']; // Found ID and stop loop here

return $found;

}else{

// if not match continue here

if($row['position']==$position_end){

$found = 'Not Found'; // Not found

return $found;

}else{

display_children2($row['id'], $position_check, $position_end);

}

}

}

Aptitudini: PHP, MySQL

Despre client:
( 4 recenzii ) Puchong, Malaysia

ID Proiect: #35489942

Acordat lui:

PHPMYSQL21

Hi I can help you to solve this issue. I can run the mysql query for getting result as you wish. Reply for further communication. Thanks

%selectedBids___i_sum_sub_4%%project_currencyDetails_sign_sub_5% USD în 1 zi
(11 Recenzii)
3.7

37 freelanceri licitează în medie 28$ pentru acest proiect

mascotindia123

Hello, Hope you're doing good ! I have read your job description regarding "php mysql search parent_id until match" and assure you that I am a perfect fit for the job. I am a senior Web Programmer, having 8+ years of Mai multe

%bids___i_sum_sub_35%%project_currencyDetails_sign_sub_36% USD în 7 zile
(312 recenzii)
7.7
abugosia

Hello, I'm Abu Gosia. I'm interesting in your project very well. I'm good in C#, .Net Core, MVC, ASP.NET, Angular.js, Yii2, PHP, Laravel, Codeigneter, Wordpress, Open Cart. I m quite well experienced in these jobs. Let Mai multe

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(265 recenzii)
7.0
purplemaestro

Hi. I Hope you are doing well. I have high level expertise in PHP and MYSQL. I can solve this issue right away. Will provide you top quality work for sure. I can start right now.

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(133 recenzii)
6.5
miracitech37

Hi There, I have a direct solution in this query to make it much simpler and achieve your result as per the specifications. Please ping me on chat and I will tell the solution directly and we can can complete the task Mai multe

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(44 recenzii)
6.2
d1master

Hello This is tree filter Will sort it out shortly. Message me for further info. Thanks David.

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(25 recenzii)
6.0
worldbestcon

Hello there, Thank you for uploading the project. I am Interested in your Project and i can assist you as per your Requirement and Needs. Skills: PHP, Laravel, WordPress, HTML, Bootstrap, JavaScript etc. i have a great Mai multe

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(78 recenzii)
5.7
akhilvl1302

"Hi, I am an expert in PHp Mysql. Can help you in your query based on your requirement Skills: NodeJs, Python, PHP Please message me for further discussions. Thanks!"

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(65 recenzii)
5.5
usamasohail91

hello, hope you are doing well. I have read the description very carefully and i am interested to fix project as I am an expert and skilled website developer. I am working for more than 9 years as a professional. I hav Mai multe

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(26 recenzii)
4.9
balirkprogrammva

Hi, I can help you with this very quickly and perfectly. Kindly contact me for immediate start. Regards. Vadym

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(12 recenzii)
4.8
castillajoselui3

Hello As a senior PHP, MySQL, experter, i will deliver the best result to you with in 2 hous. Looking forward to work with you. All the best.

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(26 recenzii)
5.1
Actisoft2017

Hello, Nice meet you! I have read your project requirements and then I am sure I can complete that project. I can help you. Thank you

%bids___i_sum_sub_35%%project_currencyDetails_sign_sub_36% USD în 7 zile
(14 recenzii)
4.2
davisclaimer

✅Hi!✅ I hope you are having a great day. I have read all the details and requirements of your website carefully. I am very interested in your project because I'm ✅PHP expert✅. I have done so many PHP project and I can Mai multe

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(5 recenzii)
4.3
ervijaykumar87

yes i got it i can do it php mysql search parent_id until match, message me for more discuss.........................

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(15 recenzii)
3.5
bohdanalpatov

Hello, How are you doing? Hope you are doing well. I've checked your job description carefully and very interested in your job because I have a lot of experience in such projects before. If you give me the chance to wo Mai multe

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(4 recenzii)
3.7
Praveenkmr583

Hi, I have done many times of these types of tasks so I can do them quickly. Because I have 8+ years of experience as a web developer, I will be delivered on time. So don't hesitate to get in touch with me. Mai multe

%bids___i_sum_sub_35%%project_currencyDetails_sign_sub_36% USD în 7 zile
(28 recenzii)
3.9
davidrstevens

Less Talk, Great Result! Less Talk, Great Result! Less Talk, Great Result! Less Talk, Great Result! Less Talk, Great Result! Less Talk, Great Result! Less Talk, Great Result! Less Talk, Great Result! Less Talk, Great R Mai multe

%bids___i_sum_sub_35%%project_currencyDetails_sign_sub_36% USD în 7 zile
(8 recenzii)
3.3
saeedmehsoud

Hello, Hope you are doing well. I am full-stack developer well versed with PHP, Codeigniter, Laravel, Ajax, Jquery, Json, HTML,CSS and MySQL etc. I have read your proposal description. I have done same technical & Lo Mai multe

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(11 recenzii)
3.6
BHTECHNOLOGY

Dear Sir/Ma’am, I am very much interested in your job posted. You have been looking for a Software Developer who is able to deliver you the best. I consider myself as the right choice for you because I have the righ Mai multe

%bids___i_sum_sub_35%%project_currencyDetails_sign_sub_36% USD în 7 zile
(5 recenzii)
2.8
devastatingram

Hello, Nice meet you! I have read your project requirements and then I am sure I can complete that project. I can help you. Thank you.

%bids___i_sum_sub_35%%project_currencyDetails_sign_sub_36% USD în 7 zile
(2 recenzii)
2.0
yefimovyevgen

⭐Hi, Look at my 2+ reviews done in a week.⭐ ⭐Nothing is impossible. No problem for the fast delivery & client satisfication.⭐ I can start right now. Thanks.

%bids___i_sum_sub_32%%project_currencyDetails_sign_sub_33% USD în 1 zi
(9 recenzii)
2.0