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