HELP~ arghhhh doh!~

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
revocause
Forum Commoner
Posts: 94
Joined: Tue May 29, 2007 9:37 am

HELP~ arghhhh doh!~

Post by revocause »

I have a select menu and in one of the options, i need it to have multiple values. Is that possible?
If not whats the best way to go about that?

so say for example you have
<select>
<option > Item A </option>
<option > Item B </option>
<option > Item C </option>
<option > Item D </option>

and say the user selects Item A.
and if Item A has attributes of = weight, price, quantity (in Item A package).

The database is created with the weight , price, quantity for Item A
But how do i query it all from one selected option?!

Thank ya
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

User the "multiple" attribute for <select>
(#10850)
revocause
Forum Commoner
Posts: 94
Joined: Tue May 29, 2007 9:37 am

hmm

Post by revocause »

i didnt mean to have more than one option selected.

I mean where one option itself , will make 3 queries to database to get 3 different attributes.


the MULTIPLE only lets me select more tha none option is all right?

so how can i make it if say <option> Item A </option> is selected,
then it will make a query to database to get THREE attributes from the table not just one.

in DreamWeaver and most webforums etc they talk about how to set the value to query a database , thats simple enough.
But how do i query the databse for THREE attributes.

you select Item A.
it then makes 3 seperate queries to the database pulling Item A's = weight, price, quantity.

how do i do that with a select menu like this?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Use OR in your WHERE clause?
(#10850)
revocause
Forum Commoner
Posts: 94
Joined: Tue May 29, 2007 9:37 am

like this

Post by revocause »

so in the regular query that looks like this

Code: Select all

<option value="<?php echo $row_Recordset1['baseprice']?>"<?php if (!(strcmp($row_Recordset1['baseprice'], $row_Recordset1['weight']))) {echo "SELECTED";} ?>><?php echo $row_Recordset1['quantity']?></option>
    <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  $rows = mysql_num_rows($Recordset1);
  if($rows > 0) {
      mysql_data_seek($Recordset1, 0);
	  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  }
?>
  </select>
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

I don't see a query there and I can barely understand what that code is doing because of the formatting. And why are you using mysql_data_seek()?
(#10850)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Descriptive subjects

Post by feyd »

Completely vague thread titles beget
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
edit: this is a duplicate. :? Strike one.
Locked