Jump to content

mabus

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by mabus

  1. I need to create a PHP method (with parameters) that can be called by a Flash application. This method is supposed to return an XML document. How do I go about doing something like this?
  2. Hello, I'm having another mysql query problem, and this involves something like pivoting a query table. Here's my example table.. YearMonth | TotalView | ViewType 2008-01 100 Type1 2008-02 200 Type2 2008-03 300 Type1 Now, what I want to achieve is that instead of having that "ViewType" column, I would want to have colums that are the values from that "ViewType" column. In other words, it will be two additional columns namely "Type1", and "Type2"... here's a sample result of what I would want... YearMonth | Type1| Type2 2008-01 100 10 2008-02 200 200 2008-03 300 300 Something like that. The way I see it, I need to do a pivot on the table rows, but I do not know how to do that yet, and I haven't found a good tutorial for it yet. So, if you have ideas on how I I may achieve this, please send your advices. Thanks in advance
  3. This one works dude. The "yearmonth" , and "totalviews" columns that it produces are correct , except for the lasts ones. What I'd like to have is to have different columns for the view types too. Got any query suggestions on how I can I achieve that? again, thanks in advance.
  4. thanks for that dude. I appreciate it..
  5. ahahahhahaha.. thats fun.. hhhmm ..I'm not too good at joins. can anyone give me a sample query on this? thanks in advance guys, I really appreciate it
  6. hhhmm..joins are too expensive, os I'm putting that as a last resort
  7. Hello, I have mysql query problems that I can't seem to figure out yet. the scenario involves two tables, and the objective is to be able come up with an uput that combines the reults from the two related tables. here's the scenario. ViewType (Id, Name) < --- this is a lookup table Table B (Id, ProfileId, Date, ViewTypeId) <-- ViewTypeId field is a foreign key associated with ViewTypeTable Now, what I am aimign for is to come up with results that summarizes according the month and the view type. So the table should have these columsn "Date", "Number of Views", "ViewType 1 view" , "View Type 2 view" Please share your ideas to me. Thanks in advance...
  8. My situation involves querying two tables. One table contains records that match the other in a one to many relationship. Example Person - Id - Name FavoriteColor -Id - Name - PersonId. The example above shows what my situation is like. This basically means that each peroson can have 0 or more FavoriteColors. Now, in this case that I want to come up with a table that contains the list of person, regardless if they have or not have any favorite colors. Sample Output (desired ouput) PersonName ColorName John Blue John Red Doe James Green Bill How will I be able to come up with a result like that? What I want is to be able to display results, even if a particular person profile has a matching color or not. Thanks in advance
  9. I have 2 tables, say, "Person" and "Hobbies". Person can have zero or more hobbies. Here's what the table structure looks like: Person (Id , Name) Hobbies (Id, PersonId, HobbyName) How do I get all the Person->Id where Person->Name is, say, 'John' regardless if the record has a hobby?
  10. I want to be able to implement full text searching. Apparently, I am only able to do it on one table. What I am looking for is how I may be able to do it on more than one tables. The tables that I will be using already has some colums / fields indexed to be full text, and all I need is a sample query on how I may go about doing so.
  11. How do you perform a full text search on more than one table, in one query? This, of course has tables with columns indexed as full text.
  12. Hi, I need help on how I may go about doing some get variable passing from one page to another. The situation is that , it all starts in one form, with a method of 'GET'. It has to be 'GET' 'cause the query string that it generates for the url is important for this case. Now, when the form is submitted, there will be a result page that has a link to another page. What I want is that when this url link is clicked, the results of the passed form (basically the $_GET variables) is also passed to that other page. My problem is how am I going to pass the $_GET variables via that url link. Is there a method that can convert the $_GET variables automatically into a string? or is there a method to get the generated url query string so I can pass it around? Please send in your comments. Thanks
  13. I want each user to have one row, and the dates that is to be displayed is the most recent one.
  14. THanks for the reply guys. However, doing a MAX on the dates did not quite work for me. The other approach of sorting by date in descending order, and limiting the result to 1, resulted to creating a 'SELECT' statement within an outer 'SELECT' statement. For example... SELECT tableOne.SomeId, (select tableOne.SomeId, tableone.Date from TableOne order by date DESC limit 1 ) FORM tableOne as tableOne WHERE ...<snip> It was something like this. I got the result that I want, but am dissapointed 'cause the execution time reached about 12-13 seconds. This is not good, in this case. Any suggestions on how I may optimize the query?
  15. I need some SQL help. Here's my table: Activity - Id (PK) - ProfileId (FK) - Date Each record represents a profile's activity in the CMS we're building (e.g. user updated profile, user uploaded photo, etc.) I'm only interested Id, ProfileId, and Date of the latest activity. How do I get that?
  16. Hey thanks. Can I see some samples of that query?
  17. I would like to perform a query on a table (or group of tables) based on multiple parameters. I do not need the results to match all these parameters; matching at least one of the parameters is enough. However, I want to rank the results in such a way that those that match more parameters rank higher than those that match less parameters. Also, I would like to define a "weight" to each of the parameter to help sort the results. For example, say I have a Person table and did a search for: Gender = Male and Eye Color = Blue. Assume I have 4 records: 1. Gender = Male, Eye Color = Blue 2. Gender = Female, Eye Color = Blue 3. Gender = Male, Eye Color = Green 4. Gender = Female, Eye Color = Green The result should give me records #1, #2, and #3. Then let's say that I wanted to give more weight to Gender than Eye Color. Thus, my expected result would be this: #1, #3, and #2. How would I accomplish this?
  18. Given records containing a DateTime column, how do I get a count of records for each month? I need results to resemble something like the following: June 2008, 13 July 2008, 10 August 2008, 15 ... ... Please send in your replies.. thanks
  19. Can anyone suggest a calendar module I can use for a PHP application? The key feature I am looking for is for this module to have some sort of API so I can feed it calendar events, particularly recurring events. Most of the calendar modules I've found do not have the interface I want for the recurring events entry. I'm looking for something more like Outlook 2007. So, I plan to create a similar interface and then want to save the captured event details in the calendar module. Other nice-to-haves: 1. iCalendar compliance 2. Various display options (e.g. daily, weekly, monthly, etc.) 3. Semantic mark up, valid mark up, valid style sheets, etc. Any suggestions?
  20. This one works, and is good enough for me. Thanks for the help
  21. I usually user php's "assert" function to test variables. Now, is there a way to determine the type of object that is initialized to a variable? The function "is_object" is not good enough, 'cause it will only determine a particular variable or not, but what I want is to determine if a particular object satisfies the set requirement. for example: public function GetSomething(MyDesiredObject $newObject) { ... some implementation here ... } Now, I want this function to be able to accept only that "MyDesiredObject" data type. usually I'd do an assert from within the function to test, but how about if I want to determine if the value of that "$newObject" variable is really of "MyDesiredObject" data type? How do we do this on PHP?
  22. Hi guys. I'm a new member of this forum, and seems to me that it si quite promising. Now, this would be my first post, and I'd like to share a bit of a problem. Here's the situation... I have two classes , one is a parent class, and the other is a child that extends to it. Now both classes have private memebers that are accessed via properties. Now, what I want to do is to iterate through the object, from the child class, and be able to get the members of the parent class too. How can I do this? Report this post
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.