raduenea Posted August 16, 2013 Share Posted August 16, 2013 Hello, I see in many eCommerce links something like: http://www.exemple.com/laptops/acer-aspire-e1-571G/ So to show the product detail of the Acer the select is made by this string in DB "acer-aspire-e1-571G" ? As I know the select is made by ID for fast results. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/281232-select-a-product-info-from-db-without-id/ Share on other sites More sharing options...
requinix Posted August 16, 2013 Share Posted August 16, 2013 The/an identifier for the record is "acer-aspire-e1-571G". If you think that you can only get "fast results" by searching on an ID number then you don't understand databases. Quote Link to comment https://forums.phpfreaks.com/topic/281232-select-a-product-info-from-db-without-id/#findComment-1445303 Share on other sites More sharing options...
raduenea Posted August 16, 2013 Author Share Posted August 16, 2013 Ok . What is the difference showing results for a table after search by id or a long string? Quote Link to comment https://forums.phpfreaks.com/topic/281232-select-a-product-info-from-db-without-id/#findComment-1445305 Share on other sites More sharing options...
Solution requinix Posted August 16, 2013 Solution Share Posted August 16, 2013 Indexes. IDs are typically primary keys which means they have unique indexes. You can put indexes on any column or combination of columns you want, so if you want to search based on a unique string key then put a unique index on that column. The only real limitation is that the index must be Quote Link to comment https://forums.phpfreaks.com/topic/281232-select-a-product-info-from-db-without-id/#findComment-1445383 Share on other sites More sharing options...
Psycho Posted August 16, 2013 Share Posted August 16, 2013 The "acer-aspire-e1-571G" is almost definitely not the "name" of the product, but is instead a unique code. So, the query is doing a search on a single column for a matching code. Quote Link to comment https://forums.phpfreaks.com/topic/281232-select-a-product-info-from-db-without-id/#findComment-1445386 Share on other sites More sharing options...
raduenea Posted August 16, 2013 Author Share Posted August 16, 2013 Thank you for your response. Now it's all clear. Quote Link to comment https://forums.phpfreaks.com/topic/281232-select-a-product-info-from-db-without-id/#findComment-1445392 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.