Final Fantasy Republic Forums  
 Home | Forums | Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
     
    
        
     
 
Final Fantasy Republic Forums  
Username:

Password:
CAPTCHA:
  
        
Closed Thread
 
LinkBack Thread Tools Display Modes
  AnkisethGallant
 
No Control
 
Posts: 250
 
Reg: Apr 20 2002
 
ID: 576
 
RP: 0
 
Final Fantasy IV
Less Than Jake
The Boondock Saints
Harry Potter
     
 
Default  Need Some PHP Help
06.22.02, 17:52:45
  Post #1 (permalink)
 
     

On any php files for vB, you have to use:
require('./global.php');
So you can query the database using $DB_site->query

If I was going to make a php file that's NOT in my root directory, how would I make it still be able to query the database like that?
Send a message via ICQ to AnkisethGallant Send a message via AIM to AnkisethGallant   AnkisethGallant is offline
View AnkisethGallants Profile! Find more posts by AnkisethGallant! Visit AnkisethGallants Homepage!  
  
 
Posts: n/a
 
ID:
 
RP:
     
 
Default  06.22.02, 17:55:22
  Post #2 (permalink)
 
     

maybe try require('http://www.punkmusicrocks.com/global.php');
 
 
  AnkisethGallant
 
No Control
 
Posts: 250
 
Reg: Apr 20 2002
 
ID: 576
 
RP: 0
 
Final Fantasy IV
Less Than Jake
The Boondock Saints
Harry Potter
     
 
Default  06.22.02, 19:04:58
  Post #3 (permalink)
 
     

That's not the exact url, but I'll give it a try and see if it works.

EDIT: That didn't work. That's good, otherwise you could point that to anyone's global.php and start messing with their database.

Last edited by AnkisethGallant : 06.22.02 at 19:11:53.
Send a message via ICQ to AnkisethGallant Send a message via AIM to AnkisethGallant   AnkisethGallant is offline
View AnkisethGallants Profile! Find more posts by AnkisethGallant! Visit AnkisethGallants Homepage!  
  rake
 
 
rake's Avatar
Sorceror|Supreme
 
Posts: 1,269
 
Reg: Jan 15 2002
 
ID: 4
 
RP: 0
 
None
None
None
None
     
 
Default  06.23.02, 04:37:11
  Post #4 (permalink)
 
     

well....

chdir("community");
require("./global.php");
chdir("../");


that's the way i have it for files in the root. and community is the forums dir.
______________________________________


Send a message via ICQ to rake Send a message via AIM to rake   rake is offline
View rakes Profile! Find more posts by rake! Visit rakes Homepage!  
  AnkisethGallant
 
No Control
 
Posts: 250
 
Reg: Apr 20 2002
 
ID: 576
 
RP: 0
 
Final Fantasy IV
Less Than Jake
The Boondock Saints
Harry Potter
     
 
Default  06.23.02, 13:44:45
  Post #5 (permalink)
 
     

Thanks rake.

Also, if I have info in a table for every user, say for example Level like FFR would, how do I pull out all the values and find the highest?
Send a message via ICQ to AnkisethGallant Send a message via AIM to AnkisethGallant   AnkisethGallant is offline
View AnkisethGallants Profile! Find more posts by AnkisethGallant! Visit AnkisethGallants Homepage!  
  rake
 
 
rake's Avatar
Sorceror|Supreme
 
Posts: 1,269
 
Reg: Jan 15 2002
 
ID: 4
 
RP: 0
 
None
None
None
None
     
 
Default  06.23.02, 14:07:51
  Post #6 (permalink)
 
     

$DB_site->query_first("SELECT * FROM user ORDER BY level DESC LIMIT 1");
Send a message via ICQ to rake Send a message via AIM to rake   rake is offline
View rakes Profile! Find more posts by rake! Visit rakes Homepage!  
  Arielle
 
 
Arielle's Avatar
Wandering...
 
Posts: 2,616
 
Reg: Apr 04 2002
 
ID: 448
 
RP: 0
 
World of Warcraft
Silversun Pickups
Children of Men
The Consumer Society: Myths and Structures
PC, Nintendo DS
     
 
Default  06.23.02, 17:26:33
  Post #7 (permalink)
 
     

Ah thanx rake I was just wondering how to do that myself and if I wanted posts or RP I would just change the level to post or points right?
______________________________________

Arielle
Aerith_Freak | aerithfreak | Ethereal
Former Site Manager and Forum Administrator of Final Fantasy Republic 2002-2005
Send a message via MSN to Arielle   Arielle is offline
View Arielles Profile! Find more posts by Arielle!  
  AnkisethGallant
 
No Control
 
Posts: 250
 
Reg: Apr 20 2002
 
ID: 576
 
RP: 0
 
Final Fantasy IV
Less Than Jake
The Boondock Saints
Harry Potter
     
 
Default  06.23.02, 19:06:34
  Post #8 (permalink)
 
     

Yes Aerith.

When you do that query Mewtwo, will you have to store it as an array ($level = $DB_site...)?
Also, if I want the person with the second highest level, do I change the DESC LIMIT to 2?
Send a message via ICQ to AnkisethGallant Send a message via AIM to AnkisethGallant   AnkisethGallant is offline
View AnkisethGallants Profile! Find more posts by AnkisethGallant! Visit AnkisethGallants Homepage!  
  Arielle
 
 
Arielle's Avatar
Wandering...
 
Posts: 2,616
 
Reg: Apr 04 2002
 
ID: 448
 
RP: 0
 
World of Warcraft
Silversun Pickups
Children of Men
The Consumer Society: Myths and Structures
PC, Nintendo DS
     
 
Default  06.23.02, 19:35:31
  Post #9 (permalink)
 
     

*does happy dance*

Ok I think I got it,

*runs off to add latest addition to Shop directory*
Send a message via MSN to Arielle   Arielle is offline
View Arielles Profile! Find more posts by Arielle!  
  rake
 
 
rake's Avatar
Sorceror|Supreme
 
Posts: 1,269
 
Reg: Jan 15 2002
 
ID: 4
 
RP: 0
 
None
None
None
None
     
 
Default  06.24.02, 02:32:50
  Post #10 (permalink)
 
     

Quote:
Originally posted by AnkisethGallant
Yes Aerith.

When you do that query Mewtwo, will you have to store it as an array ($level = $DB_site...)?
Also, if I want the person with the second highest level, do I change the DESC LIMIT to 2?
yes, you'll have to store it in a variable.

$topuser = $DB_site->query_first("SELECT * FROM user ORDER BY level DESC LIMIT 1");

then you can use the topuser variable for the user info: $topuser[username], $topuser[userid], $topuser[level] etc.

if you want to get more results you can modify limit and use the fetch_arrray, like this:

$topusers = $DB_site->query("SELECT * FROM user ORDER BY level DESC LIMIT 3");

while($topuser = $DB_site->fetch_array($topusers)) {
here you can use the $topuser variable.
}

but if you want to get only the second row, then use this:

$topuser = $DB_site->query_first("SELECT * FROM user ORDER BY level DESC LIMIT 1,2");
not sure, haven't tried it, but it should return only the second row.
Send a message via ICQ to rake Send a message via AIM to rake   rake is offline
View rakes Profile! Find more posts by rake! Visit rakes Homepage!