but I am looking for a php script that is only one page (or one document). You set it as index.php and place it in your root domain. Then when someone navigates to a link such as: www domain.com/123456.htm the script will read the document number (the 123456.htm part) and go to a mysql database and pull record number 123456 and output the row to the variables which in turn populate your template. I guess it might work like some of the domaintools sites where you append the root with a /somethingelse and it pulls in the somethingelse Anyone know where I can get this - or even what it's called?
I dunno if you'll find something premade, it's a mixture of mod_rewrite php and mysql, ( as you prolly know ). Do you know how to program or do you want actual code ?
I am stronger in desktop admin scripts (wsh, vbs, wise setups, wrappers, etc) trying to learn php so you could say I pick up a thing or two from seeing a script but to write one from scratch is whole different deal. I was just wondering if there was something on hotscripts or one of those sites - not sure what to call it though.
It is hard to find something for just this. Maybe a tutorial on mod_rewrite but that is about it. Finding a script will find this implemented in an app and will most likely be too complicated for your needs. It's not much work so I will start you off: .htaccess: <ifModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^(\d+)\.htm$ index.php?id=$1 [NC,L] </ifModule> Code (markup): Then, in index.php <?php $id = (int) @$_GET['id']; if (!$id) { // do something when there is no number given } connect to database... query database, eg. SELECT ... FROM ... WHERE id = $id ?> PHP: From someone who has "I love LAMP" in their avatar, I assume you know a little so if you still need help, just mention what part specifically.
Sweet.... got it to work with the "id=" just fine. In the mySQL query I wrote it something like this: <?php $result = mysql_query("SELECT recnum, name, age, recdate FROM table WHERE recnum = '$id'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result); ?> Code (markup): - I think I got the htaccess part wrong somehow though - I still see the dynamic link. I know I have mod-rewrite enabled with this host. also, I'm a little fuzzy on the If statement // do something when there is no number given what would be an example of a condition for the if statement? Thanks!