Nested List with PHP and MySQL -
I have to use PHP and MySQL to create a nested or multi-level list.
For example:
John
555 555-5555
For example:
P>
666 666-6666
Christine
777 777-7777
Amy
888 888-8888 < P> 999 999 99 99
222 222-2222
& lt ;? Php $ result = mysqli_query ($ dbc, "Select fname, Customer to Phone, Phone, Customer_phone WHERE Customer. Id = customer_phone.customer_id and phone.id = customer_phone.phone_id"); While ($ line = mysqli_fetch_array ($ result)) {echo $ line ['fname']; Echo "
"; Echo ['phone'] per line; Echo "
"; }? & Gt; View orders by
and only for the first time when this name comes, its Print the name. Also, learn how to properly connect using "on" section. On the customer's phone, the user connected to the consumer related to the consumer_phone
& lt ;? Php $ result = mysqli_query ($ dbc, "SELECT fname"; Join the phone from the customer .customer_id customer_phone by phone.id = order fname by phone.id);); $ Old name = null; While ($ row = mysqli_fetch_array ($ result)) {if ($ oldname! = $ Row ['fname']) {echo $ row ['fname'] "& Lt; br & gt;"; $ Old name = $ line ['fname']; } Echo ['phone'] per line "& Lt; br & gt;"; }? & Gt;
Comments
Post a Comment