Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have three tables in a database. First table has primary key indno(auto increment), second table has indno ad foreign key and sn as a primary key(AI), third table has sn as foreign key and id as primary key(AI).
I made a form in html and and inserted values in that form from user using php,sql. I want to write query to fetch previous result into the form so that the logged in user may change and update the data if he/she whises to.

What I have tried:

There is an error in query.
i used- SELECT * FROM sailform6,sailform7,sailform8 where indno=$indno";
and in the form i used value= ""
Posted
Updated 2-Jun-16 5:42am
Comments
Prava-MFS 2-Jun-16 6:42am    
Provide the code what you tried and the exact error you are getting.

You need to use JOINS.

SELECT *
FROM sailform6 s6
LEFT JOIN sailform7 s7 ON s6.indno = s7.indno
LEFT JOIN sailform8 s8 ON s6.indno = s8.sn
 
Share this answer
 
Comments
PHP_OMG 2-Jun-16 11:39am    
Thank you so much for answering.
Do i have to make any change in my html form??
I am getting a blank screen.
ZurdoDev 2-Jun-16 11:53am    
No idea. I can't see anything that you have. I suggest opening a new question, tagging it as php and show the php code that you have.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900