I have two files:
1.php - displays data
data.inc - gets the heading and the body of the HTML page from MySql database and prints it
1.php contains this line:
include(“data.inc”);
I also have 2.php, 3.php, 4.php, 5.php.
data.inc has this lines:
$sql = “SELECT heading, subHeading, body FROM superintendent WHERE id = 1”;
as you can see. the query says WHERE ID = 1; but i want the query to retrieve the id number dynamically. instead of WHERE ID = 1, i would like to have a variable like WHERE ID = $id.
so, thats why i need a function, which i have been looking for but cant find it, to retrieve the filename like 4.php (maybe using PHP_SELF) and then get the characters BEFORE the dot, so i would have a ‘4’ in the variable, and the result of the query be WHERE ID = 4;.
if there is a better way to do this, please let me know.