Jump to content

URL


Joshua F

Recommended Posts

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

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

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

<?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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.