code help -array
| From: | Adv. Systems Design | Date: | Thu, 21 Sep 2000 16:33:47 +0000 |
| Subject: | code help -array | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-3024@lists.php.net to get a copy of this message | ||
Hello:
I am trying to create a lesson plan dbase that allows
teachers to enter and edit their lessons...being of
limited php experience, I have taken the code of a
shopping cart tutorial and have been adapting it to my
uses (benefits include learning coding styles,
drawbacks...you have to understand what is being done
in order to modify it for your needs!!)
Thus my problem: I am at a point where I want to call
a stored (mysql) lesson in order to edit it...the form
works well except for some values that are called from
another table, because they are multivalued...
I think this calls the main lesson up and puts stuff
into the $frm array?
/* load up the information for the lesson */
$qid = db_query("
SELECT l_id, date, title, author, overview, time,
grdlevel, supplies, preparation, proced, assessment,
taskcard
FROM lesson
WHERE l_id = $id
");
$frm = db_fetch_array($qid);
I think this calls up the multivariate data and puts
it into an array of its own while putting it into $frm
array under "glenums"...but I am not sure
/* load up the bench-gles for the lesson */
$qid = db_query("
SELECT glenum
FROM lesson_gle
WHERE l_id = $id
ORDER BY glenum ASC
");
$countgle = mysql_num_rows($qid);
$frm["glenums"] = array();
while ($gle = mysql_fetch_object($qid)) {
$frm["glenums"][] = $gle->glenum;
}
And this is what I dont understand...what does
$frm["glenums"][] = $gle->glenum; do?
This is what I wrote into the display form to show the
multivariate text boxes:
<? for ($i = 1; $i <= $countgle; $i++): ?>
<INPUT TYPE=text NAME=glenum[] VALUE="<?
$frm["glenums"] ?>" SIZE=60>
<? endfor ?>
And I get the right amount of textboxes (reflected by
$countgle) but I am not able to get the values to show
up.
Any help is welcomed!!
Thanks
Luis
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/