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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.