php - Advice on SQL structure and maybe JOIN? -


i made similar thread month realized didn't ask right questions. i'm gonna try again.

i have database 2 tables, 1 user-table , 1 fish-table.

in user-table have user_id, username, email etc etc.(user_id pk).

in fish-table have fish_id, weight, length etc etc. (fish_id pk).

when user logged in able register fish. problem occurs. i need know user has registered fish.

"$query = $this->db->prepare("insert `fish` (`fish`, `weight`, `length`, `lure`, `comment`) values (?, ?, ?, ?, ?) ");" 

that how query looks like. assume have make user_id column in fish-table have no idea how register user_id uploaded fish.

all appreciated. thanks!

you add user_id column fish table said. when user registers fish, you'd have insert user_id @ same time. suppose use sessions keep users logged in, should have session variable containing user id.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -