This topic is locked

Autonumber value in field during registration

9/9/2013 12:26:40 AM
PHPRunner General questions
S
seedavidwork author

I want to set up routine that assigns a new user a unique group number during registration. I've tried to piece together other suggestions but have failed to come up with a working solution. The goal is that each new registered user will have a ugroup_id in the user table that increases by one number from the previous highest group__id. This way the users (who will be administrators of their own groups) can pass on their assigned ugroup_id to any additional users they create inside the application.
Here is where I am so far
BEFORE REGISTRATION EVENT

global $conn;

$maxg = "SELECT max(ugroup_id) as mx from user ";

$group = "mx"+1;

$values["ugroup_id"]=group;

db_exec($maxg,$conn);

Sergey Kornilov admin 9/9/2013

This code doesn't make any sense.
Take a look at examples of data retrieval at http://xlinesoft.com/phprunner/docs/customquery.htm (example 2).