I want to store one column value in array because it is auto incremented and also it is a primary key
and this values i want to insert into another table where that primary key refer as a foreign key
so anyone can help me to come out from this problem..
karan_5
0
Newbie Poster
Recommended Answers
Jump to PostPfew this maybe is a pretty vague description of your problem ^^. Could you be a bit more specific please?
You have two database columns which both have an INT field set as primary key, of which the one references to the other? And you want to store which value …
Jump to PostSo you have something like:
questions
id INT PRIMARY KEY AUTO_INCREMENTand
answers
id INT PRIMARY KEY AUTO_INCREMENT
question_id INT
FOREIGN KEY (question_id) REFERENCES (questions.id)right? And you need to know the ID of a question when you insert an answer? It seems to me that the ID of that …
Jump to PostOh sorry I thought that my answer had already solved your problem ^^. What I meant was (if I understand your case correctly) something like this:
<?php // Retrieve questions. Something like: $q = 'SELECT id, ... FROM questions ...'; // Handle the query... (I suppose you …
All 12 Replies
minitauros
151
Junior Poster
Featured Poster
karan_5
0
Newbie Poster
minitauros
151
Junior Poster
Featured Poster
karan_5
0
Newbie Poster
karan_5
0
Newbie Poster
minitauros
151
Junior Poster
Featured Poster
karan_5
0
Newbie Poster
minitauros
151
Junior Poster
Featured Poster
karan_5
0
Newbie Poster
karan_5
0
Newbie Poster
minitauros
151
Junior Poster
Featured Poster
karan_5
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.