Jump to content

INCLUDE() with paramters


Cenron

Recommended Posts

Anyone know of a good way of passing a parameter to one of my php files while I am including it

 

so for example I want to do this

 

include("display.php?p=3");

 

That doesn't end up working for me and I know why,because it uses the system file directory and doesn't run it through the PHP engine yet, in any cause I though of doing it this way but I want to see if there was a better way.

 

My idea was do it this way

 

 

index.php

$parameter = $_GET["p"];
include(display.php);

 

 

display.php

$query = mysql_query("SELECT * FROM `display` WHERE `display_id` = '$parameter' ");
echo "$query";

 

 

I know there is more to the code above but this was how I was thinking about doing it.

 

any suggestions on doing this a better way?

Link to comment
https://forums.phpfreaks.com/topic/53660-include-with-paramters/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.