
nvso
Members-
Posts
13 -
Joined
-
Last visited
Never
Everything posted by nvso
-
I'm trying to work around with mod-rewrite but cant get it working quite the way i wanted to. Basicly, what I want to achieve, is to convert url like this: www.mysite.com/products/maincategory/subcategory/lower/sony-ps3-80gb (so this is what I want search engines to see) TO www.mysite.com/index.php?page=products&path=maincategory/subcategory/lower&product=sony-ps3-80gb (and this is what I want PHP to see) The number of categories in the string "path" can vary I guess this should be done with QUERY_STRING but regardless of my efforts, I don't understand how
-
select id and check if no more of that id is found on the same table
nvso replied to nvso's topic in MySQL Help
thanks, that worked just fine for me! fenway: i wanted to select products id from products_table, if it did not occur anymore on products_groups -table, after deleting a certain group id (attached to a product_id).. Gah, never mind lol -
There is possibly a simple way for this but english not being my native language I cant come up with proper search terms for such need.. That is: I have to tables, products and products_groups products products_groups products_id products_id group_id 1 1 10 1 20 1 30 2 2 20 In this example, a certain products with ID 1 belongs to many different groups (10,20 and 30). Now, I wanted to remove a certain group, say, group "20". I also need to SELECT a products data if it belongs to group "20". In this case, product with ID "2" is to be selected from products_table, but since product ID "1" is still attached to two other groups (10 and 20) I do not want to select that products ID. In my query, I can only know the ID of the group. So, in other words, I need something like "select products_id from table_products WHERE products_groups.products returns no more than one row with selected categories product_id" Hope you understand what I'm after. I know how to do this "the hard way" but if there was a single query I'd be delighted Thanks in advance! - M
-
ok worked fine, thanks!
-
Hello I have a mysql table listing peoples names, to simplify it, let's say it only has two fields: ID and SURNAME: DATA: ID | SURNAME --------------- 1 | Smith 2 | Jackson 3 | Goldberger 4 | Baker 5 | Evans ... and so on.. Now, let's say I have a php page listing all these people, normally I would page the "results" like, display first 20 people and rest on other result pages, but now I would like to display the results like: A-G --- H-N --- O-T --- U-Z If I select A-G, how would I query for all those people whose surname begins with letters from A to G (a,b,c,d,e,f,g) - let's say I have the data for necessary letters in that format? Is it possible some other way than SELECT surname FROM names WHERE surname LIKE A% OR surname LIKE B%... ? Thanks for helping a dummy - M
-
Ok. That works. Thank you so very much
-
Sure, it works - as long as year does not change..? Or at least that's how it seems. Should I try to convert the field values to seconds or something? Is that possible? - M
-
Yes, that would show me events occurring in selected month / year, say 12/2008. Those are displayed ok, BUT if the event continues to January 2009 Barand's query stops working - at least for me. See, to remind you that only ONE month is displayed at once. So, when I change to January the query changes to: event_date_begin <= 2009-01-01 AND event_date_begin >= 2009-01-31 Now that the event that starts in december and ends in january will not be found because this query assumes that the beginning and ending of this event is somewhere in January. - M
-
Ok thanks, getting closer to solving this topic.. Now though, this query returns no rows although there is at least one line where event begins in december 2008 and ends in january 2009: SELECT event_id, event_date_begin, event_date_end FROM events WHERE DATEDIFF( event_date_end, 2008-12-01)>=0 AND DATEDIFF(event_date_begin, 2008-12-31)<=0 2008-12-01 and 2008-12-31 are php generated, first day of the month and last day of the month Is my query constructed somehow wrong, no errors are thrown anyways? - M
-
Yes, but we only know the month and the year when displaying the calendar because events are queried before the calendar is generated. - Mikko
-
Logic (in that order): 1. User selects month and year to generate calendar for Like 1,2009 (January 2009) 2. SQL Queries all events where the date of event beginning or ending is somewhere in january (so even if the event is from december 28, 2008-january 1, 2009) sql could retrieve this row because it ENDS in january 3. PHP generates the calendar here
-
nope, doesn't work, no results SELECT event_id, event_date_begin, event_date_end FROM events WHERE event_date_begin <= 2008-12-31 AND MONTH(event_date_end) AND event_date_begin >= 2008-12-01 ORDER BY event_id ASC event_date_begin and event_date_end are as "DATE" -format. This would perhaps work if the date was represented as some sort of numerical values, I suppose.. - Mikko
-
I have a small calendar application and I'd need to fetch certain data from mysql with a "simple"? query. What I'm trying to achieve is: Let's say I have a event "party" in database. It starts in 2008-12-28 and ends in 2009-01-03. So it lasts for a few days.. The starting date and ending date are stored to my database in those formats (y-m-d, default "date"-format) Let's say I'm viewing January 2009 in my calendar. I know the date and or ( day, month, year). I'd need to fetch all data from database, which is still active in January 2009. So, I should be able to display "party" because it still is active for days 1,2,3 in January. How I tried this: SELECT event_id, event_date_begin, event_date_end FROM events WHERE 1 BETWEEN MONTH(k.event_date_begin) AND MONTH(event_date_end) AND 2009 BETWEEN YEAR(event_date_begin) AND YEAR(event_date_end) OR MONTH(event_date_begin) = 1 ORDER BY event_id ASC The part OR MONTH(event_date_begin) = 1 ORDER BY event_id ASC is for events that start and end at the same day (and month). This should not be relevant to my problem..? The SELECT query above works just fine without the last BETWEEN (year) statement. Current outcome: For December 2008 events show alright, query returns all necessary info. If I change to January 2009, no rows are returned Any help would be highly appreciated!