Forum Moderators: coopster

Message Too Old, No Replies

"NaN" error in mysql, please advise

         

fung9571

6:55 pm on Jan 2, 2007 (gmt 0)

10+ Year Member



Hi,

I am running xanga tracker site~

I have a "NaN" error in mysql.

After I moved my database from old server to new server.
There is a "NaN" add to mysql database automatically. And it happened to the old server too.

Example,
It should show as:
======
Page Viewed:http://www.example.com/username
Referrer:http://www.example.com/private/yourhome.aspx?user=another-username
================

However, it shows with the "NaN" error,
========
Page Viewed:NaNhttp://www.example.com/private/yourhome.aspx?user=another-username
Referrer:
================

The Referrer shows in "Page Viewed" accidently with "NaN" is added automatically.
And the "Page Viewed" is disappeared.

I need some advise to help me fix this "NaN error".
I research in google, and I dont think it help.

ref, this is our code,
<script type='text/javascript'>
var xanga = "username";
var from_url = escape(document['referrer']);
var links = document.getElementsByTagName('a');
for (var i=0; i<links.length; i++) {
if (links[i].href.match('http://www.example.com') && links[i].innerHTML.match('xanga') && (links[i+2].href.match

('/logout.aspx') ¦¦ links[i+2].href.match('/signin.aspx'))) {
document.write('<img src="http://www.example.com/process.php?xanga='+xanga.toLowerCase()+'&visitor='+links

[i+1].innerHTML.toLowerCase()+'&url=' + document.location+'&ref='+from_url +'" width="0" height="0">');
}
}
</script>

[edited by: coopster at 7:04 pm (utc) on Jan. 2, 2007]
[edit reason] generalized domain [/edit]

fung9571

6:57 pm on Jan 2, 2007 (gmt 0)

10+ Year Member



Operating system CentOS 4.0
Kernel version 2.6.9-42.0.3.ELsmp
Machine Type i686
Apache version 1.3.37 (Unix)
PERL version 5.8.7
PHP version 4.4.4
MySQL version 4.1.21-standard
cPanel Build 10.9.0-RELEASE 95
Theme cPanel X v2.6.0

mcibor

1:01 pm on Jan 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do you insert and retrieve data from db?

or do you use some tool, eg
[alexa.com...]

?

Cause I don't see a chance of doing what you need with xanga.com. At least not on this forum (which is php forum)

cmarshall

2:03 pm on Jan 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



NaN is a JavaScript error, not a PHP or MySQL error. Look at your JavaScript.

fung9571

3:27 pm on Jan 7, 2007 (gmt 0)

10+ Year Member



Hi,

My program was doing fine.
However, after I moved the database, this things happen.

Anyways, I will check on Java~:)

cmarshall

11:23 pm on Jan 7, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The error may well be in your PHP or MySQL code. However, the "NaN" is simply a "Not A Number" error, which means that you are trying to perform a numerical operation on a value that has no numerical merit. For example, "alert (2 / 'Bob');" will result in NaN.

I suggest putting in alerts to see what values you are getting back.