Jump to content

Request url, extract portion and query mysql for extracted portion


runspace

Recommended Posts

I'm looking to do the following.

 

1. Request URL of current page

 

e.g.

http://mysite.com/test/1234

 

should I use

<?php $_GET['url']; ?>

?

 

2. I then want only the "1234" portion. 

 

3. I want the "1234" portion to be equal to a variable.

 

so

$variable = "1234";

 

4. I want to compare 1234 to database entries if any exist and and then get information about 1234 say address, headline

 

so $query = "SELECT address, headline * FROM database WHERE variable = '$variable'";

 

5. store the address and headline as separate variables.

 

$array['headline'] = $headline;

$array['address'] = $address;

 

****

 

Other portion to evaluate page and display title.

 

1. Get URL and if it's of the form "http://mysite.com/test/1234" complete the steps above and create a title with the headline from the database corresponding to 1234. 

 

 

 

 

I think one of the other developers I work with already uses mod_rewrite to change to this path from a path where the variables are passed in the url.  I don't have access to the apache and believe the pages were changed to this path on purpose (for ease of use on the users end and to make more se friendly).  If I don't want to change the url is there another way I can evaluate pages and display relevant titles?

I don't have access to the apache server although in the article hypnos posted it says I don't need to. I believe the links were changed to this path on purpose (without the variables being passed for ease of use on the users end and to make more se friendly). 

 

How can I find existing .htaccess files using FTP as I know we have some but don't see them showing up?

 

If I don't want to change the url using mod_rewrite is there another way I can evaluate pages and display relevant titles?

 

I was thinking of strpos php function to get the part of the url I need (the # after test).  I don't think I would be able to evaluate the current url though using this method as I'm currently doing by checking for variables passed. 

 

 

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.