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. Link to comment https://forums.phpfreaks.com/topic/250332-url/ 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. Link to comment https://forums.phpfreaks.com/topic/250332-url/#findComment-1284429 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. Link to comment https://forums.phpfreaks.com/topic/250332-url/#findComment-1284430 Share on other sites More sharing options...
Joshua F Posted November 5, 2011 Author Share Posted November 5, 2011 Bump. Link to comment https://forums.phpfreaks.com/topic/250332-url/#findComment-1285197 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. Link to comment https://forums.phpfreaks.com/topic/250332-url/#findComment-1285199 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. Link to comment https://forums.phpfreaks.com/topic/250332-url/#findComment-1285669 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'] Link to comment https://forums.phpfreaks.com/topic/250332-url/#findComment-1285678 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.