|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
[help please] recursive functions in PHP with MySQL
Hi all
Maybe it's stupid question but I don't know how to do it I've got Mysql table (it's menu structure): id | parent_id | name and i want to build menu from that table, but i have to use recursive function. So the problem is: how to build this resursive function? I mean: do i have to use mysql_connect(host,user,pass) and so on in this function? Because if i use this each calling of this function makes new myslq_connection... How to write recursive function using only one connection... Thank you for help ![]() |
|
#2
|
|||
|
|||
|
mysql_connect does not need to be inside your recursive function.
$connection = mysql_connect(...); and use $connection within the recursive function. |
|
#3
|
|||
|
|||
|
It is worth baring in mind that you cannot use variables declared outside a function unless you declare them as global at the top of the function or pass them in as a parameter.
-KM- |
|
#4
|
||||
|
||||
|
If possible, present some of your code. Perhaps we can help ya sort it out.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > [help please] recursive functions in PHP with MySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|