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

2010-03-13 Thread Jochem Maas
Hi Tedd,

just a few thoughts that might help ...

Op 3/13/10 6:10 PM, tedd schreef:
> 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.

first off - wasn't there a cut'n'dried piece of survey software out there
that did the job? don't know off hand what the 'market' currently offers but
I'm pretty sure there are a number of candidate php-based wotsits.

as such they might be worth looking at just to check out their data models.

> 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.

what happens when 2 people vote at the same time?

> 
> 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, ,

that would make life very difficult if you wanted to use the

> Then I thought I might make the data xml, such as:
> 
> 11268501271116Four
> score and ...

doesn't seem like XML is the answer at all. isn't it Larry Garfield with the
sig line that says:

Sometime a programmer has a problem and thinks "I know I'll use XML",
now he has 2 problems.

:)

> 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.

is there only ever going to be one survey of which the questions/structure
is now fixed/definitive?

if so I'd probably opt for the simple approach of a table
with 180 columns purely because that would make for the easiest
reporting queries (no self-referencing joins needed to answer the
question posed below ... which would be the case if you normalized
the data to one row per question+answer+vote[r])

... although possibly not speediest in terms of SQL performance
(you'd have to be careful with creating lots of indexes because that
would affect insert performance)

basically one table with 180 answer columns and an addition primary [voter?] 
key,
possibly also a survey id if your going to be repeating the survey over time.

a more normalized approach would be to define all the questions and their
answer types in one table, surveys in another, with answers per qestion in 
another:

survey table:
id  INT (PK)
nameVARCHAR
dateTIMESTAMP

questions table:
id  INT (PK)
positionINT - order of questions
survey_id   INT
questionVARCHAR/TEXT
question_type   ENUM?

voters  table:
id  INT (PK)
nameVARCHAR ??

answers tables:
id  INT (PK)
voter_idINT
question_id INT
answer  ?

with the answer values in the answers table you might consider a field for
each question_type you define so that you can use a proper data type - this
would be somewhat denormalized because you'd only ever use one of those fields
per row but it might come in handy.



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



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

2010-03-13 Thread Paul M Foster
On Sat, Mar 13, 2010 at 09:04:46PM +0100, Rene Veerman wrote:



> 
> 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.
> 



> 
> 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..

Tedd's perfectly capable of speaking for himself, but I can tell you
he's been on this list for a long time, and his skills are plenty
adequate for this task. He's just asking for second opinions.

Paul

-- 
Paul M. Foster

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



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

2010-03-13 Thread Paul M Foster
On Sat, Mar 13, 2010 at 02:45:37PM -0500, Phpster 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.
>

+1

I invariably find that the original design for a project needs to be
tweaked. The customer wants to add or delete questions, they want to
add/change reports for the data. So I nearly always approach this kind
of project this way. Maybe:

vote table:

id  serial/sequence not null primary key
voter_idint references voters (voter_id)
question_id varchar(10)
answer  varchar(10)

You can easily subset by voter, or by question ID. Or analyze answers in
relation to other answers, etc.

Paul

-- 
Paul M. Foster

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



RE: [PHP] Migration Scheme - from one mysql DB to another mysql DB

2010-03-13 Thread MEM
> 
> 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)
> 


Thank you all for your replies. 

I will leave you with more details, but, I believe the "single query
approach with two PDO (or mysqli) connections should be quite well. Both DB
are on the same server, Linux based one, but different dsn should apply. 
The bandwith cost will not be an issue, because we are talking about 15MB of
data, or something similar. 

I don't have admin rights but I can try to have them if I must to.
I believe this will be a single time, or, one in a long time run but, we can
never predict. 

The destination table also has some random data filled fields that I need to
generate and introduce with the old data on this new database.


Wondering if mySQL Migration Toolkit can do the job?


Thanks a lot for your help,
Márcio



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



[PHP] natural text / human text analysis

2010-03-13 Thread Rene Veerman
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.

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



Re: [PHP] Migration Scheme - from one mysql DB to another mysql DB

2010-03-13 Thread Rene Veerman
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  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
>
>

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



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

2010-03-13 Thread Rene Veerman
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  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  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:
>>
>>
>> 11268501271116Four
>> score and ...
>>
>> 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



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

2010-03-13 Thread Phpster
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  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:

112685012711e1>16Four score and ...


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



Re: [PHP] Migration Scheme - from one mysql DB to another mysql DB

2010-03-13 Thread Phpster
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   
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



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



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

2010-03-13 Thread Rene Veerman
+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  wrote:
> On Sun, Mar 14, 2010 at 2:10 AM, tedd  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:
>>
>> 11268501271116Four
>> score and ...
>>
>> 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
>

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



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

2010-03-13 Thread paragasu
On Sun, Mar 14, 2010 at 2:10 AM, tedd  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:
>
> 11268501271116Four
> score and ...
>
> 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


[PHP] I need a fresh look at storing variables in MySQL

2010-03-13 Thread tedd

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:

11268501271116Four 
score and ...


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



Re: [PHP] Migration Scheme - from one mysql DB to another mysql DB

2010-03-13 Thread Robert Cummings

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



Re: [PHP] Migration Scheme - from one mysql DB to another mysql DB

2010-03-13 Thread Teus Benschop
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.

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



Re: [PHP] Migration Scheme - from one mysql DB to another mysql DB

2010-03-13 Thread Per Jessen
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)


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



Re: [PHP] Re: PHP in HTML code

2010-03-13 Thread Jorge Gomes
First of all, i recommend the use of normal php tags () because
the short tags are atm marked as* **DEPRECATED*.

You should also echo your values to the page, instead using the shortcut 







remember that between tags, we have normal php code.

Rewards
___
Jorge Gomes


2010/3/13 David Robley 

> 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:
> >
> > 
> >   >  align="left">
> >  
> >
> > This PHP code doesn't print in the HTML page.
> >
> > PHP within form field:
> >
> >  > readonly="">
> >
> > This PHP code shows on the page when it shouldn't. The same variable is
> an
> > input and an output in this form:
> >
> > 
> 
> >
> > Are there times when the 
> 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
>
>


[PHP] Migration Scheme - from one mysql DB to another mysql DB

2010-03-13 Thread MEM
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



Re: Re[2]: [PHP] Re: PHP Sessions

2010-03-13 Thread Ashley Sheridan
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




Re[2]: [PHP] Re: PHP Sessions

2010-03-13 Thread Andre Polykanine
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 
To: Andre Polykanine 
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):
>  «»
> 
>  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 
> To: php-general@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.
> 
> 
>  
>  
> 
> 
>   align="right">
>  
> 
> Thank you.
> 
> 
> Martine
> 
> ""Martine Osias""  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):
> >
> >  >
> > session_start();
> >
> > $_SESSION['scripture_text']  = $row_scripture['ScriptureText'];
> > $_SESSION['scripture_ref']  = $row_scripture['ScriptureRef'];
> >
> > ?>
> >
> > Page 2 (variables retrieved):
> >
> >  > session_start();
> > include("includes/config.php");
> > ?>
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > http://www.w3.org/1999/xhtml";>
> > 
> > 
> > 
> >
> > 
> >
> > 
> > 
> > 
> >
> > 
> >  > align="right">
> > 
> >
> > 
> >
> > 
> > 
> >
> > 
> 
> 
> -- 
> 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




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



Re: [PHP] Re: PHP Sessions

2010-03-13 Thread Ashley Sheridan
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):
>  «»
> 
>  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 
> To: php-general@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.
> 
> 
>  
>  
> 
> 
>   align="right">
>  
> 
> Thank you.
> 
> 
> Martine
> 
> ""Martine Osias""  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):
> >
> >  >
> > session_start();
> >
> > $_SESSION['scripture_text']  = $row_scripture['ScriptureText'];
> > $_SESSION['scripture_ref']  = $row_scripture['ScriptureRef'];
> >
> > ?>
> >
> > Page 2 (variables retrieved):
> >
> >  > session_start();
> > include("includes/config.php");
> > ?>
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > http://www.w3.org/1999/xhtml";>
> > 
> > 
> > 
> >
> > 
> >
> > 
> > 
> > 
> >
> > 
> >  > align="right">
> > 
> >
> > 
> >
> > 
> > 
> >
> > 
> 
> 
> -- 
> 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




Re: [PHP] Re: PHP Sessions

2010-03-13 Thread Andre Polykanine
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):
 «»

 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 
To: php-general@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.


 
 


 
 

Thank you.


Martine

""Martine Osias""  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):
>
> 
> session_start();
>
> $_SESSION['scripture_text']  = $row_scripture['ScriptureText'];
> $_SESSION['scripture_ref']  = $row_scripture['ScriptureRef'];
>
> ?>
>
> Page 2 (variables retrieved):
>
>  session_start();
> include("includes/config.php");
> ?>
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> http://www.w3.org/1999/xhtml";>
> 
> 
> 
>
> 
>
> 
> 
> 
>
> 
>  align="right">
> 
>
> 
>
> 
> 
>
> 


-- 
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



Re: [PHP] Re: PHP Sessions

2010-03-13 Thread Ashley Sheridan
On Fri, 2010-03-12 at 21:33 -0500, Martine Osias wrote:

> The sessions variables are OK. They don't print when I put them on the HTML 
> page with this code.
> 
> 
>  
>  
> 
> 
>   align="right">
>  
> 
> Thank you.
> 
> 
> Martine
> 
> ""Martine Osias""  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):
> >
> >  >
> > session_start();
> >
> > $_SESSION['scripture_text']  = $row_scripture['ScriptureText'];
> > $_SESSION['scripture_ref']  = $row_scripture['ScriptureRef'];
> >
> > ?>
> >
> > Page 2 (variables retrieved):
> >
> >  > session_start();
> > include("includes/config.php");
> > ?>
> >  > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > http://www.w3.org/1999/xhtml";>
> > 
> > 
> > 
> >
> > 
> >
> > 
> > 
> > 
> >
> > 
> >  > align="right">
> > 
> >
> > 
> >
> > 
> > 
> >
> > 
> 
> 


Don't use 

Short tags end up causing more problems than they solve sometimes...

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