Query is giving 12 duplicates when ran
Moderator: General Moderators
Query is giving 12 duplicates when ran
This query is giving me 12 of each name yet the company is different on each of the duplicates. Can someone tell me where I am screwing up with it.
Each table is made up like this
products = idproducts,name,category,distributor,qty,minqty.
Distributors = iddistributors,company,contact,phone.
select name,qty,minqty,company from `products`, `distributors` where category = '1'
Each table is made up like this
products = idproducts,name,category,distributor,qty,minqty.
Distributors = iddistributors,company,contact,phone.
select name,qty,minqty,company from `products`, `distributors` where category = '1'
Yes just use Javascript
Code: Select all
function whenTheForIsSubmitted(){
if(document.formName.fieldName.value == 'someValue')
document.formName.action = 'somepage.php';
else
document.formName.action = 'someotherpage.php';
}I don't have it complete yet but here it is.
Code: Select all
<form action="lookup.php" method="post">
<select name = "query">
<option>Products by Cat.</option>
<option>View Distributors</option>
<option>View Categories</option>
<option>Get Order</option>
<option>View Schnapps</option>
<option>View </option>
<option>Get Order</option>
<option>Get Order</option>
<input type="submit" value="Submit">
</select>
</form>- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
You could also use the PHP page that you are posting to choose which page to show based on the user input:
Code: Select all
<?php
if (isset($_POST['user_choice']))
{
if ($_POST['user_choice'] == 'this')
{
// Show THIS page
}
elseif ($_POST['user_choice'] == 'that')
{
// Show THAT page
}
else
{
// Show the other page
}
}
?>- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
Does the process need to actually open and entirely new page or can it select a different included portion of the page to load. If it just a matter of showing HTML1, HTML 2, etc you can build the HTML modules and depending on the user selection include what they want.
If it's a matter of processing you can still do that, just handle the processing within the scope of the if...elseif...else brackets.
If it's a matter of processing you can still do that, just handle the processing within the scope of the if...elseif...else brackets.