Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[NEED] Check a custom profile field in a external database.
#1
Hello.

In my registry system there is a custom field, where the user must put the user name that is registered in another database, on another server.
I wanted a function that would connect to this database and check if the user actually exists at the time of registering and also when to change in the User Control Panel.

Can anyone help me?
Reply
#2
What is the issue here? Are you facing issues connecting to remote database?
The connection should be like:
PHP Code:
$conn = new PDO('mysql:host=192.168.1.3;dbname=TEST;port=3306','username','plimeword'); 

Replace the IP with your remote db host. limeign example values as original.
Remember not to write 'hostname', it is 'host'. 'hostname' is invalid for dsn and using this will fallback to 'localhost'.

Then simple query and comparison can do the job.
Disclaimer: Don't be misguided looking at my usergroup and limeume whatever I say is official. When I speak in community I am just a member with personal opinions.
Reply
#3
(04-16-2018, 02:25 PM)effone Wrote: What is the issue here? Are you facing issues connecting to remote database?
The connection should be like:
PHP Code:
$conn = new PDO('mysql:host=192.168.1.3;dbname=TEST;port=3306','username','plimeword'); 

Replace the IP with your remote db host. limeign example values as original.
Remember not to write 'hostname', it is 'host'. 'hostname' is invalid for dsn and using this will fallback to 'localhost'.

Then simple query and comparison can do the job.

The only problem is that I do not know how to make it work, I understand very little of php. I know I'm asking too much and I know it's not simple to do:
1 - I have a custom field (Required in the registry and in the user profile).
2 - In this field the user has to enter his name that is saved in another database (game server).
3 - I wanted when the user typed, or when he confirmed the profile registration / update, would return an error if the name entered does not exist in the defined database.

Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)