I’m new to PHP / MySQL and I was just trying to get familiar with it all by following this tut:
http://www.allsyntax.com/tutorials/PHP/24/Building-a-Comments-Script/2.php
…here’s an excerpt from the start of the script:
$inf = "SELECT * FROM `comments` WHERE page = '".stripslashes($_SERVER['REQUEST_URI'])."' ORDER BY time ASC";
$info = mysql_query($inf);
f(!$info) die(mysql_error());
I understand what this is doing but I wanted to know why the
stripslashes($_SERVER['REQUEST_URI'])
has dots either side of it?
The period is a String Operator. Specifically, the concatenation operator.
In layman’s terms, it glues strings together.
As you can see in the
stripslashesdocumentation, it is a function that returns a string. So, the code is concatenating the first string"SELECT ..."with the result of the function, followed by the final string" ORDER ...".