NameSilo

SQL issue to display 1 product in 2 places

Spaceship Spaceship
Watch
Impact
28
Hi all,

Just running into a small issue with displaying a product, here's the scenario:

Page 1 lists ALL of the inventory

Page 2 is suppose to list ONLY the inventory we want to list via a checkbox from the back end BUT it also has to display on Page 1

So in a nutshell. All inventory on page 1, only selected inventory on page 2.

My programmer is scratching his head on this one, I think he's been at his computer too long LOL

btw, the pages are in aspx with a SQL server DB.

Thanks

~Z
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Can't you just build a query like:

Select * from inventory where inventory id = 1 or id = 2 or id = 3

Just substituting and adding on more OR clauses for the amount of check boxes previously selected.
 
1
•••
Can't you just build a query like:

Select * from inventory where inventory id = 1 or id = 2 or id = 3

Just substituting and adding on more OR clauses for the amount of check boxes previously selected.


That's exactly what I said to him, I think he's having a brain fart or something!!

I'll take all suggestions to this issue, apart from get another programmer LOL
 
0
•••
Basically on page 1 you have a list of items, in the checkbox use the input like follows:

Code:
<input type="checkbox" name="item[<ITEMID>]" value="1" />

then in aspx get the item element from the request and extract the arrays keys.

In the following page use the sql:

Code:
Select * from inventory where inventory id IN (<ITEM IDS SEPERATED BY COMMA>)

I'm not a aspx coder but you can use its join function I believe to get the comma seperated id's from the array.

Hope that helps

Jay
 
1
•••
on the page that lists all you have all your checkbox itens numbered.
on the second page ( this is php but its easy to convert to asp or alike ):

Code:
while ($sql_1=mysql_fetch_array($your_query_string)){
    $contador = $contador +1;
        if(isset($_POST['C'.$contador]) && $_POST['C'.$contador] == 'ON'){
//that checked what checkbox was active, and since you did list them all at above...
$item_name=$sql_1['property_name'];
// and such :P
}

with that all that are checked its passed onto the second page and you can treat that easy.
i did that a long time ago and you can improve it, but it works ( no security or such there but you get the point ).
also its 2 am i may sound a bit confusing sorry
 
1
•••
You guys all rock....Thanks to everyone who contributed this...Now working like a charm
 
0
•••
Appraise.net

We're social

Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back