Re: [PHP] Recursion with database tables
Hi all, Thanks for your help. I now have a wealth of things to try - I was initially going for the bottom up approach by starting at the bottom of the tree and working up, but I quite like the idea of storing id's in an array or list, although this would mean two queries to the DB. I am still new to this list, but thanks for your help and I hope I can recipricate in some way in the future. Jono -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursion with database tables
David Otton wrote: On Wed, 19 Feb 2003 13:56:49 +, you wrote: One questions though - if I delete a topic, I need to delete all of its child messages and all of the child comments from each message. What is the best technique to do this? This has been driving me up the wall as it seems to involve some kind of looping and recursion. make sure /all/ your comments have the correct topicid set. Then simply "DELETE FROM comment WHERE topicid = x" Otherwise, yes, in MySQL you have to recurse down the tree deleting comments. How would I go about recursing down the tree? Has anyone done this before? Jono -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Recursion with database tables
Ernest E Vogelsinger wrote: At 14:43 19.02.2003, Jono Bacon said: [snip] At the moment I have three tables: Topic, Message, Comment. A topic has messages and each message can have comments. I have set this up with a table each and a field for the id of the parent (e.g. a comment will have the id of the message that it refers to). My mate said to me that I should really put all of this in one big table with a parent and child field. He said that my code should then figure out what is the child of what and how it is displayed. This are one-to-many relationships? If yes, then your mate is wrong, you can't easily implement one-to-many using a single table. Hi Ernest, Thanks for your swift response. The code that you posed is the technique I have used at the moment. This technique works fine, but like my mate said, this limits me to a single parent for a comment/message. I admit that is unlikely that I would need more than one parent, but what would happen if I changed the parent - would this model still work fine? I am considering sticking with this technique - it seems to make more sense and I thought it would be quicker for queries as I wouldnt have to query a single table with a million rows. One questions though - if I delete a topic, I need to delete all of its child messages and all of the child comments from each message. What is the best technique to do this? This has been driving me up the wall as it seems to involve some kind of looping and recursion. Jono -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is it possible to retrieve email from HOTMAIL
Abu Musaab wrote: I wonder if it is possible to retrieve emails from an email account say in hotmail, yahoo, or any other email provider. silly hah ..? Thanx in advance. _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail I would suggest you look into using sockets to do this. You can open a connection to any server with fsockopen() and then send data with fgets(). It should be possible because a web browser works on telnet port 80, so there is no reason why you should be able to do it in PHP. The thing you need to know is what kind of conversation the script needs to have with the server. Try accessing the site in telnet port 80 and see what happens. Jono -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Recursion with database tables
Hi all, I am still pretty new to PHP, but I was chatting to a friend the other day and he put some thoughts into my head about how tables are laid out and processed. At the moment I have three tables: Topic, Message, Comment. A topic has messages and each message can have comments. I have set this up with a table each and a field for the id of the parent (e.g. a comment will have the id of the message that it refers to). My mate said to me that I should really put all of this in one big table with a parent and child field. He said that my code should then figure out what is the child of what and how it is displayed. I have two questions about this: 1. First, is this idea of using one big table with parent/child fields better than my seperate table approach? 2. Secondly, how would I write the logic for the single table approach. Any help or advice or links to documentation would be great. Cheers, Jono -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] limit contral
James Shergold wrote: Hi, all I'm quite new to php and still finding my way round and came across a problem. I'm making a script that pulls property (house) from a mysql database in categories e.g. there cat1, cat2 ect and in each category I only want to show 10 properties a time then click next to show the next 10 properties in that catorgy. here is the main part of the script http://www.smoothdesign.com/green/ if anyone can help that would be great. James [EMAIL PROTECTED] Hi James, You can limit the number of results using SQL: SELECT foo FROM bar ORDER by blah LIMIT 10 As for showing a page at a time - I have not done this before in PHP, but it is referred to as paging. Have a search on google and I am sure you will find a solution. Jono -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending/recieiving email
Hello all, I am looking to work with email and PHP, and I was wondering what would be the best way to deal with sending and recieving mail - is there a library pre-written or can I write it with functions that are part of PHP itself. Cheers, Jono -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems sending mail
Hi all, Anyone having trouble mailing this list. I can send mail within Yahoo mail but not from Evolution it seems. I wondered if the list is being tempremental or whether it is a local problem for me. Jono __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML
Hi all, I am just learning about XML and I was just wondering how mcuh you guys use it. Also what kind of things do you use it for? Jono __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php