Jump to content

Create a URL


taneya

Recommended Posts

Hi all,

 

an inexperienced user here but I hope this is a simple question.

 

I have a page on my site that shows results from a search.  Each row of results contains an ID number. How do I turn that ID number into a link? I plan to use this link to show more details.  I would prefer not to have to hard code a URL into the database table (a workaround I have used before).

 

I am interested in very basic explanations and possibly some sample code I could study? Or, perhaps be pointed to a book/website I can read to help me understand how to do it?

 

thank you in advance.

 

 

Link to comment
https://forums.phpfreaks.com/topic/105890-create-a-url/
Share on other sites

hi taneya,

 

well creating a url is not a tuff job once you are ready with your id from the database but it depends how you are expecting them to create.

 

suppose

 

you are turn with id 1,2,3,4,7,10

If they all belong to same page them its simple

 

$i=0;

foreach($id_arr as $id)

{

$url_arr[$i]='path/to/page/category/product/id='.$id;

$i++;

}

 

so $url_arr is a url array which you can use.

 

but if these id belongs to different pages then the static part for the url has to be defined based on some criteria like categories etc....

 

so kindly share how you are thinking about it.

 

 

Regards

Link to comment
https://forums.phpfreaks.com/topic/105890-create-a-url/#findComment-542662
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.