View Full Version : PHP Includes - Different Data, Same File, Different Pages?
A.J. Angel
2011-07-08, 02:22 AM
Is it possible to include different data from a single file on different pages?
Supposing I have measurements for different models in a single file, is it possible to display their respective measurements on their respective pages?
If yes, would you be kind enough to tell how or direct me to a tutorial on how to do it? Thank you in advance.
HowlingWulf
2011-07-08, 11:01 AM
Very basic.
Passing an argument because the file holds different stats
<?php include("http://www.domain.com/dir/modelstats.php?name=AJAngel"); ?>
and the modelstats.php is something like
<?php
$name = $_GET['name'];
if ($name == "AJAngel") echo "AJAngel stats: blah blah blah";
?>
A.J. Angel
2011-07-08, 01:53 PM
Sweeet. That's even more simple than another provided to me. Thank you Wulf. |waves|
flowersgone
2011-07-08, 03:19 PM
Hi,
The example I cooked up is a bit more complicated but after looking at http://www.exquisiteangelz.com/ it looks to me like it might be better tuned to your needs. The examples including source code can be found at the following links: http://development.toosxxx4.com/small_php_database/katy-parker/ and http://development.toosxxx4.com/small_php_database/kimberly-phillips/. If you have any questions you can PM me as well as replying here.
I do both server side and client side programming but do more Perl than PHP. I welcome any ideas for improving my solution.
A text/php file solution may be OK for a few hundred models but if the volume gets bigger an indexed database system like MySQL or SQLite may work better.
Good luck,
fg
vBulletin® v3.8.1, Copyright ©2000-2026, Jelsoft Enterprises Ltd.