Re: Super bizarre changing variable!!



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

I've been trying to follow your code here but the results you are
showing are in no way related to queries you are running.

You've said "FRIEND_ID = 8388607", but all you are saying here is that
you've picked a random row from your table2 and it's not the same as the
referer in your $string value.... this could easily be the case. You
should echo out both $query3 and string and the other query you run
inline and compare these three values for inconsistencies...

PS I really home the value stored in $referer has already been properly
escaped with e.g. mysql_real_escape_string.....

Col
.



Relevant Pages

  • Re: [PHP] Re: Super bizarre changing variable!!
    ... the value of $referer is changing between line 1, where $query3 is being set, and line 4, where it's being written into my debugging log table2. ... referer in your $string value.... ...
    (php.general)
  • Re: [PHP] Super bizarre changing variable!!
    ... This is indeed the complete code, I did not cut anything out for brevity, which is why this appears to be so impossible. ... In table1, `referer` is int. ... Here is a typical entry in table2: ... WHERE referer=69833818 ORDER BY creation LIMIT 808) ...
    (php.general)
  • Re: [PHP] Super bizarre changing variable!!
    ... Here is a typical entry in table2: ... WHERE referer=69833818 ORDER BY creation LIMIT 808) ... What data type do the referer / friend_id columns have in MySQL? ...
    (php.general)
  • Re: Help to identify different strings
    ... Dim strLine As String ... 'XXX is the name of the field in Table2 that contains ... I agree - it is easy to parse each individual line in Table1 by applying ... individual alarm type, then check whether this string is available in the ...
    (microsoft.public.access.modulesdaovba)
  • Re: Help to identify different strings
    ... I agree - it is easy to parse each individual line in Table1 by applying ... different queries checking whether a significant string is available or not. ... be maintained in a table (Table2). ... individual alarm type, then check whether this string is available in the ...
    (microsoft.public.access.modulesdaovba)