Re: [PHP-DB] Javascript

2002-10-11 Thread Ignatius Reilly

Thanks for the tip.

Well,
my problem came from that parseInt() did not do the expected job. Like in:
field1 = parseInt( thisform.field1.value ) + parseInt(
thisform.field2.value ) ;

If you happen to know the reason, I would love to know.

Ignatius

- Original Message -
From: "Simon Taylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 11, 2002 4:03 PM
Subject: RE: [PHP-DB] Javascript


> The reason for this is these fields are regarded as text and unless you
> specify number(variable) it may treat it as text.. When
> Field1='0'
> Field2='1'
> Field3='2'
>
> Field1+Field2+Field3 = '012'
>
> If you use
> Field1=Number('0')
> Field2=Number('1')
> Field3=Number('2')
>
> Field1+field2+field3 = 3
>
> Cheers
> Simon
>
> -Original Message-
> From: Ignatius Reilly [mailto:[EMAIL PROTECTED]]
> Sent: 11 October 2002 15:48
> To: Shahmat Dahlan; [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] Javascript
>
>
> I have met this problem before.
>
> The only solution I have found is to assign "0" values to the INPUT tags:
> 
>
> HTH
> Ignatius
> 
> - Original Message -
> From: "Shahmat Dahlan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 11, 2002 11:34 AM
> Subject: [PHP-DB] Javascript
>
>
> > My question might have anything to do with PHP but I have the
> > following
> > scenario:
> >
> > Say I have four fields
> > field1 : 
> > field2 : 
> > field3 : 
> > field4 : 
> >
> > And a total sum field, which is a total sum of the value of the
> > expression, totalsum = field1 + field2 + field3 + field4
> > Total sum : XXX
> >
> > You would need to use Javascript to extract the value of field1,
> > field2,
> > field3, field4, initiated by the Javascript onChange event.
> >
> > The HTML codes should look like this:
> > 
> > 
> > 
> > 
> > 
> >
> > So the add function snippet that I have:
> >
> > function add()
> > {
> > var thisform=document.forms[0];
> > var field1=thisform.field1.value;
> > var field2=thisform.field2.value;
> > var field3=thisform.field3.value;
> > var field4=thisform.field4.value;
> > var totalqty=field1+field2+field3+field4;
> > thisform.totalsum.value=totalqty;
> > }
> >
> > But all I got is a NaN which means Not A Number. I understand that you
> > solve this by using the parseInt Javascript function.
> > But still all i get is a NaN value.
> >
> > Would appreciate if someone could help me out on this.
> >
> > Regards
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


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




[PHP-DB] R: [PHP-DB] Javascript

2002-10-11 Thread Riccardi Moreno

Try this:

The HTML codes should look like this:






function add() {
  var total = 0;
  var thisform = document.forms[0];
  for (i=0;i<=thisform.elements["field[]"].length;i++) {
if (!isNaN(thisform.elements["field[]"].value) total +=
thisform.elements["field[]"].value;
  }
  thisform.totalsum.value=total;
}

-Messaggio originale-
Da: Shahmat Dahlan [mailto:[EMAIL PROTECTED]]
Inviato: venerdi 11 ottobre 2002 11.35
A: [EMAIL PROTECTED]
Oggetto: [PHP-DB] Javascript


My question might have anything to do with PHP but I have the following
scenario:

Say I have four fields
field1 : 
field2 : 
field3 : 
field4 : 

And a total sum field, which is a total sum of the value of the
expression, totalsum = field1 + field2 + field3 + field4
Total sum : XXX

You would need to use Javascript to extract the value of field1, field2,
field3, field4, initiated by the Javascript onChange event.

The HTML codes should look like this:






So the add function snippet that I have:

function add()
{
var thisform=document.forms[0];
var field1=thisform.field1.value;
var field2=thisform.field2.value;
var field3=thisform.field3.value;
var field4=thisform.field4.value;
var totalqty=field1+field2+field3+field4;
thisform.totalsum.value=totalqty;
}

But all I got is a NaN which means Not A Number. I understand that you
solve this by using the parseInt Javascript function.
But still all i get is a NaN value.

Would appreciate if someone could help me out on this.

Regards


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



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




RE: [PHP-DB] easier way to do this? (time interval)

2002-10-11 Thread John W. Holmes

I don't think this would work. You're asking for rows where the date is
greater than 24 hours ago, and the hour is greater than seven. So, if
it's 8 am in the morning, you'll get results from 8 am yesterday until
midnight, then from 7 am today until 8 am today. You'll miss the rows
from midnight until 7 am, right? Or is my logic wrong?

---John Holmes...

> -Original Message-
> From: Thomas Lamy [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 11, 2002 7:25 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-DB] easier way to do this? (time interval)
> 
> Hi,
> 
> convert your date to UNIX_TIMESTAMP, which is number of seconds since
> 1.1.1970, and you can use simple math, as in
> 
>   $query=mysql_query("
> SELECT dtg
> FROM techs
> WHERE
>   tech='$user'
> AND
>   UNIX_TIMESTAMP(dtg) > UNIX_TIMESTAMP(NOW()) - 86400
> AND
>   HOUR(dtg)>=7
>   ");
> ... where 86400 = 24 hours (in seconds)
> 
> See 
> 
> 
> Thomas
> 
> 
> > -Ursprüngliche Nachricht-
> > Von: Thoenen, Peter Mr. EPS
> > [mailto:[EMAIL PROTECTED]]
> > Gesendet: Freitag, 11. Oktober 2002 06:34
> > An: [EMAIL PROTECTED]
> > Betreff: [PHP-DB] easier way to do this? (time interval)
> >
> >
> > Hello,
> >
> > Curious if there is an easier way to do this (using just SQL
> > and not PHP).
> > SQL seems powerful enough to do this but can't think of the
> > synatx.  Note, I
> > am using MySQL so no sub-selects (or other useful items).
> > Basically trying
> > to pull all records for a 24 hour period but instead of ->2400,
> > 0700->0700 (next day).
> >
> > if (date("H")>7){
> >
> >   $query=mysql_query("
> > SELECT dtg
> > FROM techs
> > WHERE
> >   tech='$user'
> > AND
> >   DAYOFMONTH(NOW())=DAYOFMONTH(dtg)
> > AND
> >   HOUR(dtg)>=7
> >   ");
> >
> > } else {
> >
> >   $query=mysql_query("
> > SELECT dtg
> > FROM techs
> > WHERE
> >   tech='$user'
> > AND
> > (
> >   (DAYOFMONTH(NOW())=DAYOFMONTH(dtg) AND HOUR(dtg)<7)
> >   OR
> >   ((DAYOFMONTH(NOW())-1)=DAYOFMONTH(dtg) AND HOUR(dtg)>=7)
> > )
> >   ");
> >
> > }
> >
> > Cheers,
> >
> > -peter
> >
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




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




RE: [PHP-DB] easier way to do this? (time interval)

2002-10-11 Thread John W. Holmes

if(date("H")<7))
{
  $var1 = 1;
  $var2 = 0;
}
else
{
  $var1 = 0;
  $var2 = 1;
}

Then use this query:

SELECT dtg FROM techs WHERE tech='$user' AND (TO_DAYS(dtg) =
TO_DAYS(CURRENT_DATE) - $var1 DAY AND HOUR(dtg) > 7) AND (TO_DAYS(dtg) =
TO_DAYS(CURRENT_DATE) + $var2 DAY AND HOUR(dtg) < 7)

I _think_ that works, but don't have a table to test it on. Let me know
if it does. If it's before 7 am, it'll get all records between 7 am
yesterday and 7 am today. If it's after 7 am, it'll get all records
between 7 am today and 7 am tomorrow.

---John Holmes...


> -Original Message-
> From: Thoenen, Peter Mr. EPS
> [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 11, 2002 12:34 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] easier way to do this? (time interval)
> 
> Hello,
> 
> Curious if there is an easier way to do this (using just SQL and not
PHP).
> SQL seems powerful enough to do this but can't think of the synatx.
Note,
> I
> am using MySQL so no sub-selects (or other useful items).  Basically
> trying
> to pull all records for a 24 hour period but instead of ->2400,
> 0700->0700 (next day).
> 
> if (date("H")>7){
> 
>   $query=mysql_query("
> SELECT dtg
> FROM techs
> WHERE
>   tech='$user'
> AND
>   DAYOFMONTH(NOW())=DAYOFMONTH(dtg)
> AND
>   HOUR(dtg)>=7
>   ");
> 
> } else {
> 
>   $query=mysql_query("
> SELECT dtg
> FROM techs
> WHERE
>   tech='$user'
> AND
> (
>   (DAYOFMONTH(NOW())=DAYOFMONTH(dtg) AND HOUR(dtg)<7)
>   OR
>   ((DAYOFMONTH(NOW())-1)=DAYOFMONTH(dtg) AND HOUR(dtg)>=7)
> )
>   ");
> 
> }
> 
> Cheers,
> 
> -peter
> 
> ##
> Peter Thoenen - Systems Programmer
> Commercial Communications
> Camp Bondsteel, Kosovo
> ##
> 
> "Stumbled Upon"...heh (Score:5, Funny) /.
> by $carab on 23:00 23 August 2002 (#4131637)
> 
> "ForensicTec officials said they stumbled upon the military networks
about
> two months ago, while checking on network security for a
private-sector
> client."
> 
> Someone new to a Dvorak probably tried to type in "lynx
> http://www.google.com"; but instead got "nmap -v -p 1-1024 -sS -P0
army.mil
> -T paranoid".
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




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




RE: [PHP-DB] Selecting PASSWORD() value in MySQL

2002-10-11 Thread Tim Haak

The query didn't return any rows when the only row in the table matched the criteria.  
Someone else suggested adjusting the field width in the table which worked.  I didn't 
think the PASSWORD() function added that many additional characters (5 character 
password resulted in a string longer than 15).  The stored string's end was 
concatenated.  I found that in my example it made the string 4 times as long.

Thanks!

Tim Haak

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 10, 2002 7:17 PM
To: Tim Haak; [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Selecting PASSWORD() value in MySQL


> I'm trying to retrieve data from a MySQL table which contains data
> encrypted with the MySQL "PASSWORD()" function from a PHP script but I
> can't seem to get it to work.  Below is the query I'm trying:
> 
> SELECT * FROM user_data WHERE username = 'thaak' AND password =
> PASSWORD('thaak');
> 
> I then tried the following subquery/subselect:
> 
> SELECT * FROM user_data WHERE username = 'thaak' AND password IN
(SELECT
> PASSWORD('thaak') FROM user_data);
> 
> ...which also didn't work.

How do you know it "didn't work"? The first query is what you want to
use. If you are using PHP variables, make sure they actually have the
values you expect in them.

---John Holmes...



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




Re: [PHP-DB] easier way to do this? (time interval)

2002-10-11 Thread Thomas Lamy

Hi,

convert your date to UNIX_TIMESTAMP, which is number of seconds since
1.1.1970, and you can use simple math, as in

  $query=mysql_query("
SELECT dtg 
FROM techs 
WHERE 
  tech='$user'
AND
  UNIX_TIMESTAMP(dtg) > UNIX_TIMESTAMP(NOW()) - 86400 
AND
  HOUR(dtg)>=7
  ");
... where 86400 = 24 hours (in seconds)

See 


Thomas


> -Ursprüngliche Nachricht-
> Von: Thoenen, Peter Mr. EPS
> [mailto:[EMAIL PROTECTED]]
> Gesendet: Freitag, 11. Oktober 2002 06:34
> An: [EMAIL PROTECTED]
> Betreff: [PHP-DB] easier way to do this? (time interval)
> 
> 
> Hello,
> 
> Curious if there is an easier way to do this (using just SQL 
> and not PHP).
> SQL seems powerful enough to do this but can't think of the 
> synatx.  Note, I
> am using MySQL so no sub-selects (or other useful items).  
> Basically trying
> to pull all records for a 24 hour period but instead of ->2400,
> 0700->0700 (next day).
> 
> if (date("H")>7){
> 
>   $query=mysql_query("
> SELECT dtg 
> FROM techs 
> WHERE 
>   tech='$user'
> AND
>   DAYOFMONTH(NOW())=DAYOFMONTH(dtg)
> AND
>   HOUR(dtg)>=7
>   ");
> 
> } else {
> 
>   $query=mysql_query("
> SELECT dtg 
> FROM techs 
> WHERE 
>   tech='$user' 
> AND 
> (
>   (DAYOFMONTH(NOW())=DAYOFMONTH(dtg) AND HOUR(dtg)<7)
>   OR
>   ((DAYOFMONTH(NOW())-1)=DAYOFMONTH(dtg) AND HOUR(dtg)>=7)
> )
>   ");
> 
> }
> 
> Cheers,
> 
> -peter
> 

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




RE: [PHP-DB] Selecting PASSWORD() value in MySQL

2002-10-11 Thread John W. Holmes

PASSWORD() always returns a string that's 16 characters long.

---John Holmes...

> -Original Message-
> From: Tim Haak [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 11, 2002 8:05 AM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Selecting PASSWORD() value in MySQL
> 
> The query didn't return any rows when the only row in the table
matched
> the criteria.  Someone else suggested adjusting the field width in the
> table which worked.  I didn't think the PASSWORD() function added that
> many additional characters (5 character password resulted in a string
> longer than 15).  The stored string's end was concatenated.  I found
that
> in my example it made the string 4 times as long.
> 
> Thanks!
> 
> Tim Haak
> 
> -Original Message-
> From: John W. Holmes [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, October 10, 2002 7:17 PM
> To: Tim Haak; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Selecting PASSWORD() value in MySQL
> 
> 
> > I'm trying to retrieve data from a MySQL table which contains data
> > encrypted with the MySQL "PASSWORD()" function from a PHP script but
I
> > can't seem to get it to work.  Below is the query I'm trying:
> >
> > SELECT * FROM user_data WHERE username = 'thaak' AND password =
> > PASSWORD('thaak');
> >
> > I then tried the following subquery/subselect:
> >
> > SELECT * FROM user_data WHERE username = 'thaak' AND password IN
> (SELECT
> > PASSWORD('thaak') FROM user_data);
> >
> > ...which also didn't work.
> 
> How do you know it "didn't work"? The first query is what you want to
> use. If you are using PHP variables, make sure they actually have the
> values you expect in them.
> 
> ---John Holmes...
> 
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




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




Re: [PHP-DB] Javascript

2002-10-11 Thread Ignatius Reilly

I have met this problem before.

The only solution I have found is to assign "0" values to the INPUT tags:


HTH
Ignatius

- Original Message - 
From: "Shahmat Dahlan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 11, 2002 11:34 AM
Subject: [PHP-DB] Javascript


> My question might have anything to do with PHP but I have the following 
> scenario:
> 
> Say I have four fields
> field1 : 
> field2 : 
> field3 : 
> field4 : 
> 
> And a total sum field, which is a total sum of the value of the 
> expression, totalsum = field1 + field2 + field3 + field4
> Total sum : XXX
> 
> You would need to use Javascript to extract the value of field1, field2, 
> field3, field4, initiated by the Javascript onChange event.
> 
> The HTML codes should look like this:
> 
> 
> 
> 
> 
> 
> So the add function snippet that I have:
> 
> function add()
> {
> var thisform=document.forms[0];
> var field1=thisform.field1.value;
> var field2=thisform.field2.value;
> var field3=thisform.field3.value;
> var field4=thisform.field4.value;
> var totalqty=field1+field2+field3+field4;
> thisform.totalsum.value=totalqty;
> }
> 
> But all I got is a NaN which means Not A Number. I understand that you 
> solve this by using the parseInt Javascript function.
> But still all i get is a NaN value.
> 
> Would appreciate if someone could help me out on this.
> 
> Regards
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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




Re: [PHP-DB] R: [PHP-DB] Javascript

2002-10-11 Thread Shahmat Dahlan

I will try your method.

I have found a way to solved this problem of mine.
I have four fields I may or may not choose to fill up one out of the four
fields, or I might filled up all of them.
So when I leave one or two fields empty, and add all the value up, I will
get NaN.
For those empty fields, it would be better to check and see whether it is
blank, e.g. if (field1 == '') { field=0; }
And then add them all up from there.

Riccardi Moreno wrote:

> Try this:
>
> The HTML codes should look like this:
> 
> 
> 
> 
> 
>
> function add() {
>   var total = 0;
>   var thisform = document.forms[0];
>   for (i=0;i<=thisform.elements["field[]"].length;i++) {
> if (!isNaN(thisform.elements["field[]"].value) total +=
> thisform.elements["field[]"].value;
>   }
>   thisform.totalsum.value=total;
> }
>
> -Messaggio originale-
> Da: Shahmat Dahlan [mailto:[EMAIL PROTECTED]]
> Inviato: venerdi 11 ottobre 2002 11.35
> A: [EMAIL PROTECTED]
> Oggetto: [PHP-DB] Javascript
>
> My question might have anything to do with PHP but I have the following
> scenario:
>
> Say I have four fields
> field1 : 
> field2 : 
> field3 : 
> field4 : 
>
> And a total sum field, which is a total sum of the value of the
> expression, totalsum = field1 + field2 + field3 + field4
> Total sum : XXX
>
> You would need to use Javascript to extract the value of field1, field2,
> field3, field4, initiated by the Javascript onChange event.
>
> The HTML codes should look like this:
> 
> 
> 
> 
> 
>
> So the add function snippet that I have:
>
> function add()
> {
> var thisform=document.forms[0];
> var field1=thisform.field1.value;
> var field2=thisform.field2.value;
> var field3=thisform.field3.value;
> var field4=thisform.field4.value;
> var totalqty=field1+field2+field3+field4;
> thisform.totalsum.value=totalqty;
> }
>
> But all I got is a NaN which means Not A Number. I understand that you
> solve this by using the parseInt Javascript function.
> But still all i get is a NaN value.
>
> Would appreciate if someone could help me out on this.
>
> Regards
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



smime.p7s
Description: S/MIME Cryptographic Signature


RE: [PHP-DB] Re: easier way to do this? (time interval)

2002-10-11 Thread Snijders, Mark


maybe i dont get the question, 

but for all records for the last 24 hours (1 day) i use:

this is an insteresting page:

http://www.mysql.com/doc/en/Date_and_time_functions.html


i says:

Here is an example that uses date functions. The following query selects all
records with a date_col value from within the last 30 days: 

mysql> SELECT something FROM tbl_name
   WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;


so for 24 hours... change the 30 in 1 :)   is this what you mean?

bye,

mark snijders




-Original Message-
From: David Robley [mailto:[EMAIL PROTECTED]]
Sent: vrijdag 11 oktober 2002 12:23
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Re: easier way to do this? (time interval)


In article 
<[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] says...
> Hello,
> 
> Curious if there is an easier way to do this (using just SQL and not PHP).
> SQL seems powerful enough to do this but can't think of the synatx.  Note,
I
> am using MySQL so no sub-selects (or other useful items).  Basically
trying
> to pull all records for a 24 hour period but instead of ->2400,
> 0700->0700 (next day).
> 
> if (date("H")>7){
> 
>   $query=mysql_query("
> SELECT dtg 
> FROM techs 
> WHERE 
>   tech='$user'
> AND
>   DAYOFMONTH(NOW())=DAYOFMONTH(dtg)
> AND
>   HOUR(dtg)>=7
>   ");
> 
> } else {
> 
>   $query=mysql_query("
> SELECT dtg 
> FROM techs 
> WHERE 
>   tech='$user' 
> AND 
> (
>   (DAYOFMONTH(NOW())=DAYOFMONTH(dtg) AND HOUR(dtg)<7)
>   OR
>   ((DAYOFMONTH(NOW())-1)=DAYOFMONTH(dtg) AND HOUR(dtg)>=7)
> )
>   ");
> 
> }
> 
> Cheers,
> 
> -peter

I'd imagine that with a judicious use of mysql's IF statement and 
HOUR(NOW()) you could do pretty much what you want. I can't be hanged 
going through the docs right now, or I'd have a try at the syntax for you 
:-)

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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


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




RE: [PHP-DB] Javascript

2002-10-11 Thread Simon Taylor

The reason for this is these fields are regarded as text and unless you
specify number(variable) it may treat it as text.. When
Field1='0'
Field2='1'
Field3='2'

Field1+Field2+Field3 = '012'

If you use 
Field1=Number('0')
Field2=Number('1')
Field3=Number('2')

Field1+field2+field3 = 3

Cheers
Simon

-Original Message-
From: Ignatius Reilly [mailto:[EMAIL PROTECTED]] 
Sent: 11 October 2002 15:48
To: Shahmat Dahlan; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Javascript


I have met this problem before.

The only solution I have found is to assign "0" values to the INPUT tags:


HTH
Ignatius

- Original Message - 
From: "Shahmat Dahlan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 11, 2002 11:34 AM
Subject: [PHP-DB] Javascript


> My question might have anything to do with PHP but I have the 
> following
> scenario:
> 
> Say I have four fields
> field1 : 
> field2 : 
> field3 : 
> field4 : 
> 
> And a total sum field, which is a total sum of the value of the
> expression, totalsum = field1 + field2 + field3 + field4
> Total sum : XXX
> 
> You would need to use Javascript to extract the value of field1, 
> field2,
> field3, field4, initiated by the Javascript onChange event.
> 
> The HTML codes should look like this:
> 
> 
> 
> 
> 
> 
> So the add function snippet that I have:
> 
> function add()
> {
> var thisform=document.forms[0];
> var field1=thisform.field1.value;
> var field2=thisform.field2.value;
> var field3=thisform.field3.value;
> var field4=thisform.field4.value;
> var totalqty=field1+field2+field3+field4;
> thisform.totalsum.value=totalqty;
> }
> 
> But all I got is a NaN which means Not A Number. I understand that you
> solve this by using the parseInt Javascript function.
> But still all i get is a NaN value.
> 
> Would appreciate if someone could help me out on this.
> 
> Regards
> 
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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

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




RE: [PHP-DB] Javascript

2002-10-11 Thread Simon Taylor

Hi,
In your javascript try 

field1=Number(thisform.field1.value) etc...

Cheers
Simon

-Original Message-
From: Shahmat Dahlan [mailto:[EMAIL PROTECTED]] 
Sent: 11 October 2002 11:35
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Javascript


My question might have anything to do with PHP but I have the following 
scenario:

Say I have four fields
field1 : 
field2 : 
field3 : 
field4 : 

And a total sum field, which is a total sum of the value of the 
expression, totalsum = field1 + field2 + field3 + field4
Total sum : XXX

You would need to use Javascript to extract the value of field1, field2, 
field3, field4, initiated by the Javascript onChange event.

The HTML codes should look like this:






So the add function snippet that I have:

function add()
{
var thisform=document.forms[0];
var field1=thisform.field1.value;
var field2=thisform.field2.value;
var field3=thisform.field3.value;
var field4=thisform.field4.value;
var totalqty=field1+field2+field3+field4;
thisform.totalsum.value=totalqty;
}

But all I got is a NaN which means Not A Number. I understand that you 
solve this by using the parseInt Javascript function.
But still all i get is a NaN value.

Would appreciate if someone could help me out on this.

Regards


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

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




[PHP-DB] Javascript

2002-10-11 Thread Shahmat Dahlan

My question might have anything to do with PHP but I have the following 
scenario:

Say I have four fields
field1 : 
field2 : 
field3 : 
field4 : 

And a total sum field, which is a total sum of the value of the 
expression, totalsum = field1 + field2 + field3 + field4
Total sum : XXX

You would need to use Javascript to extract the value of field1, field2, 
field3, field4, initiated by the Javascript onChange event.

The HTML codes should look like this:






So the add function snippet that I have:

function add()
{
var thisform=document.forms[0];
var field1=thisform.field1.value;
var field2=thisform.field2.value;
var field3=thisform.field3.value;
var field4=thisform.field4.value;
var totalqty=field1+field2+field3+field4;
thisform.totalsum.value=totalqty;
}

But all I got is a NaN which means Not A Number. I understand that you 
solve this by using the parseInt Javascript function.
But still all i get is a NaN value.

Would appreciate if someone could help me out on this.

Regards


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