Jump to content

[Help] MySQL phpMyAdmin [Help]

Hi, i need help guys.

How can i make there on my Database when user is registred 'user_id' is AUTO_INCREMENT and i have two tables in on database.

Database name: pelqimetemia
Table 1: users

Table 2: balance

 

and what i want is a new registred user goes to users, i need to automatically send user_id from users to user_id bilance. same user_id in table users same for user_id bilance for that user.

Thanks
 

post-303240-0-36362300-1453144187.png

 

post-303240-0-38817600-1453144188.png

 

post-303240-0-92223700-1453144188.png

 

Link to comment
https://linustechtips.com/topic/529776-help-mysql-phpmyadmin-help/
Share on other sites

Link to post
Share on other sites

You can user trigger (example: http://www.techonthenet.com/mysql/triggers/after_insert.php ) just after inserting your user you can get last insert id and insert new balance row with new user id, it somehow depends on language you use and driver but, I say kind of because mysql has a function  LAST_INSERT_ID that you can use in a query and it will return last inserted id per client, so even if your driver doesn't wrap it up you can use it directly by.

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×