0

I have this simple string variable:

$query="SELECT * FROM striscie AS previous, striscie AS current WHERE previous.linea=current.linea AND current.ident=$striscia AND previous.position<current.position AND previous.position>current.position-$stops";

yet, when I echo or use it, it turns to:

SELECT * FROM striscie AS previous, striscie AS current
WHERE previous.linea=current.linea AND current.ident=897524 AND previous.positioncurrent.position-3
SELECT * FROM striscie AS previous, striscie AS current
WHERE previous.linea=current.linea AND current.ident=920173 AND previous.positioncurrent.position-2

By deleting the whole part of the string. I tried restarting Apache to no avail. What might it be?

4
  • some charachter inside php vars ($stops is an example) do cut the string maybe Commented Dec 16, 2014 at 13:57
  • you can print this inside a <pre> Commented Dec 16, 2014 at 14:02
  • My problem is that not only the print sees the string like this, but also sql treats it strangely. I count the number of results but it does not find them, and not being able to see the output string I do not know where the problem might lie. Commented Dec 16, 2014 at 15:11
  • I managed to fix it blindly, sure it is strange how it mangles the strings. Commented Dec 16, 2014 at 16:18

1 Answer 1

8

< is being treated as HTML by the browser. Don't blindly output stuff like that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.