Jump to content

Some dreamweaver help please!


Ugluth

Recommended Posts

Hello, i got a question. First of all i'm using wamp server 2.0 on windows xp sp2 platform and dreamweaver 8.0 edition. I have a database on the wamp server on mysql and i've made a connection through dreamweaver which works fine. Now the thing is i wanna make a display page that has a dropdown list where you can choose a movie category (the database is for a videoclub) and once you choose it from the dropdown list you get the responding table with the movies.

 

My problem is that i don't know how to set the query on the table that will be showing the movies to match the value of the dropdown list. More specifically i need to know what to set on the WHERE. It should look like Movies.category = dropdownlist.value or something similar, but i dont know what exactly and i haven't been able to find anything for it on the internet.

 

Please help if you can and thanks in advance!

 

P.S. Here's the query i'm using if it helps

 

SELECT movies.Movie_Name, movies.Release_Date, movies.Movie_Medium, movies.Rental_Time, categories.Category_Name

FROM movies, categories

WHERE movies.Movie_Category = '?'

 

the '?' is the thing i'm missing  :P

Link to comment
Share on other sites

If i'm not mistaken this is what you asked for

<form id="form1" name="form1" method="post" action="">
  <label>Categories
  <select name="CategMen" size="1" id="CategMen">
    <option value=""></option><?php
do {  
?>
    <option value="<?php echo $row_Categories['Category_ID']?>"><?php echo $row_Categories['Category_Name']?></option>
    <?php
} while ($row_Categories = mysql_fetch_assoc($Categories));
  $rows = mysql_num_rows($Categories);
  if($rows > 0) {
      mysql_data_seek($Categories, 0);
  $row_Categories = mysql_fetch_assoc($Categories);
  }
?>
  </select>
  </label>
</form>

Link to comment
Share on other sites

Movies is the main table, which has a movie id as primary key, and also has a category field which contains the category id. The category field is foreign key to the movies table, mapping to a table called categories, which has an id. I hope this made sense.

Link to comment
Share on other sites

$movie_cat = isset($_POST['CategMen']) ? $_POST['CategMen'] : "";

 

SELECT movies.Movie_Name, movies.Release_Date, movies.Movie_Medium, movies.Rental_Time, categories.Category_Name

FROM movies, categories

WHERE movies.Movie_Category = '$movie_cat'

 

Does this work?  And I'm not sure what you mean by "i tried putting a variable to the query window, which had as runtime value $_POST['CategMen'] but it still doesn't work as its supposed to"

 

What query window?  Is that a dreamweaver thing?

Link to comment
Share on other sites

Yes the variable thingy is a dream weaver feature. I think this should work, or at least it sounds correct to me, but i just realized that my menu doesn't have auto post back enabled. I'm not really sure how that is called, thats how it was called on asp, the option that makes it refresh the page whenever another value was selected. If you can help me with that too i would be grateful!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.