Good day. I am writing an online store, one at a time, which I found on the Internet. In one moment, I found a snag. Products from the database are displayed completely in all categories. Does not capture cat and type variables in url (for example: ../viewCat.php?cat=canon&type=laserCartridge ):
$ cat = $ _GET ['cat'];
$ cat = strip_tags ($ cat);
$ cat = mysql_real_escape_string ($ cat);
$ cat = trim ($ cat);
$ type = $ _GET ['type'];
$ type = strip_tags ($ type);
$ type = mysql_real_escape_string ($ type);
$ type = trim ($ type);
if (! empty ($ cat) &&! empty ($ type)) {
$ querycat = "AND brand = '$ cat' AND type_product = '$ type'";
} else {
if (! empty ($ type)) {
$ querycat = "AND type_product = '$ type'";
} else {
$ querycat = "";
}
}
$ result = mysql_query ("SELECT * FROM products WHERE visible = '1' $ querycat ORDER BY $ sorting", $ link);
mysql_your course has long been outdated and it's time to send it to the dump. - Visman