Thanks for the help, Brian. That'll give me something to go on. I
definitely will need some assistance with this array stuff. I was actually
able to do this (below) which got everything to a page - unformatted in any
way - but when I tried moving it around (the arrays??) such as $my_row .=
"$row[state]<br>"; to something like $my_row .=
"$row[city][state][zip]<br>"; it obviously failed. Is there something I
need to do with the output of the while statement beyond what I have done or
is there a simple way to get that info formatted to look like the current
page?
Thanks
<?
include ("../config/common.inc.php");
# connect database
$link = mysql_connect($host, $user, $pass)
or die("Connection failed: " . mysql_error());
# select table
mysql_select_db($db_name)
or die("Database selection failed [$db_name]: " . mysql_error());
# send query
$sql = "SELECT * FROM rnd_tbl ORDER BY date";
$result = mysql_query($sql)
or die("Query failed: " . mysql_error());
?>
<html>
<head>
<title></title>
</head>
<body>
<?
while ($row = mysql_fetch_array($result)) {
$my_row = "<div align=\"center\">\n";
$my_row .= "Round Table Discussion<br>";
$my_row .= "$row[day]<br>";
$my_row .= "$row[address] [address2]<br>";
$my_row .= "$row[address2]<br>";
$my_row .= "$row[location]<br>";
$my_row .= "$row[city]<br>";
$my_row .= "$row[state]<br>";
$my_row .= "$row[city]<br>";
$my_row .= "$row[zip]<br>";
$my_row .= "$row[date]<br>";
$my_row .= "$row[time]<br>";
$my_row .= "$row[phone]<br>";
$my_row .= "</div><br>";
echo "$my_row\n";
}
?>
</body>
</html>
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.
--
PHP General 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 General 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]