|
Posted by scott Johnson on 10/21/05 02:35
If you could post the code that duplicates this output, it would be
easier to tell.
However if you take a text string and add an integer to it, it will be
converted to an integer type.
The INF you have showing means 'infinity', but I am not sure how you are
getting it.
Try gettype() in your output to see what type it is getting converted to.
starbuck wrote:
> Hi, thanks for replying with your findings, however the problem occurs
> when trying to search in the mysql statement.
> Below is a sample of my tests:
>
> $var = $_POST["textfield"];
>
> $testvar = $var + 2;
>
> echo $var;
> echo "<br>";
> echo $testvar;
>
> below is the output for different search keywords.
> word echo $var echo $testvar
> test test 2
> 45 45 47
> formation formation 2
> information information INF
> inf inf 2
> info info INF
> inforum inforum INF
>
>
> as you can see, anything that starts with info is converted to a
> different type or value,
> if it were kept as char the addition would've yielded 2 like all other
> char inputs.
> somehow mysql is treating this also as a different type which is why
> the queries fail.
> the echo of the post variable is displayed correctly, but the 'value'
> of it changes
>
> this is very weird and i haven't found ways to work around it, the only
> way to retrieve records
> with the string info in them is to search for nfo or inf
> but this isn't something that users of the site would think of doing.
>
--
Scott Johnson
http://www.seaforthsailingclub.com
[Back to original message]
|