PDA

View Full Version : Need help for saving a variable result to db


emucu
12-26-2008, 09:49 PM
Hello,

I want to save specific information of visitor , for example browser info, while user is registered. So instead of asking to user i can get user's browser info with a variable like $browserinfo, by another method.

So here is the main question, how can i store result of $browserinfo to database?

So its basicly like a profilefield, user choose an option or write and its stored at user table. You can print it using $post[fieldx] code.

I was planning to do it using profilefield but couldnt manage to do it.

So finally, when you register (when registration form loads) using that code it will determine your browser name, and it will save browser name to database

Lynne
12-26-2008, 10:02 PM
It's unclear to me whether you are asking the user to set this field or whether you are going to write code to determine this field. If you are going to ask the user, then just use a profile field (you said you tried, but couldn't, so tell us exactly what you did and what the result was), if you are going to write some code to do it, one way would be to create a new column in the user table, add that column into the validfields for the user datamanager (class_dm_user.php), and then use the datamanager to save the information for you upon registration.

emucu
12-26-2008, 10:18 PM
Sorry for not being clear, i just want to save result of $browserinfo variable to database thats the main question.

But dont know how to do it ?

Instead of making that much effort, , i think i can create a fake profilefield so i can directly put result in that table

so example is , result of $browserinfo will be stored in userfield table field8 coloumn for each user when they register

I am a total noob about php so i can't get it so easily

Guest190829
12-26-2008, 10:33 PM
What went wrong when trying to use a custom profile field? That seems like the easiest solution (but it will only be updated when the user decides to update it.)

emucu
12-26-2008, 10:41 PM
The point is,

When i create a single line text field and put $browserinfo as default value, it shows it as $browserinfo instead of result of variable, for example Internet Explorer. Not sure if there is any coding problem or if it is because i can't put $browserinfo in profile field because it is php.

Guest190829
12-26-2008, 10:51 PM
Why not just create a single selection drop of browsers?

emucu
12-26-2008, 10:54 PM
than user gives false information, which i tried already :)

Dismounted
12-27-2008, 03:20 AM
UA headers are not hard to fake either, you know...