Re: Display Formatted Query Results

From: Date: Sun, 15 Apr 2001 01:16:32 +0000
Subject: Re: Display Formatted Query Results
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-48610@lists.php.net to get a copy of this message
Hi Jeff, @ 8:52:10 PM on 4/14/2001, Jeff Holzfaster wrote: ... > My apologies if this is too wordy. A little confusing, but here we go. If this makes no sense what so ever, maybe someone else can provide a better way of doing what you're describing here. ... > I have a form page that looks like this: > http://www.webtinker.com/fran_info.htm This form has several > things > going on. 1st, the first pull down list needs to reflect the same > info as the two location descriptions. That's easy. If you're getting the two locations' data from a mysql table, just reuse the same information for the pull down. Is 'location' in your table the 'label' for that meeting? Ie., is 'location' in your SQL below going to be something like "Chicogo Round Table Discussion"? If not, add another column for that label and use that for the listings above the form, and use that again for the select. > 2nd, the two locations "Round Table Discussion" will grow to an > unknown number of entries over time so the two may become 6 or 8 > or... My first big (for me) hurdle is to figure out how to get these > to show up at the top of this form in order of the date with the > closest one first. They need to be in the same format as they appear > but with additional rows showing as more entries are made. The ones > showing can't be past due, or, don't show past dates. For the date column in your SQL below, use either the value of time() from PHP, or use one of the built in mysql date functions like DATETIME. Then you'll just need to compare the current date to the ones listed in the table and only show the meetings dated for the current day or greater. If the expired meetings won't change, you could leave them in the table and only modify the date down the road. If they're a one time thing, you can drop the expired listings as you're doing your date check for the current/future meetings to extract from the table. Since you're reusing the 'location,' your drop down matching the top listings should already be taken care of. > What I have figured out so far is how to populate the pull down, how > to make the admin form to fill in the needed info into the MySQL > table and I have had limited success in displaying the meeting info > at the top of the form. You'll just need to read the data using mysql_fetch_array() or mysql_fetch_object(). There are examples of those in the manual at http://www.php.net. (enough to do what you're wanting to do.) As you read the data, you can print rows with two cells. If you have 5 meeting entries, you'll end up with a 2 x 3 table with the 2nd cell in the last row being empty. Since you'll be reusing the 'location label' from the rows' printing, your select should be populated with the same information. > I just can't figure out how to make them wrap into groups of info No idea what you mean by 'groups of info' unless you mean rows from the table. > , say with 5 entries of different meetings. Do I need a separate > query for each row of info using the limit statement in the query or > is there a way to do this using <gulp> arrays? Grabbing the data into an array is going to be a lot quicker than making several separate queries, probably. If you're having trouble with arrays, there are lots of folks here willing to help to clarify them when you get into trouble. ... > Here is the table I am using: > CREATE TABLE rnd_tbl ( > id tinyint(10) DEFAULT '0' NOT NULL auto_increment, > location varchar(100) NOT NULL, > address varchar(45) NOT NULL, > address2 varchar(45) NOT NULL, > city varchar(50) NOT NULL, > state char(2) NOT NULL, > zip varchar(14) NOT NULL, > day char(3) NOT NULL, > date varchar(25) NOT NULL, > time varchar(25) NOT NULL, time and date could be combined. You can use PHP's date conversion functions to convert the date and time into any format you'd like, or vise versa. > phone varchar(15) NOT NULL, > PRIMARY KEY (id) > ); -Brian -- PGP is spoken here: 0xE4D0C7C8 Please, DO NOT carbon copy me on list replies.

« previous php.general (#48610) next »