w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How do i use a query to display products from a query onto a product layout page
Pass your search parameter in your function and customize it like below function product ($product =NULL) { if(!empty($product)){ $get = mysql_query ("SELECT id, name, price, size, imgcover FROM products WHERE brand='nike' AND `name` LIKE '%".$product."%'"); }else{ $get = mysql_query ("SELECT id, name, price, size, imgcover FROM products WHERE brand='nike'"); } if (mysql_num_rows($get) == FALSE) { echo " There are no products to be displayed!";} else {while ($get_row = mysql_fetch_assoc($get)){echo "<div id='productbox'><a href='product.php'>".$get_row['name'].'<br /> £'.$get_row['price']. ' UK'.$get_row['size']. '<br />' .$get_row['imgcover']. "</a></div>" ;} } } Same if else blocks and a parameter to productlayout ($product

Categories : PHP

Excluding certain property values in inline query
Semantic Mediawiki isn't good at subtractive queries. Your query translates in English to: Find me every page that has all of these: -An instance of property "Is of type" equal to A -An instance of property "Is of type" not equal to B -An instance of property "Is of type" not equal to C Now here's the "gotcha": Suppose you have a page that "Is of type" A, B, and C. -It is of type A. -It is of a type that isn't B, namely A and C. -It is of a type that isn't C, namely A and B. It fits all of your conditions, and goes in the result. I run into these types of problems often. My wiki actually has several templates for subtracting query results.

Categories : Misc

Inefficient SQL query while excluding results on QuerySet
It looks like it's a kind of optimization. While filter() can be 'any' condition, it makes the join and the applies the restriction. exclude() is more restrictive, so you are not forced to join the tables and it can build the query using subqueries which I suppose would make the query faster (due to index usage). If you are using MySQL you could use explain command on the queries and see if my suggestion is right.

Categories : Python

Query to find the average of the rows excluding the top 5% in hiveQL
you can do a Cartesian join with the result of the percentile and then filter all the smaller values. Something like this : select avg(time) from sometable a join (select percentile(time,0.95) perc from sometable) b on (1=1) where a.time < b.perc; Its not the most efficient way but that's the first that comes in mind..

Categories : Hadoop

SQL Query to Find Matching Records but Excluding those that Match Second Criteria
Give a try with below query: (SELECT d.DocID, s.SignID FROM Documents AS d) temp1 INNER JOIN Signatures AS s ON d.SignID = s.SignID WHERE s.SignatoryName = 'Search Name Here' and d.DOCID not in ( select DocID from temp1)

Categories : SQL

Measure query execution time excluding start-up cost in postgres
What you want is actually quite ill-defined. "Startup cost" could mean: network connection overhead and back-end start cost of establishing a new connection. Avoided by re-using the same session. network round-trip times for sending the query and getting the results. Avoided by measuring the timing server-side with log_statement_min_duration = 0 or (with timing overhead) using explain analyze or the auto_explain module. Query planning time. Avoided by PREPAREing the query, then timing only the subsequent EXECUTE. Lock acquisition time. There is not currently any way to exclude this. Note that using EXPLAIN ANALYZE may not be ideal for your purposes: it throws the query result away, and it adds its own costs because of the detailed timing it does. I would set log_statement_min_duration

Categories : SQL

SQL query all products including those without descriptions
Change the applicable inner joins to left outer joins. Something like this: SELECT TP.intProductID AS ProductID, TP.strName AS Name, TPP.decPrice AS Price, TD.strDescription AS Description, GROUP_CONCAT( TRH.strName SEPARATOR ', ' ) AS Ingredients FROM TProducts TP JOIN TProductsPrices TPP on TP.intProductID=TPP.intProductID left JOIN TProductsDescriptions TPD on TP.intProductID=TPD.intProductID left JOIN TDescriptions TD on TPD.intDescriptionID=TD.intDescriptionID JOIN TProductsIngredients TPI on TPD.intProductID=TPI.intProductID JOIN TRawHerbs TRH on TPI.intIngredientID=TRH.intRawHerbID GROUP BY TPD.intProductID;

Categories : SQL

how to retrieve only updated products in long query?
You’ll need to add another column to your database that shows when row was last updated. It can be as simple as adding a datetime column ModifidedDate. If you want to take this one step further you can even add things like ModifiedBy and such… Once you complete this just update you stored procedure to include WHERE statement that basically says ALTER PROCEDURE dbo.[GetFeed] ( @LastModification datetime ) AS BEGIN SELECT * FROM Products WHERE ModifiedDate > @LastModification END You’ll also need to update your code to include parameter for GetFeed method and for SqlCommand object public List<Feed> GetFeed(DateTime lastModification) { DataSet dst = new DataSet(); SqlCommand cmd = null; List<Feed> feedlist = new List<Feed>(); using (SqlConnection conn =

Categories : Asp Net

SQL query: Current lowest price of products
All the data you need is in linkProductSeller so this should work select l.linkProductId, min(linkPrice + linkShippingPrice) as minPrice from linkProductSeller l, (select linkProductID, linkSellerId, max(linkDateTime) as linkDateTime from linkProductSeller group by linkProductID, linkSellerId) m where l.linkProductID = m.linkProductID and l.linkSellerID = m.linkSellerID and l.linkDateTime = m.linkDateTime group by linkProductId

Categories : Mysql

Opencart Query the database to get price and attributes of products
You can use this query to extract products from table "products" with same upc code: SELECT * FROM products AS pr JOIN products AS pr2 ON pr.upc_code = pr2.upc_code AND pr.id <> pr2.id

Categories : Mysql

How to construct MySQL query to get Products with all selected Features?
This is an example of a set-within-sets query. I think the best approach is aggregation, because it provides the most flexibility. Here is how you would find the products with all three features: SELECT p.* FROM products p INNER JOIN features_products fp ON p.id = fp.product_id group by p.id having sum(fp.feature_id = 1) > 0 and sum(fp.feature_id = 5) > 0 and sum(fp.feature_id = 11) > 0; Each condition in the having clause is checking for the existence of one product. What makes this flexible is if you wanted to have inclusion and exclusion lists. For instance, always has 1 and 5, but never 11: SELECT p.* FROM products p INNER JOIN features_products fp ON p.id = fp.product_id group by p.id having sum(fp.feature_id = 1) > 0 and su

Categories : Mysql

Magento: Query Database for products with no assigned categories
You can get product collection by using following code : $product = Mage::getModel('catalog/product'); $productCollection = $product->getCollection() ->addAttributeToSelect('*'); foreach ( $productCollection as $_product ) { echo $_product->getName().'<br/>'; } But for your requirement you can get idea from following links,may be its help you. How do I get product category information using collections in Magento

Categories : Magento

categories and subcategories and products query not working as intended
I think what you are doing wrong is the last inner join on clause condition where you have written cd.categories_id=c.categories_id. You should change it to this cd.categories_id=c.parent_id So your final query will be : SELECT p.products_id, pd.products_name, cd.categories_id AS main_category_id, cd.categories_name ,c.categories_id AS subcategory FROM products p INNER JOIN products_description pd ON pd.products_id=p.products_id INNER JOIN products_to_categories p2c ON p2c.products_id=p.products_id INNER JOIN categories c ON p2c.categories_id=c.categories_id INNER JOIN categories_description cd ON cd.categories_id=c.parent_id GROUP BY cd.categories_id

Categories : Mysql

Is it possible to allow users to purchase simple products and nominal products (subscriptions) together with Credit Card in Magento?
If you can accept subscriptions (which is a pci compliance issue but specific to your gateway and processor) Aheadworks has a subscriptions and recurring payments module that would allow you to accept subscriptions and regular items to be purchased at checkout. Hope this helps

Categories : Magento

Magento products have suddenly stopped appearing in New Products and Search
Ok so here's the solution. It's as simple as disabling the required products and then re-enabling them. TIP: If doing this in bulk, do NOT do 200 products at a time as it will freeze and you may be locked out of admin. I had a hair raising few minutes by doing that. I restarted my machine and then all was well again.

Categories : Magento

Filtering products in Index of Categories & Products by Product's attribute
Gemfile gem 'squeel' category.rb scope :with_published_products, -> { joins{product_categories.product}.where{products.status.eq "published"}.uniq } static_pages_controller.rb def catalog @categories = Category.with_published_products end my view - @categories.each do |category| category.name category.products.each do |product = render 'product', :product => product Hope this helps someone else... :)

Categories : Ruby On Rails

Creating Magento Bundled or Group Products with Configurable Products
There is a way to achieve this : Create a bundled product named "Auto Floor Mats Set". Create 4 configurable products named : "Front-Left Mat" "Front-Right Mat" "Back-Left Mat" "Back-Right Mat" then Create 3 simple products for each configurable product and associate them with configurable products created in previous step ( e.g. create simple products named : "Red Front-Left Mat" "Green Front-Left Mat" "Blue Front-Left Mat" and associate them with configurable product "Front-Left Mat") In your bundled product, go to "Bundle items" -> "Add New Option" and create 4 options : "Front-Left" "Front-Right" "Back-Left" "Back-Right" and add 3 selections for each option. e.g. add simple products : "Red Front-Left Mat" "Green Front-Left Mat" "Blue Front-Left Mat" as sel

Categories : Magento

How to import configurable products and associate simple products by csv
You can following the document at http://www.magentocommerce.com/knowledge-base/entry/importing-configurable-products

Categories : Magento

Zen cart: I would like to query from a specific category its products name, price, image, description, and attributes
That's because products_name and products_description is in table products_description (or to be more specific in TABLE_PRODUCTS_DESCRIPTION), not in table products (TABLE_PRODUCTS). To get all basic information (except attributes) You should execute following query: $q = $db->Execute("SELECT * FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON(p.products_id = pd.products_id) WHERE language_id = " . (int)$_SESSION['languages_id']); $items = array(); while(!$q->EOF) { // let's get all attribues for product $productInfo = $q->fields; $qattr = $db->Execute("SELECT * FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = " . (int)$q->fields['products_id']); $attr = array(); while(!$qattr->EOF) { $attr[] = $qattr-

Categories : PHP

mysql query to calculate values local to Cartesian products of logical groups of rows
As I said in a comment, tables are unordered sets: there is no first or second row... ... unless if you want to use the id column to explicitly order the rows. However, can you guarantee that there will always be (exactly) two samples for each case and that the "lower ID" always match the first sample? This appears to be quite fragile as in real-life, there will probably have cases where a test will be performed twice or a test will be missing or done "late". Not mentioning concurrent access to your DB. Can't you simply add a "sample number" column?

Categories : Mysql

MySQL Query - Group or add production volume for a unit when the unit can produce two different products
Is this what you want ? This will group dates, widgets and products no matter what category. You can further limit the query by adding a HAVING which is similar to WHERE except it is applied on groups (WHERE applies before GROUP BY). http://sqlfiddle.com/#!2/055d2/2 SELECT Production.date, Widget.widget, Product.product, SUM(Production.units_made) FROM ((Widget JOIN Production ON Widget.id = Production.widget) JOIN Product ON Production.product_id = Product.id) GROUP BY Widget.widget, Product.product, Production.date (See the SQLFiddle for a sample).

Categories : Mysql

selecting 1 image from each product if there were n different products, if not, select more than 1 image from each products til n is reached
If I understand it well -- you need n images. If possible from different products. Otherwise, several images from the same product is acceptable as fallback. From now, the only solution I could think of, is to build a temporary table, with numbered rows such as there will be one "image" of each product at the "top" -- and filed with the rest of the images. Once that table is build, your query is just a SELECT ... LIMIT n. This will perform horribly -- and if you choose that solution of something inspired -- you should consolidate the image table off-line or on schedule basis. see http://sqlfiddle.com/#!2/81274/2 -- -- test values -- create table P (id int, title char(20)); insert into P values (1, "product 1"), (2, "product 2"), (3, "product 3"); create table I (pid int, filena

Categories : Mysql

Excluding a provider from JAX-RS
Have you tried using maven exclusions. Similar issue I had and resolved with <!-- For Restful Client --> <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.8</version> <exclusions> <exclusion> <groupId>com.sun.jersey</groupId> <artifactId>resteasy-jaxrs</artifactId> </exclusion> </exclusions> </dependency> And then you can load your provider classes usig eclipse's classpath

Categories : Java

Excluding word after dot "." in SQL
Try this in your sql query Select TypeName, Syntax,LEFT(Description, CHARINDEX('.', Description) - 1) From tb_CsType I think its just like this question SQL Server replace, remove all after certain character For the Sql Server Compact edition there is no Left function. Try this in compact editon. SELECT TypeName, Syntax, SUBSTRING(Description, 0, CHARINDEX('.', Description)) AS Desc FROM tb_CsType This will remove the rest of the string value after '.'.In the SUBSTRING function the start value 0 means from the start of the word

Categories : C#

SQL Statement - Excluding certain data
You can use a LEFT JOIN. The LEFT JOIN keyword returns all rows from the left table with the matching rows in the right table. The result is NULL in the right side if there is no match. Since you want the jobs without a matching department, you can check if the joined DepartmentID is NULL: SELECT Job.Job FROM Job LEFT JOIN Jobs ON Job.ID = Jobs.JobID WHERE Jobs.DepartmentID IS NULL; Checkout this demo. Let me know if it works.

Categories : SQL

Excluding one list of items from another
You can read ID values into an array for processing in the below way : require 'yaml' yml = <<-_end_ --- Level1: Seattle: Name: "Rick" ID: "95155" Time: "2:00 PM" Car: "Hyundai" Denver: Name: "Arnold" ID: "82594" Time: "2:00 PM" Car: "Mitsubishi" Level 2: San Antonio: Name: "James" ID: "96231" Time: "2:00 PM" Car: "Honda" Minneapolis: Name: "Ron" ID: "73122" Time: "2:00 PM" Car: "Dodge" _end_ hsh = YAML.load(yml) # => {"Level1"=> # {"Seattle"=> # {"Name"=>"Rick", "ID"=>"95155", "Time"=>"2:00 PM", "Car"=>"Hyundai"}, # "Denver"=> # {"Name"=>"Arnold", # "ID"=>"82594", # "Time"=>"2:00 PM", # "Car"=>"Mitsubishi"}}, # "Level 2"=> # {"San Antonio"=> #

Categories : Ruby

Excluding filename using RewriteRule
Solved by adding additional conditions to the last rule RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^([^.]+)$ $1.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^/]*)(.*)$ index.php?category=$1&post=$2 [L,QSA]

Categories : Apache

Excluding map tiles from appcache
NETWORK section ask that resources newer be availible offline (you can use * pattern there). CACHE section ask that resources will be cached, you must put there all cached resources and can't use * pattern, because browser can't resolve that resources it must download. There you can set resources to another domain as http://tile.example.com/zoom/x/y.png. FALLBACK section ask that resources must be mapped to another when application offline, you can set there only self host resorces. If you want make map offline you must put all need tiles to CACHE section, but it's very match tiles and take a lot time for download all (thousands tiles and 20-50 Mb for million city). Likely to you can't use localStorage because it have little size (5 Mb without subdomians and iframes hacks). I made test

Categories : HTML

Excluding int=0 from populating selectbox
A much (much) better way would simply be to add default information separately from the database - don't store a "default" item from the database, put it in your code. To answer your question, however, use this: $result = mysql_query("SELECT id, name FROM drop_shippers WHERE id > 0");

Categories : PHP

Excluding some roles from accessing some url in web.xml
You forgot to set the roles in <auth-constraint>. This way nobody is able to access those resources. You need to set there the roles which are allowed to access those resources. Provided that your admin role is called exactly like this admin, then this should do: <auth-constraint> <role-name>admin</role-name> </auth-constraint> Don't forget to register the role as <security-role> if not done yet: <security-role> <role-name>admin</role-name> </security-role> See also: Java EE 6 Tutorial - Securing Web Applications

Categories : Java

tar/gzip excluding certain files
gzip will always handle files individually. If you want a bundled archive you will have to tar the files first and then gzip the result, hence you will end up with a .tar.gz file or .tgz for short. To get a better control over what you are doing you can find the files first using the command you already posted (with -print insted of the gzip command), put them into a file and use this file (=filelist.txt) to uinstruct tar with what to archive tar -T filelist.txt -c -v -f myarchive.tar

Categories : Linux

Excluding items using linq
You can use Except var remaining = defaults.Except(notDefaults); You may need to ensure your equality comparer on AssetMarkup is set to compare the objects in a non reference-based way. See here http://msdn.microsoft.com/en-us/library/ms173147(v=vs.80).aspx

Categories : C#

how to insert many records excluding some
Using a derived table, you can find the minID for each code, then join back to that in the outer to get the rest of the columns for that ID from oldTab. select id,name,code insert into newTabFROM from old_tab t inner join (SELECT min(id) as minId, code from old_tab group by code) x on t.id = x.minId WHERE (conditions)

Categories : SQL

Excluding operator differences
No difference between the 2 operators. From != (Not Equal To) (Transact-SQL) Tests whether one expression is not equal to another expression (a comparison operator). If either or both operands are NULL, NULL is returned. Functions the same as the <> (Not Equal To) comparison operator. Als from Comparison Operators (Transact-SQL) != (Not Equal To) Not equal to (not ISO standard)

Categories : Sql Server

.htaccess: Multiple TLD's to 1 TLD excluding subdomains
Try adding these rules to the htaccess file of your document root: RewriteEngine On RewriteCond %{HTTP_HOST} !domainY.net$ [NC] RewriteRule ^(.*)$ http://domainY.net/$1 [L,R=301] The expression matching the host will fail for any alpha.domainY.net because it only matches against the TLD (.net) and domain (domainY). The first line turns on the rewrite engine. The second line, the condition, is a true/false expression that is applied to the immediately following rule. In this case, it checks the request's Host: header, and if it ends with domainY.net, then the condition fails, because of the ! in front. The third line is the rule, the URI is used to match against the pattern ^(.*)$ which essentially matches everything, and is captured via the parentheses. Then the next bit is the targe

Categories : Htaccess

R: Data.table on subset excluding by value
Use a tiny bit of elementary maths: d[, c("tmp.mean", "N") := list(mean(Stops), .N), by = Market] d[, exep.mean := (tmp.mean * N - sum(Stops)) / (N - .N), by = list(Market,Carrier)] # Market Carrier Stops tmp.mean N exep.mean # 1: IAH:SNA Delta 1 2.00 4 3.000000 # 2: IAH:SNA Delta 1 2.00 4 3.000000 # 3: IAH:SNA Southwest 3 2.00 4 1.000000 # 4: IAH:SNA Southwest 3 2.00 4 1.000000 # 5: MSP:CLE Southwest 2 1.75 4 1.500000 # 6: MSP:CLE Southwest 2 1.75 4 1.500000 # 7: MSP:CLE American 2 1.75 4 1.666667 # 8: MSP:CLE JetBlue 1 1.75 4 2.000000

Categories : R

SQL Select records excluding some statuses
This is an example of a set-within-sets query: select order_id from t group by order_id having sum(case when status = 2 then 1 else 0 end) = 0 The having clause counts the number of rows with a status of 2. The = 0 finds the orders with no matches. EDIT: If you want to include orders with status 1 and exclude those with status 3, then you can use a similar idea: having sum(case when status_id = 1 then 1 else 0 end) > 0 and sum(case when status_id = 3 then 1 else 0 end) = 0

Categories : SQL

Excluding Synthetic Classes in Emma within STS
I recently ran into this issue with a generic CSV export helper that I was using. The exception you are seeing is that Jacoco/Emma can't set the synthetic field that it uses to track your code coverage. You need to allow Emma to access that synthetic field. If you have stopped Emma accessing synthetic fields because adding the synthetic field was causing problems with your reflection, eg. you are using reflection to iterate over a collection of Field objects, just do the following: Field[] fields = fooObject.getClass().getDeclaredFields(); Field[] nonSyntheticFields = new Field[fields.length]; for(int i = 0; i < fields.length; i++){ if(!fields[i].isSynthetic()){ nonSyntheticFields[i] = fields[i]; //Or whatever processing you are doing here with your fiel

Categories : Java

excluding a directory from find and sed rename
Use finds -not Option: find . -type f -name '*.php' -not ( -path './etc/*' -o -path './cache/*' -o -path './archive/*' ) -exec sed -i 's|oldurl.com|newurl.org|g' {} ;

Categories : Linux

Rails: Excluding images from being linked from CDN
The solution is to have conditions set in production.rb file which sets the asset_host based on URL pattern. In my case, i wanted anything in user_photos to be served from a different asset host than all other static assets: config.action_controller.asset_host = Proc.new { |source| case source when //user_photos// APP_CONFIG['dynamic_photos_root_url'] else APP_CONFIG['asset_cdn'] end } Carrier-wave config changes did not do anything, so i ended up removing them. CDN is cloudfront by Amazon, and they do something funky with the cookies which i did not understand even when i set the behavior of the CDN to pass through all cookies. Following discussion was key in figuring out the solution: Configure dynamic assets_host in Rails 3 I wonder if there is a way to get Amazon

Categories : Ruby On Rails



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.