Re: Super bizarre changing variable!!

From: Date: Fri, 05 Oct 2007 12:28:35 +0000
Subject: Re: Super bizarre changing variable!!
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-262802@lists.php.net to get a copy of this message
This is indeed the complete code, I did not cut anything out for brevity, which is why this appears to be so impossible. eAccelerator is activated, could something be corrupt? Could a corrupt index cause this? In table1, referer is int(12). In table2, data is text In table2, friend_id is mediumint(9) - which I see is a problem in some cases, $referer can (rarely) be 10 digits long, so I just changed it to int(12) When $referer is being set it's probably a string type, but the contents are ALWAYS a valid integer. Any ideas????? On Oct 4, 2007, at 10:55 AM, Richard Davey wrote:
Hi Brian, Thursday, October 4, 2007, 4:50:09 PM, you wrote:
I'm running the following code:
$query3 = "DELETE FROM table1 WHERE referer=$referer ORDER BY creation LIMIT $numtodelete"; $result3 = mysql_query($query3); $string = "$total found, $n kept, $numtodelete extras removed ($query3)"; $x = mysql_query("insert into table2 (friend_id,data) values ($referer,'$string')");
I created the table2 log file just so I could see what the hell is going on. Here is a typical entry in table2:
FRIEND_ID = 8388607
DATA = 908 found, 100 kept, 808 extras removed (DELETE FROM table1 WHERE referer=69833818 ORDER BY creation LIMIT 808)
Notice that the value in FRIEND_ID, which was set with $referer, is DIFFERENT than the value of $referer shown in DATA! How the flying f*&^%k is this possible??? I've been tearing my hair out for 3 days over this.
Almost all records show 8388607 in that FRIEND_ID field. Once in a blue moon, a different value is shown, which does match the value in DATA. So it's displaying this erroneous behavior 95% of the time but not always.
What data type do the referer / friend_id columns have in MySQL? int? tinyint? etc Also show all of your code - there is no way that the value changes between lines 1 and 4 in the code above, which means you've missed something out (probably for post brevitys sake) Cheers, Rich --Zend Certified Engineer http://www.corephp.co.uk "Never trust a computer you can't throw out of a window" --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#262802) next »