Here's a puzzler...
I've got a script that uses PostToHost to acquire a page, then by using strpos, I'm positioning a pointer on the returned string to access bits of data. Everything works perfectly until mysql_query, where the data that's inserted into the table is nothing but garbage.
But this isn't a case of garbage-in/garbage-out. Just before the mysql_query statement, I've placed an echo, displaying the string and it looks perfect. I can even cut and past the string into the mysql command line tool and have the record inserted correctly.
$TEMP_SQL = "INSERT INTO $table_name VALUES($id_num,'$def_name','$dob','RIDOC','AOC*$case_num')";
echo "DEBUG: $TEMP_SQL<br>\n";
$result = mysql_query($TEMP_SQL, $mysql_link);
$affected_rows = mysql_affected_rows($mysql_link);
echo "DEBUG: Records inserted: $affected_rows);
Assume the value of $TEMP_SQL is correct (because I can cut and paste it). The data that is inserted into the table looks like it's the result of a buffer overrun (like you can get sometimes in C). mysql_affected_rows, reports 1 record inserted...
So for one final test, I then stripped out all the code that parsed the html, so all I had left was a few equate statements, the building of $TEMP_SQL, the mysql_query and the mysql_affected_rows. Guess what... works just fine.
Any suggestions on how to debug this? I'm still thinking some sort of overrun, the page I'm mining the data from can be pretty big (80k - 120k).
Frustratingly,
Ron