Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Using filepath method to identify an .html page

by Anonymous Monk
on Jan 22, 2013 at 16:07 UTC ( #1014711=note: print w/ replies, xml ) Need Help??

in reply to Using filepath method to identify an .html page

Do I understand correctly that you've already got a database table with a column "pin" (I assume a unique integer?) and another column "page" which contains something like the URL of the page? Why not just use that unique identifier? (Or create another database table, as other people here have suggested?)

Anyways, although I don't think this is the correct solution for your situation, here is an answer to your original question: One concept of generating a number from a string is a Hash function, however, those numbers are generally not unique. Also, int has nothing to do with hash functions (the closest built-in is probably crypt, and that's not what you want, either).

The problem with your question is this: using a hash function causes you to lose information about the original string, and the numbers you generate won't be guaranteed to be unique anymore. If you want the numbers to be truly unique, then the only way to guarantee that is to keep a list of the original strings around, which you say you don't want to do because of the amount of data that means. Sorry, you can't have it both ways...

But maybe we're not quite understanding your existing set-up or what your goal is?

Comment on Re: Using filepath method to identify an .html page
Re^2: Using filepath method to identify an .html page
by Nik on Jan 22, 2013 at 16:13 UTC
    Read this please, so to clarify what i need to do

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014711]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-08-29 02:51 GMT
Find Nodes?
    Voting Booth?

    The best computer themed movie is:

    Results (275 votes), past polls