php mysql search parent_id until match
Buget $10-30 USD
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);
}
}
}
Acordat lui:
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
37 freelanceri licitează în medie 28$ pentru acest proiect
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
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
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.
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
Hello This is tree filter Will sort it out shortly. Message me for further info. Thanks David.
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
"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!"
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
Hi, I can help you with this very quickly and perfectly. Kindly contact me for immediate start. Regards. Vadym
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.
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
✅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
yes i got it i can do it php mysql search parent_id until match, message me for more discuss.........................
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
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
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
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
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
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.
⭐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.