|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have a link where I would to view products from 2 categories <a href="../productlist.php?&id_product_categories=2&i d_product_categories=4">Prdt Cat 2 & Prdt Cat 4</a> but on the results page I only get output from id_product_categories=4 and if I switch the id_product_categories=2 the results are displayed reflecting that value only, but not both $colname_rs_products = "-1"; if (isset($_GET['id_product_categories'])) { $colname_rs_products = $_GET['id_product_categories']; } mysql_select_db($database_dbname, $dbname); $query_rs_products = sprintf("SELECT id_products, part_number, product_category_name, id_product_categories, product_title, product_description_short FROM tbl_products WHERE id_product_categories = %s ORDER BY part_number ASC", GetSQLValueString($colname_rs_products, "int")); $query_limit_rs_products = sprintf("%s LIMIT %d, %d", $query_rs_products, $startRow_rs_products, $maxRows_rs_products); $rs_products = mysql_query($query_limit_rs_products, $dbname) or die(mysql_error()); $row_rs_products = mysql_fetch_assoc($rs_products); By the way it may be obvious i'm a novice Thanks |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Oct 20, 11:22 am, J Adams <u...@yahoo.com> wrote:
> I have a link where I would to view products from 2 categories > > <a > href="../productlist.php?&id_product_categories=2&id_produc t_categories=4">Prdt > Cat 2 & Prdt Cat 4</a> > > but on the results page I only get output from id_product_categories=4 > and if I switch the id_product_categories=2 the results are displayed > reflecting that value only, but not both > > $colname_rs_products = "-1"; > if (isset($_GET['id_product_categories'])) { > $colname_rs_products = $_GET['id_product_categories']; > > } > > mysql_select_db($database_dbname, $dbname); > $query_rs_products = sprintf("SELECT id_products, part_number, > product_category_name, id_product_categories, product_title, > product_description_short FROM tbl_products WHERE > id_product_categories = %s ORDER BY part_number ASC", > GetSQLValueString($colname_rs_products, "int")); > > $query_limit_rs_products = sprintf("%s LIMIT %d, %d", > $query_rs_products, $startRow_rs_products, $maxRows_rs_products); > $rs_products = mysql_query($query_limit_rs_products, $dbname) or > die(mysql_error()); > $row_rs_products = mysql_fetch_assoc($rs_products); > > By the way it may be obvious i'm a novice > > Thanks You can't assign two different values to the same variable. If you could, which of the two values would you expect to get out of that variable? How would you know which one you got? You have two choices here. You can call them something different: productlist.php?&id_product_categories1=2&id_produ ct_categories2=4 or you can pass them as an array: productlist.php?&id_product_categories[]=2&id_product_categories[]=4 |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Sat, 20 Oct 2007 17:09:59 -0700, ZeldorBlat <zeldorblat@gmail.com>
wrote: >On Oct 20, 11:22 am, J Adams <u...@yahoo.com> wrote: >> I have a link where I would to view products from 2 categories >> >> <a >> href="../productlist.php?&id_product_categories=2&id_produc t_categories=4">Prdt >> Cat 2 & Prdt Cat 4</a> >> >> but on the results page I only get output from id_product_categories=4 >> and if I switch the id_product_categories=2 the results are displayed >> reflecting that value only, but not both >> >> $colname_rs_products = "-1"; >> if (isset($_GET['id_product_categories'])) { >> $colname_rs_products = $_GET['id_product_categories']; >> >> } >> >> mysql_select_db($database_dbname, $dbname); >> $query_rs_products = sprintf("SELECT id_products, part_number, >> product_category_name, id_product_categories, product_title, >> product_description_short FROM tbl_products WHERE >> id_product_categories = %s ORDER BY part_number ASC", >> GetSQLValueString($colname_rs_products, "int")); >> >> $query_limit_rs_products = sprintf("%s LIMIT %d, %d", >> $query_rs_products, $startRow_rs_products, $maxRows_rs_products); >> $rs_products = mysql_query($query_limit_rs_products, $dbname) or >> die(mysql_error()); >> $row_rs_products = mysql_fetch_assoc($rs_products); >> >> By the way it may be obvious i'm a novice >> >> Thanks > >You can't assign two different values to the same variable. If you >could, which of the two values would you expect to get out of that >variable? How would you know which one you got? > >You have two choices here. You can call them something different: > >productlist.php?&id_product_categories1=2&id_prod uct_categories2=4 > >or you can pass them as an array: > >productlist.php?&id_product_categories[]=2&id_product_categories[]=4 That makes sense. Sounds like the array solution would be the best route. I plugged that in and received this error message: Notice: Array to string conversion in C:\wamp\www\lavender_coyote\productlist.php on line 6 the following code is on line 6 $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; can't really see why that would cause the error. i do know i need to do something more and i searched, but could not find anything. any suggestions? i appreciate your input. thanks |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Sun, 21 Oct 2007 00:57:48 GMT, J Adams <ujsa@yahoo.com> wrote:
>On Sat, 20 Oct 2007 17:09:59 -0700, ZeldorBlat <zeldorblat@gmail.com> >wrote: > >>On Oct 20, 11:22 am, J Adams <u...@yahoo.com> wrote: >>> I have a link where I would to view products from 2 categories >>> >>> <a >>> href="../productlist.php?&id_product_categories=2&id_produc t_categories=4">Prdt >>> Cat 2 & Prdt Cat 4</a> >>> >>> but on the results page I only get output from id_product_categories=4 >>> and if I switch the id_product_categories=2 the results are displayed >>> reflecting that value only, but not both >>> >>> $colname_rs_products = "-1"; >>> if (isset($_GET['id_product_categories'])) { >>> $colname_rs_products = $_GET['id_product_categories']; >>> >>> } >>> >>> mysql_select_db($database_dbname, $dbname); >>> $query_rs_products = sprintf("SELECT id_products, part_number, >>> product_category_name, id_product_categories, product_title, >>> product_description_short FROM tbl_products WHERE >>> id_product_categories = %s ORDER BY part_number ASC", >>> GetSQLValueString($colname_rs_products, "int")); >>> >>> $query_limit_rs_products = sprintf("%s LIMIT %d, %d", >>> $query_rs_products, $startRow_rs_products, $maxRows_rs_products); >>> $rs_products = mysql_query($query_limit_rs_products, $dbname) or >>> die(mysql_error()); >>> $row_rs_products = mysql_fetch_assoc($rs_products); >>> >>> By the way it may be obvious i'm a novice >>> >>> Thanks >> >>You can't assign two different values to the same variable. If you >>could, which of the two values would you expect to get out of that >>variable? How would you know which one you got? >> >>You have two choices here. You can call them something different: >> >>productlist.php?&id_product_categories1=2&id_pro duct_categories2=4 >> >>or you can pass them as an array: >> >>productlist.php?&id_product_categories[]=2&id_product_categories[]=4 > >That makes sense. Sounds like the array solution would be the best >route. I plugged that in and received this error message: > >Notice: Array to string conversion in >C:\wamp\www\lavender_coyote\productlist.php on line 6 > >the following code is on line 6 > > $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : >$theValue; > >can't really see why that would cause the error. i do know i need to >do something more and i searched, but could not find anything. any >suggestions? i appreciate your input. > >thanks OOPS almost forgot Also, there were no values outputted from either category |
|
![]() |
| Outils de la discussion | |
|
|