Joshua F Posted November 2, 2011 Share Posted November 2, 2011 Hello, I'm having trouble figuring out how I could go on about making something load from the database by a specific url. An example url would be.. thread.php?12,13,1,1 That would be board 12, the 13 is 12+1, the first 1 is the board specific id, and the second 1 and it over all id. I'm wanting to know how to be able to make a URL like this. I've tried mod_rewrite but can't seem to figure it out. Quote Link to comment Share on other sites More sharing options...
seany123 Posted November 2, 2011 Share Posted November 2, 2011 You would use the $_GET function and the url would look like this: thread.php?id1=12&id2=13&id2=1&id4=1 and you would use eg $_GET['id1']; to get the id then run it against your database. OR do you want to create the url from database values? but to be honest is seems like you dont have your database optimised or organised well enough surely you should need 4 different IDs to display a thread. Quote Link to comment Share on other sites More sharing options...
Joshua F Posted November 2, 2011 Author Share Posted November 2, 2011 URL by the database, and separate the id's by a comma, like I had the example in the first post. Quote Link to comment Share on other sites More sharing options...
Joshua F Posted November 5, 2011 Author Share Posted November 5, 2011 Bump. Quote Link to comment Share on other sites More sharing options...
Joshua F Posted November 5, 2011 Author Share Posted November 5, 2011 but to be honest is seems like you dont have your database optimised or organised well enough surely you should need 4 different IDs to display a thread. Just saw that, to clear that up I'm trying to remaking a website, and to get the feel of how it was I need to have the URL's just like how that site has/had them. Quote Link to comment Share on other sites More sharing options...
Joshua F Posted November 6, 2011 Author Share Posted November 6, 2011 Still can't seem to figure it out. Quote Link to comment Share on other sites More sharing options...
xyph Posted November 6, 2011 Share Posted November 6, 2011 <?php // $_SERVER['QUERY_STRING'] contains everything after the ? $ids = explode( ',', $_SERVER['QUERY_STRING'] ); print_r( $ids ); ?> This is limiting though, as something like page.php?12,13,1,1#anchor would break your script. You're better off using something like page.php?r=12,13,1,1 and using $_GET['r'] instead of $_SERVER['QUERY_STRING'] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.