1
talunceford
Help with an array problem...

Hey guys,

Got a question for you.... How could I extract a particular field from the xoops_users table and stick all of the results in an array() function? Basically what I am wanting to do is customize my sig script so that only members of my site are allowed to use the script. Its a basic if statement, but it needs to check the array to see if a the bf2pid number is included in the array. If its not it generates an error for the end user. That way I can secure the script a little bit better than how I have it.

One thing that you might want to know is that this script resides on another machine other than the one that the site is on. Therefore, I cant use the typical xoopsDB calls.

Here is the array that I have to work with, this is one that I wrote, but I don't think its working correctly.
mysql_select_db($database_bf2online$bf2online);
$r "SELECT bf2pid FROM xoops_users WHERE bf2pid > 0";//<------specify the table name you are storing your PIDS in
$result mysql_query($r$bf2online) or die("Help I can't connect");
$num_results mysql_num_rows($result);

$AllowedPID = array('any');


Basically, I want only the pids that are in the database, as I have quite a few members that sign up for an account and don't update thier profile with thier pid. You are probably wondering what pid means, well its the number that EA assigns you when you buy the game and setup your online BF2 account. This number is associated with your overall score and all of the awards that you have accumulated while you are playing online. For example, mine is 43378148.

Most of my members don't update thier profile with this number, and my site is setup to do much more than generate stats sigs, it stores the stats for each member also. But to do that I need thier pid. So to make a long story short this is why I need to get this array going.

Any help with this would be super!

Thanks fellow xoopsers!
Tim
www.tswn.com | www.bf2online.com | aquaria.tswn.com | www.bf2142online.org

2
talunceford
Re: Help with an array problem...

Got it figured out..... LOL!

Here is the solution.......

mysql_select_db($database_bf2online$bf2online);
$r "SELECT bf2pid FROM xoops_users WHERE bf2pid > '0'";//<------specify the table name you are storing your PIDS in
$result mysql_query($r$bf2online) or die("Help I can't connect");
$num_results mysql_num_rows($result);

while (
$bf2online_pid mysql_fetch_array($result))
{
        
$AllowedPID[] = $bf2online_pid['bf2pid'];
}
Tim
www.tswn.com | www.bf2online.com | aquaria.tswn.com | www.bf2142online.org

Login

Who's Online

97 user(s) are online (51 user(s) are browsing Support Forums)


Members: 0


Guests: 97


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits