Page 1 of 1

Please HELP! SQL Nigtmare

Posted: Wed Feb 09, 2011 8:16 am
by ppwalks
Hello,
I am new to php programming and one obstacle has got me stuck now for several days and driving me insain, please if someone could point me in the right direction i would be ever so grateful. As part of a project at college I have been given an assignment to post data to sql database and then retrieve all the fields and output them to page, all is well up to now.

i have made the form which successfully submits data to sql and i have been able to the echo the appropraite variables back to page. The problem I have is when I submit the form it sends all fields, if I wanted to only change 2 fields then it would overwrite the whole thing then display the 2 fields inserted only, i want it to display the data before the new row has NULL atributes in them. Please can somebody help!

Thankyou

Paul

Re: Please HELP! SQL Nigtmare

Posted: Wed Feb 09, 2011 1:41 pm
by VladSun
You should check whether the record ID exists or not. A "save" method is either an "update" or "add" method depending on the record ID existence.

Google for "PHP CRUD".