RE: [PHP] Writing output to multiple tables

From: Date: Sat, 16 Dec 2000 02:05:01 +0000
Subject: RE: [PHP] Writing output to multiple tables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30638@lists.php.net to get a copy of this message
Is the other info in another table other than Members? If all the info is in one table here's a basic overview... ============================== <? $query = "SELECT * FROM Members"; $conn = mysql_connect('localhost', 'username', 'password'); mysql_select_db('yourdatabse', $conn); $result = mysql_query($query, $conn); ?> <table> <? while($member = mysql_fetch_array($result)){ echo '<tr><td><b>Name</b></td><td>'.$member['Name'].'</td><td><b>Other Info</b></td><td>'.$member['OtherInfo'].'</td></tr>'; echo '<tr><td><b>Address</b></td><td>'.$member['Address'].'</td><td><b>Work Email</b></td><td>'.$member['WorkEmail'].'</td></tr>'; echo '<tr><td><b>Email</b></td><td>'.$member['Email'].'</td></tr>'; echo '<tr><td><b>etc.</b></td><td>'.$member['etc'].'</td></tr>'; }//While mysql_free_result($result); mysql_close($conn); ?> </table> =============================== Hope this helps... -sharpie! -----Original Message----- From: Greg Wright [mailto:Greg@AusIT.com] Sent: Friday, December 15, 2000 5:56 PM To: Jonathan Sharp Subject: RE: [PHP] Writing output to multiple tables *********** REPLY SEPARATOR *********** On 15/12/00 at 17:47 Jonathan Sharp wrote: >So if you have the following records: >Bob|123 Somewhere|123-4567|bob@bobiscool.com >Bob1|1234 Somewhere|1-123-4567|bob1@bobiscool.com >Bob2|12345 Somewhere|1-234-123-4567|bob2@bobiscool.com > >do you want it to be displayed as: >Bob Bob2 Bob2 >123 Somewhere 1234 Somewhere 12345 Somewhere >123-4567 1-123-4567 etc... >? No like this Name bob Other info something else about bob Address 123 Somewhere Bobs Work e-mail <another <something> email bob@bobiscool.com etc etc then table 2 Name bob Other info something else about bob1 Address 1234 Somewhere Bob1s Work e-mail <another <something> email bob1@bobiscool.com etc etc so on and so on.... > >If you just want to have Name, Street, Phone, Email out of 10 fields or >whatever, you just list the field names you want in your query... > >such as "SELECT Name, Street, Phone, Email FROM Members" and do a simple >PHP-MySQL Loop, see >http://www.php.net/manual/function.mysql-fetch-row.php I have a loop that works fine to display all records in a table, this will be for another page.... > >-sharpie! > >-----Original Message----- >From: Greg Wright [mailto:redhat_list@mail.com] >Sent: Friday, December 15, 2000 5:31 PM >To: php-general@lists.php.net >Subject: Re: [PHP] Writing output to multiple tables > > > > >*********** REPLY SEPARATOR *********** > >On 14/12/00 at 10:15 Daniel Convissor wrote: > >>Greg: >> >>> pull data from MySQL on a 1 record per table basis, then >>> output a table displaying the results, then in a loop do the same for >the >>> next record in a new table and so on and so on... >> >>Let's make sure we're talking about the same thing. You want to pull one >row >>from a table and display it. Then, go the next table and display a record >>from it. Then go bcack to the first table and get it's next row, and on >and >>on. Now, are the records in the two tables related? And, do you want to >>display the related information, or are you looking to just to display the >>first record from each table even if they're not about the same thing? >> >>You'll need to better explain what you're trying to do to get a real >answer. >>I suggest providing examples of what the database table structures and >data >>are plus an example of what you're looking to get. >> > >Hi > >I will explain a bit more.... > >I have table members with fields name address phone email etc etc > >I want to pull one record at a time from each field and output it to a >table, so it will have the relevant info in a table by itself > >If possible, maybe I will even set another field with info on drawing the >table, not sure if thats a good idea (I may have to on another page >display all info in a large single table > >So, I have no examples of this, I have examples of pulling all data to one >table...., my pocket reference is not much help & I have not found other >books/CD's , websites seem best > >Thanks for the input > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net >For additional commands, e-mail: php-general-help@lists.php.net >To contact the list administrators, e-mail: php-list-admin@lists.php.net Regards Greg Wright -- IT Consultant Sydney Australia PH 0418 292020 Available for Global Contracts Int. +61 418 292020 web http://www.ausit.com e-mail Greg AT AusIT.com Trading As - AAA Computers, ITpro, Ozzie Soft, providers of IT services.

« previous php.general (#30638) next »