![]() |
How do i get the userid from the username?
What is the easiest way to get a userid based on the username in php script? thanks.
|
The query would be:
PHP Code:
|
Could you explain a bit more please mate?
|
ah ok :)
|
How do you connect to the database??
|
Use a script like this:
PHP Code:
|
PHP Code:
|
neither worked??
|
Save mine as script.php and upload it to your forums directory and then go youforums.com/script.php. It should work
|
This page is not gonna be in the forum directory.
|
The result for the script echos this "The userid for is ". I specify a username that exists case sensitive.
|
It should still work if you replace
PHP Code:
PHP Code:
|
Quote:
Sorry!:) |
I put
chdir("/mainforum/"); require("./global.php"); i have the file in the root and my directory is mainforum |
The directory is REALLY /mainforum?
I doubt that ... except you are in a chroot-jail. More likely it is smt.h like /var/htdocs/youraccount/html/mainforum |
I have a situation where I also need to convert a USERNAME from a template to a USERID inside a main php file....
I tried to use the code above in my file like this: Code:
$getuser = $vbulletin->db->query(" Quote:
I would really appreciate any help! |
you can use
PHP Code:
$user['userid'] will then contain the userid |
Can we please keep vB3.5 questions and solutions in the vB3.5 forum. This to avoid confusion.
|
All times are GMT. The time now is 04:50 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|