I like to create a directory for my web site based on MySQL Database.
The table looks like that
Code: Select all
RECORD_ID PARENT_ID RECORD_DATA
RID_0001 NULL /
RID_0002 RID_0001 HOTELS
RID_0003 RID_0001 TICKETS
RID_0004 RID_0001 REND A CAR
RID_0005 RID_0002 5 Star Hotels
RID_0006 RID_0002 4 Star Hotels
RID_0007 RID_0002 3 Star Hotels
RID_0008 RID_0002 2 Star Hotels
... ... ...
The above example work perfectly.
Now by using PHP i quering the MySQL Database until Parent_ID is null from inside the function
Code: Select all
function [color=#FFAA00]fintTheParentRecord[/color](CurrentRecordID)
{
$sqlQuery = "SELECT the parent record of the CurrentRecordID"
...... Some code is here
if(the ParentID of the current query result is not null)
{
[color=#FFAA00]fintTheParentRecord(The ParentID of the current query result);[/color]
}
else
{
return something
}
}
The question is :
If i have to go thru 20 or 30 levels up is that hard for the PHP and the Server that executes the MySQL and the PHP ? ? ?
Many many Thanks ! ! ! !