newlearner2005
Programmer
Hello All,
I would appreciate if anybody can help me about this.
Here is the problem:
I have "registration" database, I created a "user_info" table very simply as follow
CREATE TABLE user_info (
username varchar(50) NOT NULL,
password varchar(255) NOT NULL,
userId int(10) NOT NULL,
PRIMARY KEY (userId)
);
I created a "upload" table as follow:
CREATE TABLE upload (
id int NOT NULL auto_increment,
postId int NOT NULL default '0',
name_of_file varchar(30) NOT NULL,
type_of_file varchar(30) NOT NULL,
size_of_file int NOT NULL,
content_of_file MEDIUMBLOB NOT NULL,
PRIMARY KEY (id)
);
My question is how to pass userId from "user_info" table and assign it to postId of "upload" table?
Somebody told me I need two steps:
1- Store userId in SESSION['userId'], but I did not know how ? Please show me ? One or two lines of yours is very useful to help me instead of I waisted a lot of times to figure it out. ( I did but I still did not know)
2- Use Query Insert that "userId" into "postId" of "upload" table.
Thank tyou very much in advance.
newlearner2005
I would appreciate if anybody can help me about this.
Here is the problem:
I have "registration" database, I created a "user_info" table very simply as follow
CREATE TABLE user_info (
username varchar(50) NOT NULL,
password varchar(255) NOT NULL,
userId int(10) NOT NULL,
PRIMARY KEY (userId)
);
I created a "upload" table as follow:
CREATE TABLE upload (
id int NOT NULL auto_increment,
postId int NOT NULL default '0',
name_of_file varchar(30) NOT NULL,
type_of_file varchar(30) NOT NULL,
size_of_file int NOT NULL,
content_of_file MEDIUMBLOB NOT NULL,
PRIMARY KEY (id)
);
My question is how to pass userId from "user_info" table and assign it to postId of "upload" table?
Somebody told me I need two steps:
1- Store userId in SESSION['userId'], but I did not know how ? Please show me ? One or two lines of yours is very useful to help me instead of I waisted a lot of times to figure it out. ( I did but I still did not know)
2- Use Query Insert that "userId" into "postId" of "upload" table.
Thank tyou very much in advance.
newlearner2005