Re: [PHP-DB] select with parentID field into multidimensional array?
I am having most of my problems because I am trying to do this walking through the data a single time, with the assumption any records parentID has an ID less than the child and therefore would already be populated in the array... On Sun, 21 Jan 2001, Stephen wrote: Date: Sun, 21 Jan 2001 23:49:13 +1100 (EST) From: Stephen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] select with parentID field into multidimensional array? Hi I have a table which is set out like this ID name parentID I "select * from table" into $result. I then wish to walk through the result such that it creates a multidimensional array sorted with children under parents. Here is a basic eg. IDnameparentID 1 books 0 2 movies 0 3 songs 0 4 horror 1 5 love1 6 horror 2 7 love2 8 scifi 2 9 IT 4 etc I am trying to write a function that would then insert these into a multidimensional array as such... $array[1] = "books"; $arary[1][4] = "horror"; $array[1][4][9] = "IT"; etc, so I could pull them out into a select dropdown list nicely sorted. I am not sure how to write an array function with an unlimited number of levels. If someone could help out it would be greatly appreciated. Thanks Stephen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] email: meridian at tha net web: meridian.on.tha.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] select with parentID field into multidimensional array?
Im not putting the array data back intoi the db, it is just to structure the data coming out of the db before i create a tree like structure with it on the page The data going into the db will always be a simple ID name parentID. Its the neatest way to do it I can think of including using the array structure. I am imagining it is possible to implement a way to take a select * from table and format an array with all the data in a tree like structure within the array with one pass of the data, then on a single pass of the array write out the info in whatever tree like format i wish onto my page. If I work it out Ill be sure to post it :) On Sun, 21 Jan 2001 [EMAIL PROTECTED] wrote: Date: Sun, 21 Jan 2001 15:50:16 -0500 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] select with parentID field into multidimensional array? Hi, Maybe it would be better not to use a multidimentionnal array in a db. You should create to additionnal columns that stores the ParentID of the row. It's the easiest way to do it. Also you can create another table that would translate from numbers to text, or just put the text. Stephen wrote: I am having most of my problems because I am trying to do this walking through the data a single time, with the assumption any records parentID has an ID less than the child and therefore would already be populated in the array... On Sun, 21 Jan 2001, Stephen wrote: Date: Sun, 21 Jan 2001 23:49:13 +1100 (EST) From: Stephen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] select with parentID field into multidimensional array? Hi I have a table which is set out like this ID name parentID I "select * from table" into $result. I then wish to walk through the result such that it creates a multidimensional array sorted with children under parents. Here is a basic eg. IDnameparentID 1 books 0 2 movies 0 3 songs 0 4 horror 1 5 love1 6 horror 2 7 love2 8 scifi 2 9 IT 4 etc I am trying to write a function that would then insert these into a multidimensional array as such... $array[1] = "books"; $arary[1][4] = "horror"; $array[1][4][9] = "IT"; etc, so I could pull them out into a select dropdown list nicely sorted. I am not sure how to write an array function with an unlimited number of levels. If someone could help out it would be greatly appreciated. Thanks Stephen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] email: meridian at tha net web: meridian.on.tha.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] email: meridian at tha net web: meridian.on.tha.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Access MS SQL idnetical thru ODBC ??
I have written a small program which uses ODBC to connect to a Access Database. I am simply wanting to know if this would also work with MS SQL without any modifications what so ever, or does ODBC not really accomplish what it was designed for ? The SQL statments used are very simple; the INSERT / UPDATE / DELETE are the same syntax as mysql, so i assume would also work under mSsql, and the SELECTs, although looking complex, don't perform JOINs or anything (eg: SELECT TOP 10 RECORD_NR, StatusField, ExtendedStatusField, PICTURE, SURNAME, FIRSTNAME, FORM, DOB, DESTINATION, EXPIRY FROM (SELECT TOP 20 * FROM WELLGIRLS ORDER BY RECORD_NR ASC,RECORD_NR ASC) ORDER BY RECORD_NR DESC,RECORD_NR DESC ). As I dont have access to a MSSQL server, can you someone please validate whether all this would work fine with MSSQL, and what problems/benefits (other than speed/security) I might have to deal with. Siggy
Re: [PHP-DB] Access MS SQL idnetical thru ODBC ??
Siggy, It should work fine, as long as you use SQL92 syntax (or SQL89, depending on the ODBC driver). The only problem comes when you use SQL syntax that Access accepts that is not really valid in the SQL specification. I believe 'limit' is one example, but I'm sure someone will correct me if I am wrong. I'm also not sure about 'top'. I believe you have OpenLink's drivers installed? I'll open up access to an SQLServer database for you tomorrow if you want to test the relevant queries yourself. Let me know. Best regards, Andrew -- Andrew Hill Director Technology Evangelism OpenLink Software http://www.openlinksw.com XML E-Business Infrastructure Technology On 1/21/01 7:52 PM, "Sigurd Magnusson" [EMAIL PROTECTED] wrote: I have written a small program which uses ODBC to connect to a Access Database. I am simply wanting to know if this would also work with MS SQL without any modifications what so ever, or does ODBC not really accomplish what it was designed for ? The SQL statments used are very simple; the INSERT / UPDATE / DELETE are the same syntax as mysql, so i assume would also work under mSsql, and the SELECTs, although looking complex, don't perform JOINs or anything (eg: SELECT TOP 10 RECORD_NR, StatusField, ExtendedStatusField, PICTURE, SURNAME, FIRSTNAME, FORM, DOB, DESTINATION, EXPIRY FROM (SELECT TOP 20 * FROM WELLGIRLS ORDER BY RECORD_NR ASC,RECORD_NR ASC) ORDER BY RECORD_NR DESC,RECORD_NR DESC ). As I dont have access to a MSSQL server, can you someone please validate whether all this would work fine with MSSQL, and what problems/benefits (other than speed/security) I might have to deal with. Siggy -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Cookies on a Macintosh
No luck with that I'm afraid. The Mac IE still refuses to use the cookie. Cookies are on, it will use cookies on other sites, just not on the one I've created using PHP. I've tried making other cookies to test it, but still no go. There's no bugs in PHP3 with respect to making cookies are there? I just don't understand why it will work in netscape on the mac, but not any versions of IE... Any other ideas? Thanks very much, Best Regards, Bob Irwin Domain Server Admin Planet Netcom -Original Message- From: Andrew Rush [mailto:[EMAIL PROTECTED]] Sent: Saturday, 20 January 2001 2:07 AM To: Noodles Grizzly Subject: Re: [PHP-DB] Cookies on a Macintosh On Thursday, January 18, 2001, at 06:39 PM, Noodles Grizzly wrote: setcookie("randint", "$ran3", time()+9000); snip It sets the cookie, but refuses to use the variable contained within. I can't find any reference to it in the books I have, nor in the online manual. you aren't setting a domain in your setcookie(). setcookie("randint", "$ran3", time()+9000, "/", "www.mydomain.com"); have a great day, andy :: Andrew Rush :: Lead Systems Developer :: MaineToday.com :: ** "Crippled but free, blind all the time, i was learning to see" - J. Garcia / R. Hunter ** The views expressed herein are not necessarily those of my employer, but they let me have them anyway. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Message Boards
Hi all, Apologies if this is off-topic .. I am looking for a simple message/news board for a non-profit association(Surf Lifesaving Club in fact). I have tried Nope but cannot get it running and have had no response from posting to their install messageboard. i just want something that the club can use to post simple messages about up-coming events etc.. Can anybody point me in the right direction., i have looked around a fair bit, but most of them seem to be much to heavyweight for what I need. It is basically to replace a static news page and allow several authorised people to post news items TIA Steve Farmer -- --- "I disagree completely with what you are saying, but I will defend to the death your right to say it" - Voltaire Support free speech; visit http://www.efa.org.au/ Heads Together Systems Pty Ltd http://www.hts.com.au Email: [EMAIL PROTECTED] Tel: 612 9982 6767 Fax: 612 9981 3081 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] select with parentID field into multidimensional array?
Well don't forget to use the order by and group by and where commands in SQL they could be quite useful in making a tree Stephen wrote: Im not putting the array data back intoi the db, it is just to structure the data coming out of the db before i create a tree like structure with it on the page The data going into the db will always be a simple ID name parentID. Its the neatest way to do it I can think of including using the array structure. I am imagining it is possible to implement a way to take a select * from table and format an array with all the data in a tree like structure within the array with one pass of the data, then on a single pass of the array write out the info in whatever tree like format i wish onto my page. If I work it out Ill be sure to post it :) On Sun, 21 Jan 2001 [EMAIL PROTECTED] wrote: Date: Sun, 21 Jan 2001 15:50:16 -0500 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] select with parentID field into multidimensional array? Hi, Maybe it would be better not to use a multidimentionnal array in a db. You should create to additionnal columns that stores the ParentID of the row. It's the easiest way to do it. Also you can create another table that would translate from numbers to text, or just put the text. Stephen wrote: I am having most of my problems because I am trying to do this walking through the data a single time, with the assumption any records parentID has an ID less than the child and therefore would already be populated in the array... On Sun, 21 Jan 2001, Stephen wrote: Date: Sun, 21 Jan 2001 23:49:13 +1100 (EST) From: Stephen [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: [PHP-DB] select with parentID field into multidimensional array? Hi I have a table which is set out like this ID name parentID I "select * from table" into $result. I then wish to walk through the result such that it creates a multidimensional array sorted with children under parents. Here is a basic eg. IDnameparentID 1 books 0 2 movies 0 3 songs 0 4 horror 1 5 love1 6 horror 2 7 love2 8 scifi 2 9 IT 4 etc I am trying to write a function that would then insert these into a multidimensional array as such... $array[1] = "books"; $arary[1][4] = "horror"; $array[1][4][9] = "IT"; etc, so I could pull them out into a select dropdown list nicely sorted. I am not sure how to write an array function with an unlimited number of levels. If someone could help out it would be greatly appreciated. Thanks Stephen -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] email: meridian at tha net web: meridian.on.tha.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] email: meridian at tha net web: meridian.on.tha.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Error connect to SYBASE
Hi, While I try to connect to SYBASE server i recieve "Message from server is invalid" Where I can get description of retrieved error ? Thanks, wangjing