PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have setup a MySQL database that contains information for individual webpages. I also setup a PHP page to automatically create those webpages based on the pagename that is stored in the database.
The part that I do not understand is how the information necessary to create the pages is supposed to get from the browser to the PHP page so the correct webpage can be generated.
I hope that is clear enough to answer... If not I can clarify.
Then in index.php you can take the value of $_GET['page'] and use that.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Is that something that is passed automatically, or is there something that you have to setup before it works. The part that i am referring to is index.php?page=home. I understand how to use the get to read the information.
That might not be clear, but that's just how confused I am about this.
You would construct your links on the pages to look like that. Imagine you have a header on every page with links to 'About Us', 'Contact', 'Support', etc.. Then you would write the links like this:
Then in index.php any of the variables in the URL (get parameters) are availbale in the $_GET array. So you could do something like this (very simplified example):
$query = "SELECT * from pages WHERE page_name = '" . mysql_real_escape_string($_GET['page']) . "'";
//echo or do stuff with results
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
michaelk46 wrote:So the name of every page would be index.php?page= and then whatever the actual page name is. Am i getting that correctly?
Yes, it could be or it could be a number or whatever you have stored in the DB that you can query to get your page data.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.