Re: [PHP-DB] Multiple select box using mysql

2003-02-26 Thread Jason End
Yeah, I think I am going to reconsider the software
box. The idea I have now is to have an "Add Expert"
link attached to each software entry, which will then
load a page to add experts to that piece of software.
The page could contain two select boxes, one with a
list of all experts, and one with a list of current
experts for that software. The admin could then add
experts from one list to the other.

Jay

--- Mark <[EMAIL PROTECTED]> wrote:
> I'm not sure if anyone answered this for you, and
> perhaps I'm missing
> something. Are you simply trying to populate a
> multi-select box with
> MySQL data?
> 
> If so, try this:
> echo form tag here...
> echo "";
> $query="select ID, Name, Version from software";
> $result=mysql_query($query) or die("Could not query
> database");
> while ($row=mysql_fetch_array($result)) {
>   echo "
VALUE=\"{$row["ID"]}\">{$row["Name"]}-{$row["Version"]}";
> //
> software select row format Name-Version
> }
> echo "";
> 
> echo "";
> $query="select ID, Name from experts";
> $result=mysql_query($query) or die("Could not query
> database");
> while ($row=mysql_fetch_array($result)) {
>   echo " VALUE=\"{$row["ID"]}\">{$row["Name"]}";
> }
> echo "";
> echo "";
> 
> This will provide you with a form to link the
> experts and software.
> 
> To actually do the linking, you need to insert the
> data in to the DB.
> The action to perform when submitting the form might
> be something
> like this (just steps, not code)
> 
> Confirm arrays have data
> loop through $software array {
> loop through $experts array {
> build an insert SQL statement to insert the software
> table ID and the
> expert table ID into a lookup table.
> execute the insert statement
> }
> }
> 
> For example,
> 
> if (isset($software) && isset($expert)) {
>   for ($i=0;$i for ($j=0;$j   $query="insert into  set
> software=\"{$software[$i]}\",
> expert=\"{$export[$j]\";
>   $result=mysql_query($query) or die("Could not
> insert data");
> }
>   }
> } else {
> error handling routine here
> }
> 
> 
> You might want to reconsider making the "software"
> selection box
> multiselect. That will allow many to many
> relationships. If that's
> what you want, that's ok. But it allows for a lot of
> user error.
> Eliminating it would eliminate the outer loop, it
> would make
> $software a standard variable rather than an array,
> and you could
> remove the [] from the SELECT form element for the
> software.
> 
> Please check all code, as it's off the top of my
> head, and not
> verified at all.
> 
> --- Jason End <[EMAIL PROTECTED]> wrote:
> > But how do I populate the array with (for e.g.) 2
> > fields from a mysql table. Each line of the select
> box
> > needs to hold the Name and Version of the piece of
> > software, the results from a:
> > select Name, Version from software
> > 
> > -s-
> > 
> > --- Corne' Cornelius <[EMAIL PROTECTED]> wrote:
> > > You have to give the Mutli select box a name as
> an
> > > array. eg:
> > > 
> > > 
> > > val1
> > > 
> > > 
> > > then in PHP, you can access $experts as an
> array.
> > > 
> > > while (list ($key, $val) = each($experts))  {
> > >print "$key = $val\n";
> > > }
> > > 
> > > 
> > > Jason End wrote:
> > > 
> > > >I writing a software catalog that features
> > > "experts",
> > > >who a people especially skilled in a piece of
> > > >software. My db, has a "software" table and an
> > > >"experts" table. 
> > > >I need to have a page that generates 2 multiple
> > > select
> > > >boxes, each on with the data from each table. 
> > > >>From there one will be able to choose the
> software
> > > >program and the experts, which will then record
> the
> > > >software-expert relationship in the DB. 
> > > >
> > > >The problem is that I don't really understand
> how
> > > to
> > > >populate multi select boxes with db data, and
> then
> > > >have the selections passed back as inserts. 
> > > >
> > > >Can someone clue me in?
> > > >
> > > >thanks, 
> > > >
> > > >Jay
> > > >
> > >
> >__
> > > >Do you Yahoo!?
> > > >Yahoo! Mail Plus - Powerful. Affordable. Sign
> up
> > > now.
> > > >http://mailplus.yahoo.com
> > > >
> > > >  
> > > >
> > > 
> > > 
> > > 
> > > 
> > > =Disclaimer and
> > > Confidentiality===
> > > This message contains information intended for
> the
> > > perusal, and/or use (if so stated), by the
> stated
> > > addressee(s) only. The information is
> confidential
> > > and privileged. If you are not an intended
> > > recipient, do not peruse, use, disseminate,
> > > distribute, copy or in any manner rely upon  he
> > > information contained in this message (directly
> or
> > > indirectly). The sender and/or the entity
> > > represented by the sender shall not be held
> > > accountable in the event that this prohibition
> is
> > > disregarded. If you receive this message in
> error,
> > > notify the sender immediately by e-mail, fax or
> > > telephone representations contained in this
> mess

Re: [PHP-DB] Multiple select box using mysql

2003-02-24 Thread Mark
I'm not sure if anyone answered this for you, and perhaps I'm missing
something. Are you simply trying to populate a multi-select box with
MySQL data?

If so, try this:
echo form tag here...
echo "";
$query="select ID, Name, Version from software";
$result=mysql_query($query) or die("Could not query database");
while ($row=mysql_fetch_array($result)) {
  echo "{$row["Name"]}-{$row["Version"]}"; //
software select row format Name-Version
}
echo "";

echo "";
$query="select ID, Name from experts";
$result=mysql_query($query) or die("Could not query database");
while ($row=mysql_fetch_array($result)) {
  echo "{$row["Name"]}";
}
echo "";
echo "";

This will provide you with a form to link the experts and software.

To actually do the linking, you need to insert the data in to the DB.
The action to perform when submitting the form might be something
like this (just steps, not code)

Confirm arrays have data
loop through $software array {
loop through $experts array {
build an insert SQL statement to insert the software table ID and the
expert table ID into a lookup table.
execute the insert statement
}
}

For example,

if (isset($software) && isset($expert)) {
  for ($i=0;$i wrote:
> But how do I populate the array with (for e.g.) 2
> fields from a mysql table. Each line of the select box
> needs to hold the Name and Version of the piece of
> software, the results from a:
> select Name, Version from software
> 
> -s-
> 
> --- Corne' Cornelius <[EMAIL PROTECTED]> wrote:
> > You have to give the Mutli select box a name as an
> > array. eg:
> > 
> > 
> > val1
> > 
> > 
> > then in PHP, you can access $experts as an array.
> > 
> > while (list ($key, $val) = each($experts))  {
> >print "$key = $val\n";
> > }
> > 
> > 
> > Jason End wrote:
> > 
> > >I writing a software catalog that features
> > "experts",
> > >who a people especially skilled in a piece of
> > >software. My db, has a "software" table and an
> > >"experts" table. 
> > >I need to have a page that generates 2 multiple
> > select
> > >boxes, each on with the data from each table. 
> > >>From there one will be able to choose the software
> > >program and the experts, which will then record the
> > >software-expert relationship in the DB. 
> > >
> > >The problem is that I don't really understand how
> > to
> > >populate multi select boxes with db data, and then
> > >have the selections passed back as inserts. 
> > >
> > >Can someone clue me in?
> > >
> > >thanks, 
> > >
> > >Jay
> > >
> > >__
> > >Do you Yahoo!?
> > >Yahoo! Mail Plus - Powerful. Affordable. Sign up
> > now.
> > >http://mailplus.yahoo.com
> > >
> > >  
> > >
> > 
> > 
> > 
> > 
> > =Disclaimer and
> > Confidentiality===
> > This message contains information intended for the
> > perusal, and/or use (if so stated), by the stated
> > addressee(s) only. The information is confidential
> > and privileged. If you are not an intended
> > recipient, do not peruse, use, disseminate,
> > distribute, copy or in any manner rely upon  he
> > information contained in this message (directly or
> > indirectly). The sender and/or the entity
> > represented by the sender shall not be held
> > accountable in the event that this prohibition is
> > disregarded. If you receive this message in error,
> > notify the sender immediately by e-mail, fax or
> > telephone representations contained in this message,
> > whether express or implied, are those of the sender
> > only, unless that sender expressly states them to be
> > the views or representations of an entity or person,
> > who shall be named by the sender and who the sender
> > shall state to represent. No liability shall
> > otherwise attach to any other entity or person.
> >
> ==
> > 
> > 
> > -- 
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> 
> 
> __
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=
Mark Weinstock
[EMAIL PROTECTED]
***
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***

__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Multiple select box using mysql

2003-02-24 Thread Jason End
But how do I populate the array with (for e.g.) 2
fields from a mysql table. Each line of the select box
needs to hold the Name and Version of the piece of
software, the results from a:
select Name, Version from software

-s-

--- Corne' Cornelius <[EMAIL PROTECTED]> wrote:
> You have to give the Mutli select box a name as an
> array. eg:
> 
> 
> val1
> 
> 
> then in PHP, you can access $experts as an array.
> 
> while (list ($key, $val) = each($experts))  {
>print "$key = $val\n";
> }
> 
> 
> Jason End wrote:
> 
> >I writing a software catalog that features
> "experts",
> >who a people especially skilled in a piece of
> >software. My db, has a "software" table and an
> >"experts" table. 
> >I need to have a page that generates 2 multiple
> select
> >boxes, each on with the data from each table. 
> >>From there one will be able to choose the software
> >program and the experts, which will then record the
> >software-expert relationship in the DB. 
> >
> >The problem is that I don't really understand how
> to
> >populate multi select boxes with db data, and then
> >have the selections passed back as inserts. 
> >
> >Can someone clue me in?
> >
> >thanks, 
> >
> >Jay
> >
> >__
> >Do you Yahoo!?
> >Yahoo! Mail Plus - Powerful. Affordable. Sign up
> now.
> >http://mailplus.yahoo.com
> >
> >  
> >
> 
> 
> 
> 
> =Disclaimer and
> Confidentiality===
> This message contains information intended for the
> perusal, and/or use (if so stated), by the stated
> addressee(s) only. The information is confidential
> and privileged. If you are not an intended
> recipient, do not peruse, use, disseminate,
> distribute, copy or in any manner rely upon  he
> information contained in this message (directly or
> indirectly). The sender and/or the entity
> represented by the sender shall not be held
> accountable in the event that this prohibition is
> disregarded. If you receive this message in error,
> notify the sender immediately by e-mail, fax or
> telephone representations contained in this message,
> whether express or implied, are those of the sender
> only, unless that sender expressly states them to be
> the views or representations of an entity or person,
> who shall be named by the sender and who the sender
> shall state to represent. No liability shall
> otherwise attach to any other entity or person.
>
==
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Multiple select box using mysql

2003-02-18 Thread Corne' Cornelius
You have to give the Mutli select box a name as an array. eg:


val1


then in PHP, you can access $experts as an array.

while (list ($key, $val) = each($experts))  {
  print "$key = $val\n";
}


Jason End wrote:


I writing a software catalog that features "experts",
who a people especially skilled in a piece of
software. My db, has a "software" table and an
"experts" table. 
I need to have a page that generates 2 multiple select
boxes, each on with the data from each table. 
From there one will be able to choose the software

program and the experts, which will then record the
software-expert relationship in the DB. 

The problem is that I don't really understand how to
populate multi select boxes with db data, and then
have the selections passed back as inserts. 

Can someone clue me in?

thanks, 

Jay

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

 





=Disclaimer and Confidentiality===
This message contains information intended for the perusal, and/or use (if so stated), by the stated addressee(s) only. The information is confidential and privileged. If you are not an intended recipient, do not peruse, use, disseminate, distribute, copy or in any manner rely upon  he information contained in this message (directly or indirectly). The sender and/or the entity represented by the sender shall not be held accountable in the event that this prohibition is disregarded. If you receive this message in error, notify the sender immediately by e-mail, fax or telephone representations contained in this message, whether express or implied, are those of the sender only, unless that sender expressly states them to be the views or representations of an entity or person, who shall be named by the sender and who the sender shall state to represent. No liability shall otherwise attach to any other entity or person. ==


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] Multiple select box using mysql

2003-02-18 Thread Jason End
I writing a software catalog that features "experts",
who a people especially skilled in a piece of
software. My db, has a "software" table and an
"experts" table. 
I need to have a page that generates 2 multiple select
boxes, each on with the data from each table. 
>From there one will be able to choose the software
program and the experts, which will then record the
software-expert relationship in the DB. 

The problem is that I don't really understand how to
populate multi select boxes with db data, and then
have the selections passed back as inserts. 

Can someone clue me in?

thanks, 

Jay

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php