The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Hi. Where could I find an exaustive help with examples about multi-dimensional arrays ?
Actually I would - for a hack - store in memory some fields of a table of VB (user), to make some intensive operation without loading the db. I thought a 2D array like this: $userArray[][] Would use the two index, first as userid or other incremental value, second as the fields in the table. For instance: $userArray[][name]=$user[username] $userArray[][mail]=$user[email] ... etc. in a cycle after a db fetch, but of course it doesn't work this way... Neither with an explicit first index as variable. Do you have some example to load table in array with more values than the (key,value) as in php.net ? Thanks a lot. Bye |
#2
|
||||
|
||||
You do not want to do this. You will cram your RAM. (I made a rhym! )
It's better to build a query, then skip around the recordset using mysql_data_seek(). |
#3
|
||||
|
||||
Where's the ryhm?
|
#4
|
|||
|
|||
... cram .... RAM ... :greedy:
So it would be more efficient go back & forth through the recordset instead of loading data into Ram ? Isn't it too heavy to mySQL engine ? I should compare new users data with old ones. If I had 'N' news (let's say 10 at a time) and 'T' total old users (let's say +3000...), the complexity of the check should be: N*T = 30.000 seeks on DB !!!! :noid: Any idea ? Thanks. P.S.: and what about using mysql_fetch_array() or mysql_fetch_row() just after the seek ? Either which ? |
#5
|
||||
|
||||
I'm not sure about mySQL load for mysql_fetch_array() vs mysql_fetch_row(), but the fetch_array will take up more memory (not much).
What is the hack for? How often will this be run? How much data are you pulling from the DB? Do you need to pull all the fields, or just a few? Can you throw any of the logic at the DB or does it need to be done in PHP? Compare this... 30,000 DB seeks ... or ... 30,000 * (number of fields) demensional array |
#6
|
||||
|
||||
That is the weakest rhyme I've ever heard.
|
#7
|
||||
|
||||
*sigh* well, I tried
|
#8
|
|||
|
|||
Quote:
You can check here the original input, but would try to solve myself as far as i could. By now I added a new action to admin/user.php like 'finddupe', called from the user moderation page. Actually I would need to load in memory almost 3-4 columns of the user table as I should compare the single metaphone() each others, measuring the levenshtein() distance between, for example, usernames/emails/ips/password-md5-hash (identical, of course), and so on. This reason I though to memory as mySQL couldn't do anything itself. Frequency: well, about once/twice a day, the times I moderate new users... Do you think an array like this should overload the system ? P.S.: anyway, any 2D arrays example ??? :supwink: Thanks, poet!!! :china: |
#9
|
||||
|
||||
Why are your that paranoid? That seems like overkill.
Anyway.. Your right, you couldn't do this in mySQL. I've never loaded an array of that size. I'm not sure what that would do to your system. Some thoughts... You don't have to calculate the metaphone() for each search. Instead, calculate it once for all existing users, and when new users register. Store the value in another field in the DB. Then you could use a simple query to test the metaphone() for new users. The levenshtein is trickier, as you can't preproccess anything and store it in the DB. What did you want to do to the IP? levenshtein()? You may be able to do something similar by using wildcards in mySQL. For example, most dialups will only vary in the last 2 octets. Just some thoughts. |
#10
|
|||
|
|||
They are all parameters that - took together - can build a complex profile about a dupe user.
Paranoid? Yeah! I saw for months people subscribing again and again just because they wouldn't remember the password... I explained well talking about the hack I linked to above. Thanks, hwr. |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|