So I have a mysql table of many ‘article title’ and ‘article body’s
My main page is php which retrieves just all the article titles and displays it.
I want these titles hyperlinked, when you click on it it goes to a new page which displays both title and article body.
not using fcreate or fwrite as this makes a permanent new page.
how would one make a new php page on the fly?
Thanks
Why don’t you just create an article.php file, which is passed an argument that looks up in your database for the corresponding article?
You would put a link like
http://www.example.com/article.php?page=1, where 1 is some sort of index in the table. Then article.php contains some code to take the$_GET['page']variable and look up the title and body in the database.You’ll have to make sure you aren’t vulnerable to SQL Injection attacks, but this seems to be what you’re looking to do.
Like the commenter mentioned: if you are really against having the query in the url, you could use mod_rewrite (or the equivalent in your web server) to rewrite a URL to an equivalent PHP page.