Re: I need a fresh look at storing variables in MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



the OP may not need such fanciness.. it depends on the amount of
reports he wants to store, the types of searches (if any) done by
browsers, and the amount of searches to expect.

and the OP may not have good db design skills yet.
for a noob, it's one timeconsuming thing to build a datamodel, but
it's harder to get it efficient yet simple.

if the oop wants to start a site with lots of reports and lots of
searching, we'd even have to remind him of the cloud hosting option,
which i'm sorry to say, has no real rdbms (mysql) support yet, and is
not always paid by the minute (but by the hour), meaning it's got only
a small chance of reducing his operating cost (by a lot); it's still
worth investigating in this case (given the much easier scaling
abilities of cloud hosting).

OP: if you need a mysql datamodel for reports, i'm willing to give it
a free shot. i'm sure others here would too, or improve upon mine.
It's probably not more than 3 tables i think.
Let us know eh..

On Sat, Mar 13, 2010 at 8:45 PM, Phpster <phpster@xxxxxxxxx> wrote:
> I'd go with a mysql data modelled approach as it will allow mysql to do lots
> of the heavy lifting during analysis as you've mentioned. If there are a lot
> of entries, it's gonna get complex and expensive memory-wise to manage XML
> or session based datasets.
>
> Plus having each question as it's own record should give you greater
> flexibility in packaging the data for analysis and reporting.
>
> Bastien
>
> Sent from my iPod
>
> On Mar 13, 2010, at 1:10 PM, tedd <tedd.sperling@xxxxxxxxx> wrote:
>
>> Hi gang:
>>
>> I just completed writing a survey that has approximately 180 questions in
>> it and I need a fresh look at how to store the results so I can use them
>> later.
>>
>> The survey requires the responder to identify themselves via an
>> authorization script. After which, the responder is permitted to take the
>> survey. Everything works as the client wants so there are no problems there.
>>
>> My question is how to store the results?
>>
>> I have the answers stored in a session variable, like:
>>
>> $_SESSION['answer']['e1']
>> $_SESSION['answer']['e2']
>> $_SESSION['answer']['e2a']
>> $_SESSION['answer']['e2ai']
>> $_SESSION['answer']['p1']
>> $_SESSION['answer']['p1a']
>> $_SESSION['answer']['p1ai']
>>
>> and so on. As I said, there are around 180 questions/answers.
>>
>> Most of the answers are integers (less than 100), some are text, and some
>> will be null.
>>
>> Each "vote" will have a unique number (i.e., time) assigned to it as well
>> as a common survey id.
>>
>> My first thought was to simply record the "vote" as a single record with
>> the answers as a long string (maybe MEDIUMTEXT), such as:
>>
>> 1, 1268501271, e1, 1, e2, 16, e2a, Four score and ..., e2a1, ,
>>
>> Then I thought I might make the data xml, such as:
>>
>>
>> <survey_id>1</survey_id><vote_id>1268501271</vote_id><e1>1</e1><e2>16</e2><e2a>Four
>> score and ...</e2a><e2ai></e2ai>
>>
>> That way I can strip text entries for <> and have absolute control over
>> question separation.
>>
>> Then I thought I could make each question/answer combination have it's own
>> record while using the vote_id to tie the "vote" together. That way I can
>> use MySQL to do the heavy lifting during the analysis. While each "vote"
>> creates 180 records, I like this way best.
>>
>> Then I thought, what would you guys do? So, what would you guys do?
>>
>> Keep in mind that this survey must evaluated in terms of answers, such as
>> "Of the ones who answered e1 as 1 how did they answer e2?"
>>
>> If there is something wrong with my preference, please let me know.
>>
>> Thanks,
>>
>> tedd
>>
>> --
>> -------
>> http://sperling.com  http://ancientstones.com  http://earthstones.com
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux