php-general Digest 13 Mar 2010 23:04:59 -0000 Issue 6637

Topics (messages 302771 through 302787):

Re: PHP Sessions
        302771 by: Andre Polykanine
        302772 by: Ashley Sheridan
        302773 by: Andre Polykanine
        302774 by: Ashley Sheridan

Migration Scheme - from one mysql DB to another mysql DB
        302775 by: MEM
        302777 by: Per Jessen
        302778 by: Teus Benschop
        302779 by: Robert Cummings
        302783 by: Phpster
        302786 by: Rene Veerman

Re: PHP in HTML code
        302776 by: Jorge Gomes

I need a fresh look at storing variables in MySQL
        302780 by: tedd
        302781 by: paragasu
        302782 by: Rene Veerman
        302784 by: Phpster
        302785 by: Rene Veerman

natural text / human text analysis
        302787 by: Rene Veerman

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Hello Martine,

As you have been already told, the <?=...?> is not always supported.
However I'd suggest you to do the following (since I love this form of
tag):
 <td align="left">&laquo;<?=$_SESSION['scripture_text']?>&raquo;</td>

 Note: I put within the tag only the variable.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

----- Original message -----
From: Martine Osias <webi...@gmail.com>
To: php-gene...@lists.php.net <php-gene...@lists.php.net>
Date: Saturday, March 13, 2010, 4:33:34 AM
Subject: [PHP] Re: PHP Sessions

The sessions variables are OK. They don't print when I put them on the HTML 
page with this code.

<tr>
 <td align="left"><?="&laquo;".$_SESSION['scripture_text']."&raquo;"?></td>
 </tr>

<tr>
 <td style="font-size: smaller;" 
align="right"><?=$_SESSION['scripture_ref']?></td>
 </tr>

Thank you.


Martine

""Martine Osias"" <webi...@gmail.com> wrote in message 
news:95.0c.13686.c7cda...@pb1.pair.com...
> Hi:
>
> I need to store variables to send then between pages. I don't need the 
> variables in a database so I try to send them with sessions. The variables 
> don't seem to be there when I try to get them. What could be the problem. 
> Here are the pages where I store and retrieve the variables.
>
> Page 1 (variables stored):
>
> <?php
>
> session_start();
>
> $_SESSION['scripture_text']  = $row_scripture['ScriptureText'];
> $_SESSION['scripture_ref']  = $row_scripture['ScriptureRef'];
>
> ?>
>
> Page 2 (variables retrieved):
>
> <?php
> session_start();
> include("includes/config.php");
> ?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
> </head>
> <body>
>
> <table width="100%" align="center" border="0">
>
> <tr>
> <td align="left"><?="&laquo;".$_SESSION['scripture_text']."&raquo;"?></td>
> </tr>
>
> <tr>
> <td style="font-size: smaller;" 
> align="right"><?=$_SESSION['scripture_ref']?></td>
> </tr>
>
> </table>
>
> </body>
> </html>
>
> 


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


--- End Message ---
--- Begin Message ---
On Sat, 2010-03-13 at 12:22 +0200, Andre Polykanine wrote:

> Hello Martine,
> 
> As you have been already told, the <?=...?> is not always supported.
> However I'd suggest you to do the following (since I love this form of
> tag):
>  <td align="left">&laquo;<?=$_SESSION['scripture_text']?>&raquo;</td>
> 
>  Note: I put within the tag only the variable.
> 
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
> 
> ----- Original message -----
> From: Martine Osias <webi...@gmail.com>
> To: php-gene...@lists.php.net <php-gene...@lists.php.net>
> Date: Saturday, March 13, 2010, 4:33:34 AM
> Subject: [PHP] Re: PHP Sessions
> 
> The sessions variables are OK. They don't print when I put them on the HTML 
> page with this code.
> 
> <tr>
>  <td align="left"><?="&laquo;".$_SESSION['scripture_text']."&raquo;"?></td>
>  </tr>
> 
> <tr>
>  <td style="font-size: smaller;" 
> align="right"><?=$_SESSION['scripture_ref']?></td>
>  </tr>
> 
> Thank you.
> 
> 
> Martine
> 
> ""Martine Osias"" <webi...@gmail.com> wrote in message 
> news:95.0c.13686.c7cda...@pb1.pair.com...
> > Hi:
> >
> > I need to store variables to send then between pages. I don't need the 
> > variables in a database so I try to send them with sessions. The variables 
> > don't seem to be there when I try to get them. What could be the problem. 
> > Here are the pages where I store and retrieve the variables.
> >
> > Page 1 (variables stored):
> >
> > <?php
> >
> > session_start();
> >
> > $_SESSION['scripture_text']  = $row_scripture['ScriptureText'];
> > $_SESSION['scripture_ref']  = $row_scripture['ScriptureRef'];
> >
> > ?>
> >
> > Page 2 (variables retrieved):
> >
> > <?php
> > session_start();
> > include("includes/config.php");
> > ?>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > <html xmlns="http://www.w3.org/1999/xhtml";>
> > <head>
> > </head>
> > <body>
> >
> > <table width="100%" align="center" border="0">
> >
> > <tr>
> > <td align="left"><?="&laquo;".$_SESSION['scripture_text']."&raquo;"?></td>
> > </tr>
> >
> > <tr>
> > <td style="font-size: smaller;" 
> > align="right"><?=$_SESSION['scripture_ref']?></td>
> > </tr>
> >
> > </table>
> >
> > </body>
> > </html>
> >
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


That's still using short tags. The time you save on typing is nothing
compared to the time you spend trying to figure out why your script
doesn't work since you moved servers, or copied it to your live server,
or why you are having trouble using XML...

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hello Ashley,

And if the site is full of that code?)) I think it's worth to learn
what's really the reason of the fact that it doesn't work. Besides
that, it's more readable for me.
And the right thing that was said here is the following: check the
php.ini settings and change them if possible.

-- 
With best regards from Ukraine,
Andre
Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

----- Original message -----
From: Ashley Sheridan <a...@ashleysheridan.co.uk>
To: Andre Polykanine <an...@oire.org>
Date: Saturday, March 13, 2010, 12:33:46 PM
Subject: [PHP] Re: PHP Sessions

On Sat, 2010-03-13 at 12:22 +0200, Andre Polykanine wrote:

> Hello Martine,
> 
> As you have been already told, the <?=...?> is not always supported.
> However I'd suggest you to do the following (since I love this form of
> tag):
>  <td align="left">&laquo;<?=$_SESSION['scripture_text']?>&raquo;</td>
> 
>  Note: I put within the tag only the variable.
> 
> -- 
> With best regards from Ukraine,
> Andre
> Skype: Francophile; Wlm&MSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
> jabber.org
> Yahoo! messenger: andre.polykanine; ICQ: 191749952
> Twitter: m_elensule
> 
> ----- Original message -----
> From: Martine Osias <webi...@gmail.com>
> To: php-gene...@lists.php.net <php-gene...@lists.php.net>
> Date: Saturday, March 13, 2010, 4:33:34 AM
> Subject: [PHP] Re: PHP Sessions
> 
> The sessions variables are OK. They don't print when I put them on the HTML 
> page with this code.
> 
> <tr>
>  <td align="left"><?="&laquo;".$_SESSION['scripture_text']."&raquo;"?></td>
>  </tr>
> 
> <tr>
>  <td style="font-size: smaller;" 
> align="right"><?=$_SESSION['scripture_ref']?></td>
>  </tr>
> 
> Thank you.
> 
> 
> Martine
> 
> ""Martine Osias"" <webi...@gmail.com> wrote in message 
> news:95.0c.13686.c7cda...@pb1.pair.com...
> > Hi:
> >
> > I need to store variables to send then between pages. I don't need the 
> > variables in a database so I try to send them with sessions. The variables 
> > don't seem to be there when I try to get them. What could be the problem. 
> > Here are the pages where I store and retrieve the variables.
> >
> > Page 1 (variables stored):
> >
> > <?php
> >
> > session_start();
> >
> > $_SESSION['scripture_text']  = $row_scripture['ScriptureText'];
> > $_SESSION['scripture_ref']  = $row_scripture['ScriptureRef'];
> >
> > ?>
> >
> > Page 2 (variables retrieved):
> >
> > <?php
> > session_start();
> > include("includes/config.php");
> > ?>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > <html xmlns="http://www.w3.org/1999/xhtml";>
> > <head>
> > </head>
> > <body>
> >
> > <table width="100%" align="center" border="0">
> >
> > <tr>
> > <td align="left"><?="&laquo;".$_SESSION['scripture_text']."&raquo;"?></td>
> > </tr>
> >
> > <tr>
> > <td style="font-size: smaller;" 
> > align="right"><?=$_SESSION['scripture_ref']?></td>
> > </tr>
> >
> > </table>
> >
> > </body>
> > </html>
> >
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


That's still using short tags. The time you save on typing is nothing
compared to the time you spend trying to figure out why your script
doesn't work since you moved servers, or copied it to your live server,
or why you are having trouble using XML...

Thanks,
Ash
http://www.ashleysheridan.co.uk




--- End Message ---
--- Begin Message ---
On Sat, 2010-03-13 at 12:49 +0200, Andre Polykanine wrote:

> Hello Ashley,
> 
> And if the site is full of that code?)) I think it's worth to learn
> what's really the reason of the fact that it doesn't work. Besides
> that, it's more readable for me.
> And the right thing that was said here is the following: check the
> php.ini settings and change them if possible.
> 


If the site is full of that code I'd make a start on replacing it. A
simple find/replace will work in cases like this.

I try to write my code so that I don't have to make unnecessary changes
to my php.ini. For example, what if I don't have access to my php.ini
and can't set a directive in my .htaccess file? What if I'm sharing my
code with someone? What if I need to work with outputting XML headers?
All of these factors I think outweigh any gains I would get from short
tags.

As for readability, I tend to use a text editor with syntax highlighting
which makes my code readable.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hello all,

If possible, I would like to ask and have your help about the methods and
procedures that should exist to accomplish the following task:
I need to grab some data from one mySQL database with some specific table
and field names, to another mySQL database with specific table and field
names. The destination database tables are empty.

What is a common procedure to do on those cases? Is there any? Several? What
are the most common?
If I need to be more specific in order to benefit from your help, please,
let me know.


Best regards,
Márcio



--- End Message ---
--- Begin Message ---
MEM wrote:

> Hello all,
> 
> If possible, I would like to ask and have your help about the methods
> and procedures that should exist to accomplish the following task:
> I need to grab some data from one mySQL database with some specific
> table and field names, to another mySQL database with specific table
> and field names. The destination database tables are empty.
> 
> What is a common procedure to do on those cases? Is there any?

Dump all data from table1, optionally alter column names (e.g. using
sed), load all data into table2.  



-- 
Per Jessen, Zürich (5.0°C)


--- End Message ---
--- Begin Message ---
On Sat, 2010-03-13 at 17:09 +0100, Per Jessen wrote:
> > If possible, I would like to ask and have your help about the methods
> > and procedures that should exist to accomplish the following task:
> > I need to grab some data from one mySQL database with some specific
> > table and field names, to another mySQL database with specific table
> > and field names. The destination database tables are empty.
> > 
> > What is a common procedure to do on those cases? Is there any?

There may be several ways, but one way would be to open a mysqli
connection to one database, another mysqli connection to the other
database, then to pump all data over, optionally filtering the data.
Teus.

--- End Message ---
--- Begin Message ---
MEM wrote:
Hello all,

If possible, I would like to ask and have your help about the methods and
procedures that should exist to accomplish the following task:
I need to grab some data from one mySQL database with some specific table
and field names, to another mySQL database with specific table and field
names. The destination database tables are empty.

What is a common procedure to do on those cases? Is there any? Several? What
are the most common?
If I need to be more specific in order to benefit from your help, please,
let me know.

If it's the same server just different databases, then MySQL allows queries between databases and you could do it in a single query. Something like the following:

INSERT INTO DB1.TABLE1 ( field1, field2, field3 ) SELECT field1, field2, field3 FROM DB2.TABLE1;

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

--- End Message ---
--- Begin Message --- Rob's approach is what I use as well, if faced with this issue. It's quick and simple to do.

Bastien

Sent from my iPod

On Mar 13, 2010, at 12:47 PM, Robert Cummings <rob...@interjinn.com> wrote:

MEM wrote:
Hello all,
If possible, I would like to ask and have your help about the methods and
procedures that should exist to accomplish the following task:
I need to grab some data from one mySQL database with some specific table and field names, to another mySQL database with specific table and field
names. The destination database tables are empty.
What is a common procedure to do on those cases? Is there any? Several? What
are the most common?
If I need to be more specific in order to benefit from your help, please,
let me know.

If it's the same server just different databases, then MySQL allows queries between databases and you could do it in a single query. Something like the following:

INSERT INTO DB1.TABLE1 ( field1, field2, field3 ) SELECT field1, field2, field3 FROM DB2.TABLE1;

Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP

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


--- End Message ---
--- Begin Message ---
I'd like to know

- what type of hosting and OS the 2 databases are running.
- if they're (staying) on the same machine, and if not: whats the
available bandwith (up&down, low&peak) between the machines? any cost
to that bandwith?
- if you have admin rights on both databases.
- how often you need to do this and for how much data (in Mb)

On Sat, Mar 13, 2010 at 2:44 PM, MEM <tal...@gmail.com> wrote:
> Hello all,
>
> If possible, I would like to ask and have your help about the methods and
> procedures that should exist to accomplish the following task:
> I need to grab some data from one mySQL database with some specific table
> and field names, to another mySQL database with specific table and field
> names. The destination database tables are empty.
>
> What is a common procedure to do on those cases? Is there any? Several? What
> are the most common?
> If I need to be more specific in order to benefit from your help, please,
> let me know.
>
>
> Best regards,
> Márcio
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
First of all, i recommend the use of normal php tags (<?php ...  ?>) because
the short tags are atm marked as* **DEPRECATED*.

You should also echo your values to the page, instead using the shortcut <?=
(stop being a lazy ass! :P):

<tr>
<td align="left"><?php echo $_SESSION['scripture_text']; ?></td>
</tr>

--------

<input type="text" name="reservation_date" value="<?php echo
$_GET['rdate'];  ?>" readonly="">

remember that between tags, we have normal php code.

Rewards
_______________________________
Jorge Gomes


2010/3/13 David Robley <robl...@aapt.net.au>

> Martine Osias wrote:
>
> > An HTML/PHP code migrated to a different hosting platform seems to behave
> > differently. The PHP statements within HTML fields or within tables  does
> > not execute
> >
> > PHP within table:
> >
> > <tr>
> >  <td
> >  align="left"><?="&laquo;".$_SESSION['scripture_text']."&raquo;"?></td>
> >  </tr>
> >
> > This PHP code doesn't print in the HTML page.
> >
> > PHP within form field:
> >
> > <input type="text" name="reservation_date" value="<?=$_GET['rdate'];?>"
> > readonly="">
> >
> > This PHP code shows on the page when it shouldn't. The same variable is
> an
> > input and an output in this form:
> >
> > ********************************************
> <snip code>
> >
> > Are there times when the <? statements in HTML code don't execute?
>
> Yes - when short_open_tag is disabled in the config. See
> http://www.php.net/manual/en/ini.core.php#ini.short-open-tag for more
> info.
>
> I'd suggest you move away from using short tags, if for no other reason
> than
> portability.
>
>
> Cheers
> --
> David Robley
>
> A conclusion is simply the place where you got tired of thinking.
> Today is Boomtime, the 72nd day of Chaos in the YOLD 3176.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
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

--- End Message ---
--- Begin Message ---
On Sun, Mar 14, 2010 at 2:10 AM, tedd <tedd.sperl...@gmail.com> 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
>
>
Hi Ted,

How about saving the array in serialize variable to TEXT column

$answer = serialize($_SESSION['answer']);

to get the original array value simply unserialize the value from the
database..

Paragasu

--- End Message ---
--- Begin Message ---
+1, but it also kinda depends on what you want to do with it later,
and how much.

if you want to re-use filled-in reports on the javascript end, you may
want to use json_encode() instead of serialize().

if you plan to have many (say >5000) reports filled in and want users
to be able to search quickly on values or generate reports based on
searches, then you'd need an actual datamodel, so mysql can do the
searching, sorting and adding.

On Sat, Mar 13, 2010 at 7:55 PM, paragasu <parag...@gmail.com> wrote:
> On Sun, Mar 14, 2010 at 2:10 AM, tedd <tedd.sperl...@gmail.com> 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
>>
>>
> Hi Ted,
>
> How about saving the array in serialize variable to TEXT column
>
> $answer = serialize($_SESSION['answer']);
>
> to get the original array value simply unserialize the value from the
> database..
>
> Paragasu
>

--- End Message ---
--- Begin Message --- 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.sperl...@gmail.com> 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


--- End Message ---
--- Begin Message ---
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 <phps...@gmail.com> 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.sperl...@gmail.com> 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
>
>

--- End Message ---
--- Begin Message ---
Hi..

I'm building a newsscraper -> portal.
Fetching, parsing and storing many links to news items per hour was
not much of a problem.
Translations between languages can be done via google, so that wont be
much of a problem either i suspect.

I dont want to reveal too much of my business idea, but i do need to
do text-analysis, to group related items, and make "suggestions"
lists.
I've had a dabble with creating my own ontology structure (kinda like
a dictionary + thesaurus datamodel) by scraping existing ontology
websites, but needless to say natural text analysis is a huge field.
One that i'm a total noob in.

So in the first place, I'm looking for any free/paid useful existing
data-mining / text-analysis code that can be run easily from php.
TBH i dont even know my feature-requirements really, i'm interested to
know what's available.

In the second place, i'm looking for free and published-for-a-cost
data-mining / text-analysis papers/books that explain how to produce
useful results.

Thanks for your input.

--- End Message ---

Reply via email to