Note that there are some explanatory texts on larger screens.

plurals
  1. POphp SQL how to keep data and maybe autoincrement instead of replacing record in a field
    text
    copied!<p>an sql database 'test' having table 'patients' and within table is a field 'prescription' of datatype varchar (200 max length) currently hosts inputted text and numbers.</p> <p>I'm able to fetch prescription record from the table and display it, then am able to update it through a textbox which happens to overwrite the record in the field 'prescription.</p> <p>what should I look at doing in order of preserving the record in prescription field, yet write the new one/new prescription? BTW the table row has an 'id' field serving as primary key. </p> <p>I'm looking at keeping previous prescriptions, whilst writing new ones, and always fetch the most recent one kindof as what it currently does. Later I'll have to look at an option of displaying all available prescriptions for a distinct 'id'. </p> <p>here is the code that uses the input 'id' by user to fetch table fields: <a href="http://pastebin.com/gNv881kR" rel="nofollow">http://pastebin.com/gNv881kR</a></p> <p>The below link shows the code that updates the prescription field: <a href="http://pastebin.com/6sq7ZEtp" rel="nofollow">http://pastebin.com/6sq7ZEtp</a></p> <p>Thanks for replying everyone, but what about other patient's prescriptions within same table. as currently table has column 'id', full_name, 'address, 'email', ... 'prescription'. Also I forgot to tell that id is an aplhanumeric value which eg: 232987M which is governmental ID. should I create another table, include current id to use as primary key to search for records using it in new table, and have prescription column and 'id2' which auto increments and copies patient's actual 'id' to assign the prescription and will later fetch all with that 'id' irrispective of the incremented 'id2' ?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload