[PHP] quicker query?

2001-05-05 Thread Michael Roark

Is there a faster (better) way to do the following: 

if ($result) { 
for ($cluster=1;$cluster<200;$cluster++) { 
for($galaxy=1;$galaxy<26;$galaxy++) { 

$sql="insert into galaxy select avg(cluster) as gcluster,sum(size) as gsize,sum(score) 
as gscore,avg(galaxy) as ggalaxy from universe where cluster='$cluster' and 
galaxy='$galaxy'"; 
$result=db_query($sql); 

Thanks

Michael



Re: [PHP] quicker query?

2001-05-06 Thread Michael Roark

Its a different problem to explain Let me show you part o the contents from
universe.

+-++++---+--
+++
| cluster | galaxy | planet | planet_name| ruler | size
| score  | rank   |
+-++++---+--
+++
|   1 |  1 |  1 | Stomp  | Pomp  |9
|  46175 |  97055 |
|   1 |  1 |  2 | The Burping World  | Burp  |   28
| 125263 |  42971 |
|   1 |  1 |  3 | xion   | KLS   |   31
|  97106 |  59469 |
|   1 |  1 |  4 | madlosers  | madloser  |   55
| 104154 |  55094 |
|   1 |  1 |  5 | Troy   | Lanfeust  |   10
|  25311 | 115558 |
|   1 |  1 |  6 | Infinte Space  | The Watcher   |   52
| 131190 |  39903 |
|   1 |  1 |  7 | Kjempefæl planet   | EkvALiser |   23
|  83264 |  68716 |
|   1 |  1 |  8 | Edinazu| Jaypallas |   30
| 129877 |  40601 |
|   1 |  1 |  9 | Gracen and Gracen inc. | Jim Profit|   33
|  74665 |  74957 |
|   1 |  1 | 10 | Hades  | DarkkAngel|   39
| 109799 |  51718 |
|   1 |  1 | 11 | ziggy  | zigzac|   28
|  86054 |  66746 |
|   1 |  1 | 12 | Promt  L- pop  | Kaaleb|   55
| 156840 |  28239 |
|   1 |  1 | 13 | Wicka  | Wreck |   11
|  52938 |  91364 |
|   1 |  1 | 14 | Karak Azhul| Morglum   |   45
| 155288 |  28907 |
|   1 |  1 | 15 | your fate  | decider   |   44
| 153838 |  29491 |
|   1 |  1 | 16 | Poison | BlackWidow|   10
|  48655 |  94916 |
|   1 |  1 | 17 | Veilside   | Sik Silvia|   21
|  83891 |  68266 |
|   1 |  1 | 18 | Sontis | Bobshi|   45
| 112186 |  50353 |
|   1 |  1 | 19 | Midkemia   | Milamber  |   40
| 130165 |  40444 |
|   1 |  1 | 20 | Fortezza   | Saratoga  |   39
| 114699 |  48883 |
|   1 |  1 | 21 | blackdeath | ~~blackwing~~ |   33
| 107266 |  53248 |
|   1 |  1 | 22 | Lightforge | Darkangel |   36
|  95566 |  60445 |
|   1 |  1 | 23 | Knor's Planet  | Knor  |   54
| 181835 |  19500 |
|   1 |  1 | 24 | Popelplanet| Earthbrain|1
|   9008 | 133733 |
|   1 |  1 | 25 | Infected Earth | TeRRoR|   75
| 187138 |  17817 |
+-++++---+--
+++



cluster, galaxy and planet are coordinates. The code I posted loops through
the universe and adds up size and score for each galaxy. There are 742
clusters each with 25 galaxies and each galaxy has 25 planets. I average the
cluster and galaxy sum the score and size then insert the results into a new
table. The script goes on to the next cluster galaxy and does the same
thing. It does this till it gets to cluster 742 galaxy 25.

- Original Message -
From: "Gyozo Papp" <[EMAIL PROTECTED]>
To: "Michael Roark" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Sunday, May 06, 2001 6:51 AM
Subject: Re: [PHP] quicker query?


hello,
maybe there is another solution that should be quicker, because it uses
fewer DB query.

I don't have a clear view what you want from this query, so if you can give
me a short description about it
it would be appriciated. I think this one does the same job:

INSERT INTO galaxy
SELECT
cluster AS gcluster,
sum(size) as gsize,
sum(score) as gscore,
galaxy AS ggalaxy
FROM universe
WHERE cluster BETWEEN 1 AND 200 AND galaxy BETWEEN 1 AND 26
GROUP BY cluster, galaxy;


- Original Message -
From: "Michael Roark" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 2001. május 6. 05:27
Subject: [PHP] quicker query?


Is there a faster (better) way to do the following:

if ($result) {
for ($cluster=1;$cluster<200;$cluster++) {
for($galaxy=1;$galaxy<26;$galaxy++) {

$sql="insert into galaxy select avg(cluster) as gcluster,sum(size) as
gsize,sum(score) as gscore,avg(galaxy) as ggalaxy from universe where
cluster='$cluster' and galaxy='$galaxy'";
$result=db_query($sql);

Thanks

Michael



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PassThru()

2001-05-09 Thread Michael Roark

how does one pass arguements to PassThru()

ie would the following work

PassThru(/home/bleh/bleh.cgi < bleh.txt);

and if that does work PassThru() sends its output back to the page yes?



[PHP] regex pattern match and extract

2001-05-10 Thread Michael Roark

$sql="select nfo_gname from galaxy_nfo limit 1";
$result=db_query($sql);
if ($result) {

while (list($nfo_gname)=mysql_fetch_row($result)) {
echo ("$nfo_gname");

ereg ("\[[a-zA-Z0-9]\]", $nfo_gname, $regs);

echo $regs[1];


I'm trying to match any thing between [] and pull it from the string and print it to 
the page. I want the []'s matched as well.

IE:

$nfo_gname contains the following information

[VET]We r NOT [PA]-Crew [TC]

should $regs[1] contain:
[VET] [PA] and [TC]

?



[PHP] math - somethings wrong

2001-05-16 Thread Michael Roark

$percentage=(($target_score/($fleet_score+$total_score))*.4)*100;
 if ($percentage >= 10) {
$percentage='10';
$capped=$target_roids*($percentage/100);
} else {

$capped=$target_roids*($percentage/100);

}
}


I get different results on a calculator than I don with this script. This is the order 
i do things on the calc:

($fleet_score+$total_score))*.4)

then the 

(($target_score/

then the 

*100

i think my problem is some where in the if ($percent >=10) that port is there because 
regardless of the results returned by the formula the percentage can never be larger 
than 10



[PHP] microsoft project

2001-05-23 Thread Michael Roark

Can anyone point me to some code which can take project documents and put all the info 
they contain into a database?



[PHP] scheduler

2001-04-02 Thread Michael Roark

Does anyone have any code which creates schedules? Like to create a works 
schedule or a league schedule (baseball, softball that sort of thing)



-Micahel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] scheduler

2001-04-02 Thread Michael Roark

While this would work. Its a service for which you pay. I was looking for a 
code snippet.

At 02:56 PM 4/2/2001 -0400, Rick St Jean wrote:
>check out
>
>www.ileaguemanager.com
>
>At 12:12 PM 4/2/01 -0500, Michael Roark wrote:
>>Does anyone have any code which creates schedules? Like to create a works 
>>schedule or a league schedule (baseball, softball that sort of thing)
>>
>>
>>
>>-Micahel
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] scheduler

2001-04-02 Thread Michael Roark

I apologize and I understand where you are coming from. My point was that 
www.ileaguemanager.com was a service you paid for hosted by them coded by 
them. I do not mind paying for code,  I've done it before and I will do it 
again. But I don't want to buy a service.

At 04:12 PM 4/2/2001 -0400, Michael Kimsal wrote:
>I don't like appearing rude, but I think you need to reevaluate your
>request some.  What you're asking for is not a 'code snippet' - it's
>an application.  A fairly customized application, I'd think too.
>
>Write down exactly the features and functionality you'd want.
>Search around the web for programs that do that.
>Ask those people if you can have it for free.  MOST of them will
>tell you to take a hike.  Some will oblige.
>
>If all you want is something to type names/times in, just stick to
>MS Word and save as HTML.  If you want something more advanced,
>think about all the features that go into it.  It's NOT a 'snippet'.
>
>As you can see, you've touched a nerve here.  :)
>
>
>Michael Roark wrote:
>
> > While this would work. Its a service for which you pay. I was looking for a
> > code snippet.
> >
> > At 02:56 PM 4/2/2001 -0400, Rick St Jean wrote:
> > >check out
> > >
> > >www.ileaguemanager.com
> > >
> > >At 12:12 PM 4/2/01 -0500, Michael Roark wrote:
> > >>Does anyone have any code which creates schedules? Like to create a works
> > >>schedule or a league schedule (baseball, softball that sort of thing)
> > >>
> > >>
> > >>
> > >>-Micahel
> > >>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] hosting - key issues

2001-04-02 Thread Michael Roark

Ok so i've got a nice little game site and some folks want to start hosting their 
websites on my machine. I let a few here and a couple there and now my machine has 
more folks on it doing more things than I've got a handle on. Yes I did a bad thing.  
Most of them are there because of the PHP and mysql which I've setup and let them use. 
so on and so forth.

What I need now is some help getting this situation under control. I know this is not 
a unix admin forum but I've seen several posts from folks with hosting experience. I 
don't charge any money for folks to use my server and I don't want to start. If anyone 
has some experience setting up a system to host websites (many virtual domains) and is 
willing to spend a little time giving me some pointers on how to lock down a system 
while still allowing folks the ability to, for the most part, painlessly maintain 
their website, I would be very much in that person's debt. Please email me privately 
if you are willing to help.

thanks much,

Michael Roark

p.s. if there is a faq/tutorial/set of guidelines out there on the web feel free to 
just send me a link and say RTFM. I've not found anything yet.



[PHP] query 2 databases from one script

2001-04-03 Thread Michael Roark

I've a script has many functions in it all of which hit databaseA . I've 
added a new function which is to get data from databaseB how can I go about 
this in one script when I try to connect to a database other than the one 
defined at the beginning of the script all the functions in the script 
break as if I am setting the wrong database at the top of the script. Any 
help would be greatly appreciated.

Michael Roark


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] filename into variable.

2001-04-04 Thread Michael Roark

How would i go about building a page which could use the name of the page 
less .php as a variable.
For example:

Say I have a file called screenshot_1.php and another called 
screenshot_2.php . Inside each of those files I want to have code which 
will take the name of the file from the url and assign that value to a 
variable.  So $picture would get the value screenshot_1 from 
screenshot_1.php  and so on.




Michael Roark


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] unsubscribe php-general

2001-06-19 Thread Michael Roark

unsubscribe php-general




[PHP] irc bot?

2001-06-26 Thread Michael Roark

Does anyone know of the existance of an irc bot written in php or
otherwise, which will talk to a mysql database?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]