updating tables in MySQL

2004-02-25 Thread HACKATHORN, TODD (SWBT)
Hello,
Sorry if this is a obvious question, but I am new to mySQL, and PHP.  I am
used to working with MS SQL Server 2000 and coldfusion.  In SQL server I can
build DTS packages and schedule them to update the data in my tables with
different queries, and to import current data from other databases.  Is
there a way I can do this in mySQL?  I found how I can schedule scripts, but
am not sure how to go about making a script do queries, or how to import
data from a other data source.  I could write a script to insert each record
one at a time, but that seems like a lot of work.  I work with fairly large
tables.  I am new to both Linux, and mySQL, but do have a decent amount of
experience in other SQL system.  
 
I am using RedHat 9, mySQL Ver 12.22 Distrib 4.0.18, for pc-linux (i686).
 
Thanks in advance,
 
Todd 
 


Re: updating tables in MySQL

2004-02-25 Thread vpendleton
Are you using the DTS to schedule replication or periodic data imports?

 Original Message 

On 2/25/04, 11:48:02 AM, HACKATHORN, TODD (SWBT) [EMAIL PROTECTED] wrote 
regarding updating tables in MySQL:


 Hello,
 Sorry if this is a obvious question, but I am new to mySQL, and PHP.  I
 am
 used to working with MS SQL Server 2000 and coldfusion.  In SQL server I
 can
 build DTS packages and schedule them to update the data in my tables
 with
 different queries, and to import current data from other databases.  Is
 there a way I can do this in mySQL?  I found how I can schedule scripts,
 but
 am not sure how to go about making a script do queries, or how to import
 data from a other data source.  I could write a script to insert each
 record
 one at a time, but that seems like a lot of work.  I work with fairly
 large
 tables.  I am new to both Linux, and mySQL, but do have a decent amount
 of
 experience in other SQL system.

 I am using RedHat 9, mySQL Ver 12.22 Distrib 4.0.18, for pc-linux
 (i686).

 Thanks in advance,

 Todd

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: updating tables in MySQL

2004-02-25 Thread Sasha Pachev
HACKATHORN, TODD (SWBT) wrote:
Hello,
Sorry if this is a obvious question, but I am new to mySQL, and PHP.  I am
used to working with MS SQL Server 2000 and coldfusion.  In SQL server I can
build DTS packages and schedule them to update the data in my tables with
different queries, and to import current data from other databases.  Is
there a way I can do this in mySQL?  I found how I can schedule scripts, but
am not sure how to go about making a script do queries, or how to import
data from a other data source.  I could write a script to insert each record
one at a time, but that seems like a lot of work.  I work with fairly large
tables.  I am new to both Linux, and mySQL, but do have a decent amount of
experience in other SQL system.  
 
I am using RedHat 9, mySQL Ver 12.22 Distrib 4.0.18, for pc-linux (i686).
Todd:

MySQL does not have this ability. You can, however, accomplish this with 
command-line shell/Perl/PHP scripts run from cron (type man cron and man 
crontab to learn more, if you are not familiar with it).

--
Sasha Pachev
Create online surveys at http://www.surveyz.com/
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: updating tables

2003-01-24 Thread Fabrizio Tivano
Stefan, 

The problem look be solved;

i've just changed structure of the updatable table.
First this table have only 1 primary key, now my table have some indexed unique keys.

and now if i do a replace into command look's like to work fine.

I have just a question:

i need also to change structure of the master table (have only a primary key)  or 
the changes made on the updatable_table  are enough?


regards, 
fabrizio


On Fri, 24 Jan 2003 00:10:19 +0100
Stefan Hinz, iConnect \(Berlin\) [EMAIL PROTECTED] wrote:

 Fabrizio,
 
 please send the table structures of table_1 and table_2 (DESCRIBE ...)
 so we can do more for you than just guess what the problem might be.
 
 REPLACE seems good in the first place, but if it just INSERTs then
 there's a problem with the (primary) keys.
 
 Regards,
 --
   Stefan Hinz [EMAIL PROTECTED]
   Geschäftsführer / CEO iConnect GmbH http://iConnect.de
   Heesestr. 6, 12169 Berlin (Germany)
   Tel: +49 30 7970948-0  Fax: +49 30 7970948-3
 
 - Original Message -
 From: Fabrizio Tivano [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, January 23, 2003 5:22 PM
 Subject: updating tables
 
 
 
  hello dear all,
 
  i have a problem updating tables:
 
  in my queries i try to use REPLACE but  is same like INSERT command.
 
  ...i need only to refresh table_1 with  new entries from table_2.
 
  any ideas?
 
  TIA
   fabrizio
 
  -
  Before posting, please check:
 http://www.mysql.com/manual.php   (the manual)
 http://lists.mysql.com/   (the list archive)
 
  To request this thread, e-mail [EMAIL PROTECTED]
  To unsubscribe, e-mail
 [EMAIL PROTECTED]
  Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 


-- 
Fabrizio Tivano
WAN System Administrator
SAD Trasporto Locale S.p.a.
 Corso Italia 13/N
 39100 BOLZANO

 e-mail : [EMAIL PROTECTED]
 Tel: +390471450268
 Fax: +390471450253

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: updating tables

2003-01-24 Thread Stefan Hinz, iConnect \(Berlin\)
Fabrizio,

(still only guessing, as you did not post the table structures ...)

 i need also to change structure of the master table (have only a
primary key)  or
 the changes made on the updatable_table  are enough?

Your updatable_table needs to have a unique key (best is a primary
key), so REPLACE can tell whether it should INSERT a record (if there is
no unique key entry) or actually REPLACE an existing record (if there is
an entry with this key already).

Let's say you have tbl1 with your original data:

mysql SELECT * FROM tbl1;
++--+
| id | sometext |
++--+
|  1 | foo  |
|  2 | bar  |
|  3 | foofoo   |
|  4 | barbar   |
++--+
4 rows in set (0.00 sec)

Now, you have tbl2 with some data:

mysql SELECT * FROM tbl2;
++--+
| id | sometext |
++--+
|  3 | foofoo   |
|  4 | barbar   |
++--+
2 rows in set (0.00 sec)

'id' in tbl2 needs to be unique (in my case, it's the primary key), so
REPLACE will work as expected:

mysql REPLACE INTO tbl2 SELECT * FROM tbl1;
Query OK, 4 rows affected (0.00 sec)
Datensõtze: 4  Duplikate: 2  Warnungen: 0

Note that 4 records were affected, but there were 2 duplicates. The
records with id 3 and 4 were overwritten by the REPLACE statement. Now
tbl2 has these data:

mysql SELECT * FROM tbl2;
++--+
| id | sometext |
++--+
|  1 | foo  |
|  2 | bar  |
|  3 | foofoo   |
|  4 | barbar   |
++--+
4 rows in set (0.01 sec)

HTH,
--
  Stefan Hinz [EMAIL PROTECTED]
  Geschäftsführer / CEO iConnect GmbH http://iConnect.de
  Heesestr. 6, 12169 Berlin (Germany)
  Tel: +49 30 7970948-0  Fax: +49 30 7970948-3

- Original Message -
From: Fabrizio Tivano [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, January 24, 2003 10:50 AM
Subject: Re: updating tables


 Stefan,

 The problem look be solved;

 i've just changed structure of the updatable table.
 First this table have only 1 primary key, now my table have some
indexed unique keys.

 and now if i do a replace into command look's like to work fine.

 I have just a question:

 i need also to change structure of the master table (have only a
primary key)  or
 the changes made on the updatable_table  are enough?


 regards,
 fabrizio


 On Fri, 24 Jan 2003 00:10:19 +0100
 Stefan Hinz, iConnect \(Berlin\) [EMAIL PROTECTED] wrote:

  Fabrizio,
 
  please send the table structures of table_1 and table_2 (DESCRIBE
...)
  so we can do more for you than just guess what the problem might be.
 
  REPLACE seems good in the first place, but if it just INSERTs then
  there's a problem with the (primary) keys.
 
  Regards,
  --
Stefan Hinz [EMAIL PROTECTED]
Geschäftsführer / CEO iConnect GmbH http://iConnect.de
Heesestr. 6, 12169 Berlin (Germany)
Tel: +49 30 7970948-0  Fax: +49 30 7970948-3
 
  - Original Message -
  From: Fabrizio Tivano [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Thursday, January 23, 2003 5:22 PM
  Subject: updating tables
 
 
  
   hello dear all,
  
   i have a problem updating tables:
  
   in my queries i try to use REPLACE but  is same like INSERT
command.
  
   ...i need only to refresh table_1 with  new entries from table_2.
  
   any ideas?
  
   TIA
fabrizio
  
 
 -
   Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
  
   To request this thread, e-mail
[EMAIL PROTECTED]
   To unsubscribe, e-mail
  [EMAIL PROTECTED]
   Trouble unsubscribing? Try:
http://lists.mysql.com/php/unsubscribe.php
  
 
 

 -
  Before posting, please check:
 http://www.mysql.com/manual.php   (the manual)
 http://lists.mysql.com/   (the list archive)
 
  To request this thread, e-mail [EMAIL PROTECTED]
  To unsubscribe, e-mail
[EMAIL PROTECTED]
  Trouble unsubscribing? Try:
http://lists.mysql.com/php/unsubscribe.php
 


 --
 Fabrizio Tivano
 WAN System Administrator
 SAD Trasporto Locale S.p.a.
 Corso Italia 13/N
 39100 BOLZANO

 e-mail : [EMAIL PROTECTED]
 Tel: +390471450268
 Fax: +390471450253

 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




updating tables

2003-01-23 Thread Fabrizio Tivano

hello dear all, 

i have a problem updating tables:

in my queries i try to use REPLACE but  is same like INSERT command.

...i need only to refresh table_1 with  new entries from table_2.

any ideas?

TIA
 fabrizio

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: updating tables

2003-01-23 Thread Stefan Hinz, iConnect \(Berlin\)
Fabrizio,

please send the table structures of table_1 and table_2 (DESCRIBE ...)
so we can do more for you than just guess what the problem might be.

REPLACE seems good in the first place, but if it just INSERTs then
there's a problem with the (primary) keys.

Regards,
--
  Stefan Hinz [EMAIL PROTECTED]
  Geschäftsführer / CEO iConnect GmbH http://iConnect.de
  Heesestr. 6, 12169 Berlin (Germany)
  Tel: +49 30 7970948-0  Fax: +49 30 7970948-3

- Original Message -
From: Fabrizio Tivano [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 23, 2003 5:22 PM
Subject: updating tables



 hello dear all,

 i have a problem updating tables:

 in my queries i try to use REPLACE but  is same like INSERT command.

 ...i need only to refresh table_1 with  new entries from table_2.

 any ideas?

 TIA
  fabrizio

 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Not updating tables with data but no errors either

2002-01-17 Thread fla wire

Hello,
I have a freebsd machine running mysql and php.  Yes I am one of those
newbies.
I have read the FU*K manual. I have a sams learn in 21 day book. also a php
essentials and build your own database drive book. I have a brazilian rain
forest of manuals,printouts etc.

We have a php page that we put in people that belong to a football pool.
However it is not adding the data to the table. We do not get any error
messages either even tho the php page is setup to display the errors.
I find no errors in the http-errrors.log. the httpd-access.log shows the
post with no errors.
I have checked permissions and the seem right.
I can go to the machine and add a person by command line. Using the same
info as in the mysql_connect on the php page i can add from the
command line.

Any help, direction or clues is greatly appreciated.

mark





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Not updating tables with data but no errors either

2002-01-17 Thread Carsten H. Pedersen

 We have a php page that we put in people that belong to a football pool.
 However it is not adding the data to the table. We do not get any error
 messages either even tho the php page is setup to display the errors.
 I find no errors in the http-errrors.log. the httpd-access.log shows the
 post with no errors.

You're looking in the wrong logs. Find the hostname.err
file in the mysql data directory, and look through that.

You may also want to try using the update log
(mysqld --update_log=...). This will help you find
out if the requests do indeed make it to the server.

/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Not updating tables with data but no errors either

2002-01-17 Thread nod

On Thursday 17 Jan 2002 4:52 pm, fla wire wrote:
 Hello,
 I have a freebsd machine running mysql and php.  Yes I am one of those
 newbies.
 I have read the FU*K manual. I have a sams learn in 21 day book. also a php
 essentials and build your own database drive book. I have a brazilian rain
 forest of manuals,printouts etc.

 We have a php page that we put in people that belong to a football pool.
 However it is not adding the data to the table. We do not get any error
 messages either even tho the php page is setup to display the errors.
 I find no errors in the http-errrors.log. the httpd-access.log shows the
 post with no errors.
 I have checked permissions and the seem right.
 I can go to the machine and add a person by command line. Using the same
 info as in the mysql_connect on the php page i can add from the
 command line.

tried the mysql_error() function in php ? printed the connection variable to 
check you have a resource id ?



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Updating tables via cron

2002-01-04 Thread DL Neil

David,
Was this question addressed?

 I tried to search the archives for this but I can't find it.  (Not saying
 it isn't there just I could not find it.)  I have a table that tracks
 events on a monthly and daily basis.  Currently I am resetting the
 appropriate fields to 0 on a daily and monthly basis (not fun).  Is there a
 way to set a command in the cron table to do this for me
 automatically?  Here are the details.

 db name: activity
 daily field name: dr (needs to be reset to 0)
 monthly field name: mr (same as above)

 I know how to tell cron the date/time I want an event to trigger, but I
 don't know the syntax of the command to send.  Any help would be appreciated.

Cron will allow you to put together shell scripts and work in other ways to achieve 
this. Will leave details to
you/your system/your preferences.

MySQL has a batch mode. Once you know the terminology, a search of the manual will 
yield a ton of material.
Check out: 3.6  Using mysql in Batch Mode for
shell mysql  batch-file
(you will probably need to study this to work out a more sophisticated command line 
than that)
For example:
shell mysql database  script.sql  output.tab
which appears in section: 4.8.2  The Command-line Tool

The DuBois book discusses batch mode and gives a shell script example on p76.

Welling and Thomson discuss file redirection somewhat in passing on p195 and use it 
extensively, eg to set up
new db/tbl definitions (if they detail it elsewhere I've failed to note it).

Regards,
=dn



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Updating tables via cron

2002-01-04 Thread zb

Hi!

On Thu, 3 Jan 2002, Webmaster wrote:

   I tried to search the archives for this but I can't find it.  (Not saying 
 it isn't there just I could not find it.)  I have a table that tracks 
 events on a monthly and daily basis.  Currently I am resetting the 
 appropriate fields to 0 on a daily and monthly basis (not fun).  Is there a 
 way to set a command in the cron table to do this for me 
 automatically?  Here are the details.
 
 db name: activity
 daily field name: dr (needs to be reset to 0)
 monthly field name: mr (same as above)

test crontab entry:

* * * * * /usr/local/mysql/bin/mysql -e use activity; update table_name
set dr=0

Additionally the user of the cron should have a file ~/.my.cnf
to avoid giving the password in crontab:

snip file=~/.my.cnf
[client]
password=your_password
/snip

   I know how to tell cron the date/time I want an event to trigger, but I 
 don't know the syntax of the command to send.  Any help would be appreciated.

This one was easy :-)

 Thanks,
 David

HTH.

Regards, Zoltan


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Updating tables via cron

2002-01-03 Thread Webmaster

I tried to search the archives for this but I can't find it.  (Not saying 
it isn't there just I could not find it.)  I have a table that tracks 
events on a monthly and daily basis.  Currently I am resetting the 
appropriate fields to 0 on a daily and monthly basis (not fun).  Is there a 
way to set a command in the cron table to do this for me 
automatically?  Here are the details.

db name: activity
daily field name: dr (needs to be reset to 0)
monthly field name: mr (same as above)


I know how to tell cron the date/time I want an event to trigger, but I 
don't know the syntax of the command to send.  Any help would be appreciated.


Thanks,
David



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Updating tables via cron

2002-01-03 Thread Land, Christopher

Here is a select statement, as example:

mysql -e select * from user \G mysql

Add user and password as required.

Xi2 ('sE-'tü)


-Original Message-
From: Webmaster [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 03, 2002 8:57 AM
To: [EMAIL PROTECTED]
Subject: Updating tables via cron


I tried to search the archives for this but I can't find it.  (Not
saying 
it isn't there just I could not find it.)  I have a table that tracks 
events on a monthly and daily basis.  Currently I am resetting the 
appropriate fields to 0 on a daily and monthly basis (not fun).  Is there a 
way to set a command in the cron table to do this for me 
automatically?  Here are the details.

db name: activity
daily field name: dr (needs to be reset to 0)
monthly field name: mr (same as above)


I know how to tell cron the date/time I want an event to trigger,
but I 
don't know the syntax of the command to send.  Any help would be
appreciated.


Thanks,
David



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Updating tables via cron

2002-01-03 Thread Gary . Every

Try this:

echo REPLACE INTO table_name (dr) VALUES ('0'); |
/usr/local/mysql/bin/mysql -u user -p password activity

or mysql -e REPLACE INTO table_name (dr) VALUES ('0'); activity

-Original Message-
From: Webmaster [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 03, 2002 10:57 AM
To: [EMAIL PROTECTED]
Subject: Updating tables via cron


I tried to search the archives for this but I can't find it.  (Not
saying 
it isn't there just I could not find it.)  I have a table that tracks 
events on a monthly and daily basis.  Currently I am resetting the 
appropriate fields to 0 on a daily and monthly basis (not fun).  Is there a 
way to set a command in the cron table to do this for me 
automatically?  Here are the details.

db name: activity
daily field name: dr (needs to be reset to 0)
monthly field name: mr (same as above)


I know how to tell cron the date/time I want an event to trigger,
but I 
don't know the syntax of the command to send.  Any help would be
appreciated.


Thanks,
David



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re[2]: updating tables

2001-07-02 Thread Werner Stuerenburg

Hi noelt,


 i mean, the value of the duration field will be transferred or
 copied to the consumed field w/c is in a diff. table.

So these are just some fields like column1 and column2 - nothing
to do with duration of the process itself.

The following is in php and uses class db_mysql - there are
numerous other ways to do it, just to show you how I would do it:

$db = newDB($db);
//connect to database

$q = SELECT * FROM table 1
WHERE key1 = 'value1';
//state query, try insert
$db-query($q);
//perform query
if ($db-nf()){//success
$db-next_record();//get record
$field1 = $db-f('field1');//extract field
}
//now look at the other table
$q = INSERT INTO table2
(col1, col2, col3) //and so on
VALUES ('$field1', '$field2', '$field3');
//state query
$db-query($q);
//perform query
if ($db-Errno){//entry already there
$q = UPDATE table2
SET val1 = '$field1',
val2 = '$field2',
val3 = '$field3',
WHERE key2 = '$field1';//assuming that this is a key element
//do an update instead
$db-query($q);
}

 perl? can you elaborate more on this, i mean i know perl but can you give me more 
ideas...

Personally, I prefer php to perl, but it is a matter of taste and
experience. There is an entertaining article entitled MySQL Wizardry
at address

 http://mysql.com/articles/wizard/

which shows how to work with databases and perl. Highly
recommended.

-- 
Herzlich
Werner Stuerenburg

_
ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen
Tel 0(049) 5224-997 407 · Fax 0(049) 5224-997 409
http://pferdezeitung.de



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Re[2]: updating tables

2001-07-02 Thread Radius Newbies

Hi Werner,
 
--

On Mon, 2 Jul 2001 15:59:19Werner Stuerenburg wrote:
Hi noelt,


 i mean, the value of the duration field will be transferred or
 copied to the consumed field w/c is in a diff. table.

So these are just some fields like column1 and column2 - nothing
to do with duration of the process itself.

yes your right.


The following is in php and uses class db_mysql - there are
numerous other ways to do it, just to show you how I would do it:

$db = newDB($db);
//connect to database

$q = SELECT * FROM table 1
WHERE key1 = 'value1';
//state query, try insert
$db-query($q);
//perform query
if ($db-nf()){//success
$db-next_record();//get record
$field1 = $db-f('field1');//extract field
}
//now look at the other table
$q = INSERT INTO table2
(col1, col2, col3) //and so on
VALUES ('$field1', '$field2', '$field3');
//state query
$db-query($q);
//perform query
if ($db-Errno){//entry already there
$q = UPDATE table2
SET val1 = '$field1',
val2 = '$field2',
val3 = '$field3',
WHERE key2 = '$field1';//assuming that this is a key element
//do an update instead
$db-query($q);
}


this is good. many thanks...

 perl? can you elaborate more on this, i mean i know perl but can you give me more 
ideas...

Personally, I prefer php to perl, but it is a matter of taste and
experience. There is an entertaining article entitled MySQL Wizardry
at address

same with you, i prefer php rather than perl. 


 http://mysql.com/articles/wizard/

which shows how to work with databases and perl. Highly
recommended.

many thanks Werner!


-- 
Herzlich
Werner Stuerenburg

_
ISIS Verlag, Teut 3, D-32683 Barntrup-Alverdissen
Tel 0(049) 5224-997 407 7 Fax 0(049) 5224-997 409
http://pferdezeitung.de





Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at 
http://www.eudoramail.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




updating tables

2001-07-01 Thread Radius Newbies

Hello All!

I am just starting to learn mysql so forgive if i sound so beginner here.

I have 2 tables, table1 and table2. At table1, i have username and consumed 
field_names. at table2, i have username and duration fieldname.

I need to put the value of duration to consumed. How will I do that?

both tables belong to 1 database.

I did search the manual and I can't find anything. do i need to use join command 
here?
 
pls tell me the exact keyword or commands...

Another thing, Is msql(Microsoft SQL) is compatible to MYsql?

Can you recommend me good sites for mysql. I did search and it's always for beginners.


many thanks...

noelt.


Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at 
http://www.eudoramail.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php