RE: [PHP-DB] Listing parent ids
> I'm currently using MySQL but I'll switch databases if there's a > compelling reason and no drawbacks. > Thanks for the lead, I'm googling recursive queries. 'common table expression' is the thing to google for, but MSDN seem to have hijacked all the top spots. http://syntaxhelp.com/SQLServer/Recursive_CTE is a nice example of what you outlined ... -- Lester Caine - G8HFL - Thanks Lester. The data structure is a good example of what I outlined. I want to avoid the recursion, whether in php or sql, possibly by using the nested set model. Cheers Arno -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Listing parent ids
On 28 July 2011 12:30, Arno Kuhl wrote: > On 28 July 2011 10:39, Arno Kuhl wrote: >> Arno Kuhl wrote: >>> Not strictly a php issue but it's for a php app, hope that counts >>> (plus I haven't had much joy googling this) >>> >>> I have a table with an id and a parentid. >>> If it's a top-level record the parentid is 0, otherwise it points to >>> another record, and if that record isn't a top-level record its >>> parentid points to another record, etc (a linked list). >>> >>> Is there a single select that will return the complete list of parentids? >>> Or do I have to iterate selecting each parent record while parentid> >>> 0 and build the list entry by entry? >> >> Little difficult to answer what you don't say what you are using as a >> database. >> Recursive queries are now possible on many databases, except I think >> for MySQL. >> I run this type of query all the time on Firebird and Postgres now >> supports the same CTE functions. >> >> Lester Caine - G8HFL >> - >> >> I'm currently using MySQL but I'll switch databases if there's a >> compelling reason and no drawbacks. >> Thanks for the lead, I'm googling recursive queries. >> >> Arno >> -- > > I would take a long hard read of this article > http://web.archive.org/web/20100105135622/http://dev.mysql.com/tech-resource > s/articles/hierarchical-data.html > > I can't find it anywhere else now - it used to be on the mysql site - but > gone since Oracle has it and I can't find it in Google Cache. > > But, it explains the pros and cons of using the Adjacency List Model vs the > Nested Set Model. > > The article is quite old (the copyright on the page is 2008, but I've no > idea when it was actually created) and so, there are advances in SQL > features (CTE's being one of them) which aren't mentioned. > > But, I've found Nested Sets to be much easier for me to work with, allowing > me to provide quite complex searching based upon an n-level tree. > > How you visualise the data won't change. It is still, visually at least, a > set of parent/child relationships, but to build a tree, you don't need to > use recursion. In most cases, a single query will be enough to interact with > the tree at any level, in any direction, for more or less any purpose. > > Richard Quadling > -- > > Thanks Richard. Your reference is exactly what I was looking for. > I'm just busy reading a sitepoint article about adjacent lists vs the > niftily titled "modified preorder tree traversal model". > http://www.sitepoint.com/hierarchical-data-database/ (really old - 2003) > I found I'm using the adjacent list model at the moment (didn't know it had > a name, I always thought of it as a type of linked list). > The "modified preorder tree traversal model" in the sitepoint article > appears to be equivalent to the "nested set model" in the mysql article. > It seems simple enough to implement, I'll definitely give it a closer look > and do some tests. > > Thanks, it's great to hear the experiences of others who've used this. > > Cheers > Arno > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > In my day job, I process a LOT of data (MS SQL Server, 15 or so DBs, maybe 250GB of data, at least 15 years of trends,etc.). So I have a LOT of trees. Customer hierarchies (Customer Head Office, Regional Office, Branch), Location hierarchies (Continent, Country, Region, City, Street), Product hierarchies. BOM, etc. When it comes to analysis, I can ask questions like "Which European Customers have, overall, increased their turnover by at least 20% in the last 6 months for a single product type?" Because of the nested sets, I know that "European" means a left/right of 23 to 224. Any customer branch with a location id in that range is eligible for inclusion. No recursion of finding the European ID and then chugging through all the IDs down to the street level to match that ID to the customer. And then realising that not all the customers are tagged at street level, but maybe just at the city level. It allows faster grouping and drilldown in my mind as the data is always filtered for the required set in question. And if you are filtering over multiple sets (location, date, product category), you are going to get to the results a LOT faster than with the easier understood, but not as useful (IMHO) adjacent list. Richard. -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Listing parent ids
On 28 July 2011 10:39, Arno Kuhl wrote: > Arno Kuhl wrote: >> Not strictly a php issue but it's for a php app, hope that counts >> (plus I haven't had much joy googling this) >> >> I have a table with an id and a parentid. >> If it's a top-level record the parentid is 0, otherwise it points to >> another record, and if that record isn't a top-level record its >> parentid points to another record, etc (a linked list). >> >> Is there a single select that will return the complete list of parentids? >> Or do I have to iterate selecting each parent record while parentid> >> 0 and build the list entry by entry? > > Little difficult to answer what you don't say what you are using as a > database. > Recursive queries are now possible on many databases, except I think > for MySQL. > I run this type of query all the time on Firebird and Postgres now > supports the same CTE functions. > > Lester Caine - G8HFL > - > > I'm currently using MySQL but I'll switch databases if there's a > compelling reason and no drawbacks. > Thanks for the lead, I'm googling recursive queries. > > Arno > -- I would take a long hard read of this article http://web.archive.org/web/20100105135622/http://dev.mysql.com/tech-resource s/articles/hierarchical-data.html I can't find it anywhere else now - it used to be on the mysql site - but gone since Oracle has it and I can't find it in Google Cache. But, it explains the pros and cons of using the Adjacency List Model vs the Nested Set Model. The article is quite old (the copyright on the page is 2008, but I've no idea when it was actually created) and so, there are advances in SQL features (CTE's being one of them) which aren't mentioned. But, I've found Nested Sets to be much easier for me to work with, allowing me to provide quite complex searching based upon an n-level tree. How you visualise the data won't change. It is still, visually at least, a set of parent/child relationships, but to build a tree, you don't need to use recursion. In most cases, a single query will be enough to interact with the tree at any level, in any direction, for more or less any purpose. Richard Quadling -- Thanks Richard. Your reference is exactly what I was looking for. I'm just busy reading a sitepoint article about adjacent lists vs the niftily titled "modified preorder tree traversal model". http://www.sitepoint.com/hierarchical-data-database/ (really old - 2003) I found I'm using the adjacent list model at the moment (didn't know it had a name, I always thought of it as a type of linked list). The "modified preorder tree traversal model" in the sitepoint article appears to be equivalent to the "nested set model" in the mysql article. It seems simple enough to implement, I'll definitely give it a closer look and do some tests. Thanks, it's great to hear the experiences of others who've used this. Cheers Arno -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Listing parent ids
Arno Kuhl wrote: I'm currently using MySQL but I'll switch databases if there's a compelling reason and no drawbacks. Thanks for the lead, I'm googling recursive queries. 'common table expression' is the thing to google for, but MSDN seem to have hijacked all the top spots. http://syntaxhelp.com/SQLServer/Recursive_CTE is a nice example of what you outlined ... -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Listing parent ids
And http://www.amazon.co.uk/exec/obidos/ASIN/1558609202/onlinepricecouk -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Listing parent ids
On 28 July 2011 10:39, Arno Kuhl wrote: > Arno Kuhl wrote: >> Not strictly a php issue but it's for a php app, hope that counts >> (plus I haven't had much joy googling this) >> >> I have a table with an id and a parentid. >> If it's a top-level record the parentid is 0, otherwise it points to >> another record, and if that record isn't a top-level record its >> parentid points to another record, etc (a linked list). >> >> Is there a single select that will return the complete list of parentids? >> Or do I have to iterate selecting each parent record while parentid> >> 0 and build the list entry by entry? > > Little difficult to answer what you don't say what you are using as a > database. > Recursive queries are now possible on many databases, except I think for > MySQL. > I run this type of query all the time on Firebird and Postgres now supports > the same CTE functions. > > -- > Lester Caine - G8HFL > - > > > I'm currently using MySQL but I'll switch databases if there's a compelling > reason and no drawbacks. > Thanks for the lead, I'm googling recursive queries. > > Cheers > Arno > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > I would take a long hard read of this article http://web.archive.org/web/20100105135622/http://dev.mysql.com/tech-resources/articles/hierarchical-data.html I can't find it anywhere else now - it used to be on the mysql site - but gone since Oracle has it and I can't find it in Google Cache. But, it explains the pros and cons of using the Adjacency List Model vs the Nested Set Model. The article is quite old (the copyright on the page is 2008, but I've no idea when it was actually created) and so, there are advances in SQL features (CTE's being one of them) which aren't mentioned. But, I've found Nested Sets to be much easier for me to work with, allowing me to provide quite complex searching based upon an n-level tree. How you visualise the data won't change. It is still, visually at least, a set of parent/child relationships, but to build a tree, you don't need to use recursion. In most cases, a single query will be enough to interact with the tree at any level, in any direction, for more or less any purpose. I recently bought "Joe Celkos SQL for Smarties: Advanced SQL Programming" on eBay. It covers a LOT more about Nested Sets. (http://desc.shop.ebay.co.uk/i.html?_nkw=Celkos+SQL+Smarties&_sacat=0&_dmpt=Non_Fiction&_odkw=Celkos+SQL+Smarties&_osacat=0&_trksid=p3286.c0.m270.l1313&LH_TitleDesc=1 currently showing 2 entries) and a fourth edition on Amazon (http://www.amazon.com/Joe-Celkos-SQL-Smarties-Fourth/dp/0123820227/ref=sr_1_1?ie=UTF8&qid=1311847652&sr=8-1) -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Listing parent ids
Arno Kuhl wrote: > Not strictly a php issue but it's for a php app, hope that counts > (plus I haven't had much joy googling this) > > I have a table with an id and a parentid. > If it's a top-level record the parentid is 0, otherwise it points to > another record, and if that record isn't a top-level record its > parentid points to another record, etc (a linked list). > > Is there a single select that will return the complete list of parentids? > Or do I have to iterate selecting each parent record while parentid> > 0 and build the list entry by entry? Little difficult to answer what you don't say what you are using as a database. Recursive queries are now possible on many databases, except I think for MySQL. I run this type of query all the time on Firebird and Postgres now supports the same CTE functions. -- Lester Caine - G8HFL - I'm currently using MySQL but I'll switch databases if there's a compelling reason and no drawbacks. Thanks for the lead, I'm googling recursive queries. Cheers Arno -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Listing parent ids
Not strictly a php issue but it's for a php app, hope that counts (plus I haven't had much joy googling this) I have a table with an id and a parentid. If it's a top-level record the parentid is 0, otherwise it points to another record, and if that record isn't a top-level record its parentid points to another record, etc (a linked list). Is there a single select that will return the complete list of parentids? Or do I have to iterate selecting each parent record while parentid > 0 and build the list entry by entry? TIA Cheers, Arno -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] listing question
Chris Payne wrote: Hi there, I tried something similar: $query = "SELECT * FROM videos WHERE videomakers_website_url = '$x' AND privatepublic = 'public' AND producer_website LIKE '%$x%' OR videomakers_website_url LIKE '%$x%' ORDER BY videomakers_site_position ASC, video_title ASC LIMIT $offset, $item_perpage"; $querytotal = "SELECT count(*) FROM videos WHERE videomakers_website_url = '$x' AND privatepublic = 'public' AND producer_website LIKE '%$x%' OR videomakers_website_url LIKE '%$x%' ORDER BY videomakers_site_position ASC, video_title ASC"; My problem is, it displays not alphabetical videos first and then LAST it displays the videos with numbers, and when I can get the numbers at the top of the listing, they are in the wrong order (IE: 0,1,2 is from the bottom up and not 0 being at the top, 1 being next and so on). I don't understand what you want (maybe a sample 5 in the order you get and the order you want will help us - include the position field if you send it through). Do you want alphabetical first then numbers? change your order: order by video_title asc, videomakers_site_position asc; if you want numbers first: order by videomakers_site_position asc, video_title asc; Lastly, you don't need to order your results for a count query ($querytotal) :) -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] listing question
Hi there, I tried something similar: $query = "SELECT * FROM videos WHERE videomakers_website_url = '$x' AND privatepublic = 'public' AND producer_website LIKE '%$x%' OR videomakers_website_url LIKE '%$x%' ORDER BY videomakers_site_position ASC, video_title ASC LIMIT $offset, $item_perpage"; $querytotal = "SELECT count(*) FROM videos WHERE videomakers_website_url = '$x' AND privatepublic = 'public' AND producer_website LIKE '%$x%' OR videomakers_website_url LIKE '%$x%' ORDER BY videomakers_site_position ASC, video_title ASC"; My problem is, it displays not alphabetical videos first and then LAST it displays the videos with numbers, and when I can get the numbers at the top of the listing, they are in the wrong order (IE: 0,1,2 is from the bottom up and not 0 being at the top, 1 being next and so on). Chris Is there something stopping you from specifying two columns to order results by, ie: select myNumeric , myText from myTable order by myNumeric asc, myText asc -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.4.1/308 - Release Date: 4/11/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] listing question
Hi there everyone, I have a little problem, I could do this with 2 seperate queries but if I can do it with 1 then even better ;-) I have to list items in numeric order IF the field isn't empty (ie: 0 comes at the top, followed by 1 etc ) and that isn't an issue as PHP with MySQL makes that very easy - BUT here's the problem i'm having. Once it's gone through the list, any items that do NOT have a number value are tacked on to the end in no particular order, is it possible that those items that do NOT have any value in the numeric field can be listed in alphabetical order instead? So if they have 0 upwards they displays from the top, then the ones that do not have ANYTHING in that field would display after but alphabetically instead? I'm kind of lost on how to do this with a single query. Thanks everyone Chris
[PHP-DB] Listing Tables
Hi, i would like to list all of the tables and field names in my database e.g. table 1 field 1 field 2 field 3 table 2 field 1 field 2 field 3 table 3 field 1 field 2 field 3 etc is there a simple way to do this? thanks for your help -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Listing A Certain # Range
> LIMIT 5,10 > LIMIT 10,15 > > Something like that should work. Not quite. LIMIT n,m where n is the starting point and m is how many rows you want returned. LIMIT 5 or LIMIT 0,5 LIMIT 5,5 LIMIT 10,5 etc... ---John Holmes... > Im using MySQL and PHP 4.2.3 on Apache and Mandrake Linux, I was > wondering how to get PHP to list let says row 5 - 10 from a database, I > read the MySQL manual and all I could find is LIMIT 0,5 to list just the > > first 5, but I dont know how to make that list 5 - 10 or 10 - 15. Any > help would be appreciated. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Listing A Certain # Range
LIMIT 5,10 LIMIT 10,15 Something like that should work. Aaron -Original Message- From: conbud [mailto:[EMAIL PROTECTED]] Sent: December 16, 2002 3:10 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Listing A Certain # Range Hello, Im using MySQL and PHP 4.2.3 on Apache and Mandrake Linux, I was wondering how to get PHP to list let says row 5 - 10 from a database, I read the MySQL manual and all I could find is LIMIT 0,5 to list just the first 5, but I dont know how to make that list 5 - 10 or 10 - 15. Any help would be appreciated. -- Conbud Graphic & Web Design Using Open Source Technology -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Listing A Certain # Range
Hello, Im using MySQL and PHP 4.2.3 on Apache and Mandrake Linux, I was wondering how to get PHP to list let says row 5 - 10 from a database, I read the MySQL manual and all I could find is LIMIT 0,5 to list just the first 5, but I dont know how to make that list 5 - 10 or 10 - 15. Any help would be appreciated. -- Conbud Graphic & Web Design Using Open Source Technology -- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Listing select * from table; on PHP
"; } ?> Don't forget all other HTML tags you need to pack around this -Original Message- From: louie miranda [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 6:53 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Listing select * from table; on PHP -- Hi, i have tried this php script to view my table db, but when i browse it over the net i couldn't see anything just plain blank page. Hm, Can u help me make this show tables over on php and post it over. thanks, louie... -- 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] Listing select * from table; on PHP
-- Hi, i have tried this php script to view my table db, but when i browse it over the net i couldn't see anything just plain blank page. Hm, Can u help me make this show tables over on php and post it over. thanks, louie... -- 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] listing
Then you start reading =) http://www.mysql.com/doc/ Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: "Andrius Jakutis" <[EMAIL PROTECTED]> To: "Rick Emery" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, August 23, 2001 11:50 PM Subject: Re: [PHP-DB] listing > Okay, but what if I want to use data from two tables not only from > "companies" ? > > > > > > > Assuming you've opened a MySQL connection and stored connection in > $connect: > > > > $query="SELECT * FROM mytable"; > > $result = mysql_query($query,$connect) or die("ERROR"); > > > > print ""; > > while( $row = mysql_fetch($result) > > { > > print > > > "".$row['field1']."".$row['field2']."".$row['field3']." > > "; > > } > > print ""; > > mysql_free_result($result); > > > > The above will create a table and output one table row per row in > database. > > Change field1, fiedl2, field3 to the names of fields in the database. > > > > Richard Emery > > Excel Communications, Inc. > > IT Sr. Project Manager > > (972) 478-3398 > > (972) 944-0542 (pager) > > > > There is no "trying"... > > There is only "Do" or "Not Do" > > > > > > > > -Original Message- > > From: Andrius Jakutis [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, August 23, 2001 11:22 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP-DB] listing > > > > > > This gives 25 the same entries. I need to list all entries from the table, > > but with loop. > > > > More solutions? > > > > > > "Chris Hobbs" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Something like: > > > > > > > > > > > > > > > > > > > > // php code to output your entry information > > > ?> > > > > > > > > > > > > > > > > > > > > > Andrius Jakutis wrote: > > > > > > > Hello again, > > > > > > > > Is there oportunity to write this: > > > > > > > > > > > > HTML php coding.+ MYSQL - 1 entries information > > > > > > > > > > > > Something like that: > > > > > > > > > > > > > > > > > > > > > > > > first entry information from table "companies" (name, telephone...) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > THanks. > > > > > > > > > > > > -- > > > > Su pagarba, > > > > > > > > Andrius Jakutis > > > > InternetMedia > > > > http://www.internetmedia.lt > > > > GSM: 370 82 31332 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Chris Hobbs Silver Valley Unified School District > > > Head geek: Technology Services Coordinator > > > webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ > > > postmaster: [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 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]
RE: [PHP-DB] listing
Then your select might look like: SELECT * FROM tableA, tableB or SELECT * FROM tableA LEFT JOIN tableB USING(field1) Depends upon what you're trying to do. So far, your requirements have been rather vague. -Original Message- From: Andrius Jakutis [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 11:51 PM To: Rick Emery; [EMAIL PROTECTED] Subject: Re: [PHP-DB] listing Okay, but what if I want to use data from two tables not only from "companies" ? > Assuming you've opened a MySQL connection and stored connection in $connect: > > $query="SELECT * FROM mytable"; > $result = mysql_query($query,$connect) or die("ERROR"); > > print ""; > while( $row = mysql_fetch($result) > { > print > "".$row['field1']."".$row['field2']."".$row['field3']." > "; > } > print ""; > mysql_free_result($result); > > The above will create a table and output one table row per row in database. > Change field1, fiedl2, field3 to the names of fields in the database. > > Richard Emery > Excel Communications, Inc. > IT Sr. Project Manager > (972) 478-3398 > (972) 944-0542 (pager) > > There is no "trying"... > There is only "Do" or "Not Do" > > > > -Original Message- > From: Andrius Jakutis [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 23, 2001 11:22 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] listing > > > This gives 25 the same entries. I need to list all entries from the table, > but with loop. > > More solutions? > > > "Chris Hobbs" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Something like: > > > > > > > > > > > > > // php code to output your entry information > > ?> > > > > > > > > > > > > > > Andrius Jakutis wrote: > > > > > Hello again, > > > > > > Is there oportunity to write this: > > > > > > > > > HTML php coding.+ MYSQL - 1 entries information > > > > > > > > > Something like that: > > > > > > > > > > > > > > > > > > first entry information from table "companies" (name, telephone...) > > > > > > > > > > > > > > > > > > > > > > > > THanks. > > > > > > > > > -- > > > Su pagarba, > > > > > > Andrius Jakutis > > > InternetMedia > > > http://www.internetmedia.lt > > > GSM: 370 82 31332 > > > > > > > > > > > > > > > > > > > > > -- > > Chris Hobbs Silver Valley Unified School District > > Head geek: Technology Services Coordinator > > webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ > > postmaster: [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 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] listing
Okay, but what if I want to use data from two tables not only from "companies" ? > Assuming you've opened a MySQL connection and stored connection in $connect: > > $query="SELECT * FROM mytable"; > $result = mysql_query($query,$connect) or die("ERROR"); > > print ""; > while( $row = mysql_fetch($result) > { > print > "".$row['field1']."".$row['field2']."".$row['field3']." > "; > } > print ""; > mysql_free_result($result); > > The above will create a table and output one table row per row in database. > Change field1, fiedl2, field3 to the names of fields in the database. > > Richard Emery > Excel Communications, Inc. > IT Sr. Project Manager > (972) 478-3398 > (972) 944-0542 (pager) > > There is no "trying"... > There is only "Do" or "Not Do" > > > > -Original Message- > From: Andrius Jakutis [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 23, 2001 11:22 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP-DB] listing > > > This gives 25 the same entries. I need to list all entries from the table, > but with loop. > > More solutions? > > > "Chris Hobbs" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Something like: > > > > > > > > > > > > > // php code to output your entry information > > ?> > > > > > > > > > > > > > > Andrius Jakutis wrote: > > > > > Hello again, > > > > > > Is there oportunity to write this: > > > > > > > > > HTML php coding.+ MYSQL - 1 entries information > > > > > > > > > Something like that: > > > > > > > > > > > > > > > > > > first entry information from table "companies" (name, telephone...) > > > > > > > > > > > > > > > > > > > > > > > > THanks. > > > > > > > > > -- > > > Su pagarba, > > > > > > Andrius Jakutis > > > InternetMedia > > > http://www.internetmedia.lt > > > GSM: 370 82 31332 > > > > > > > > > > > > > > > > > > > > > -- > > Chris Hobbs Silver Valley Unified School District > > Head geek: Technology Services Coordinator > > webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ > > postmaster: [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 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] listing
Assuming you've opened a MySQL connection and stored connection in $connect: $query="SELECT * FROM mytable"; $result = mysql_query($query,$connect) or die("ERROR"); print ""; while( $row = mysql_fetch($result) { print "".$row['field1']."".$row['field2']."".$row['field3']." "; } print ""; mysql_free_result($result); The above will create a table and output one table row per row in database. Change field1, fiedl2, field3 to the names of fields in the database. Richard Emery Excel Communications, Inc. IT Sr. Project Manager (972) 478-3398 (972) 944-0542 (pager) There is no "trying"... There is only "Do" or "Not Do" -Original Message----- From: Andrius Jakutis [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 23, 2001 11:22 PM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] listing This gives 25 the same entries. I need to list all entries from the table, but with loop. More solutions? "Chris Hobbs" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Something like: > > > > > > // php code to output your entry information > ?> > > > > > > > Andrius Jakutis wrote: > > > Hello again, > > > > Is there oportunity to write this: > > > > > > HTML php coding.+ MYSQL - 1 entries information > > > > > > Something like that: > > > > > > > > > > > > first entry information from table "companies" (name, telephone...) > > > > > > > > > > > > > > > > THanks. > > > > > > -- > > Su pagarba, > > > > Andrius Jakutis > > InternetMedia > > http://www.internetmedia.lt > > GSM: 370 82 31332 > > > > > > > > > > > > > -- > Chris Hobbs Silver Valley Unified School District > Head geek: Technology Services Coordinator > webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ > postmaster: [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 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] listing
I think what you want is Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: "Andrius Jakutis" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 23, 2001 11:22 PM Subject: Re: [PHP-DB] listing > This gives 25 the same entries. I need to list all entries from the table, > but with loop. > > More solutions? > > > "Chris Hobbs" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Something like: > > > > > > > > > > > > > // php code to output your entry information > > ?> > > > > > > > > > > > > > > Andrius Jakutis wrote: > > > > > Hello again, > > > > > > Is there oportunity to write this: > > > > > > > > > HTML php coding.+ MYSQL - 1 entries information > > > > > > > > > Something like that: > > > > > > > > > > > > > > > > > > first entry information from table "companies" (name, telephone...) > > > > > > > > > > > > > > > > > > > > > > > > THanks. > > > > > > > > > -- > > > Su pagarba, > > > > > > Andrius Jakutis > > > InternetMedia > > > http://www.internetmedia.lt > > > GSM: 370 82 31332 > > > > > > > > > > > > > > > > > > > > > -- > > Chris Hobbs Silver Valley Unified School District > > Head geek: Technology Services Coordinator > > webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ > > postmaster: [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 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] listing
This gives 25 the same entries. I need to list all entries from the table, but with loop. More solutions? "Chris Hobbs" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Something like: > > > > > > // php code to output your entry information > ?> > > > > > > > Andrius Jakutis wrote: > > > Hello again, > > > > Is there oportunity to write this: > > > > > > HTML php coding.+ MYSQL - 1 entries information > > > > > > Something like that: > > > > > > > > > > > > first entry information from table "companies" (name, telephone...) > > > > > > > > > > > > > > > > THanks. > > > > > > -- > > Su pagarba, > > > > Andrius Jakutis > > InternetMedia > > http://www.internetmedia.lt > > GSM: 370 82 31332 > > > > > > > > > > > > > -- > Chris Hobbs Silver Valley Unified School District > Head geek: Technology Services Coordinator > webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ > postmaster: [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]
Re: [PHP-DB] listing
I have found Richard Heyes's template class to be very useful for this sort of thing--he includes functions to parse code surrounded by tags for an entire MySQL result set. Very handy if you prefer to separate code and layout. (If anyone is interested, I wrote a function that extends his class to allow the templating of summary rows as well as individual data rows--both subtotals and totals for a given field or fields--all specified in your HTML template separate from the PHP code.) Yours, Andy At 11:41 AM -0700 on 8/23/01, you wrote: > >>Hello again, >> >>Is there oportunity to write this: >> >> >>HTML php coding.+ MYSQL - 1 entries information >> >> >>Something like that: >> >> >> >> >> >>first entry information from table "companies" (name, telephone...) >> >> >> >> >> -- 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] listing
Something like: Andrius Jakutis wrote: > Hello again, > > Is there oportunity to write this: > > > HTML php coding.+ MYSQL - 1 entries information > > > Something like that: > > > > > > first entry information from table "companies" (name, telephone...) > > > > > > > > THanks. > > > -- > Su pagarba, > > Andrius Jakutis > InternetMedia > http://www.internetmedia.lt > GSM: 370 82 31332 > > > > > -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [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] listing
Hello again, Is there oportunity to write this: HTML php coding.+ MYSQL - 1 entries information Something like that: first entry information from table "companies" (name, telephone...) THanks. -- Su pagarba, Andrius Jakutis InternetMedia http://www.internetmedia.lt GSM: 370 82 31332 -- 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] Listing content as links.
Problem, upload selected htm files to server,delete selected files from server and create link table to these files, with desired link names. Idea is to do uploading and deleting files in admin site as well as define link names. And when user comes in he would see the link list. Any ideas / examples? -- 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]