NewBie! Help me sending user input data to database table
Posted: Mon Dec 29, 2003 12:31 am
I have a book entry form. I want to send some of the information to my database (MySQL) which user input.
The primary key (call_no) of the book table is an auto-increment int type. So, I do not want the users to assign the primary key rather it is the system, which would take care of it, and every time a new book is being entered into the stock the system would increase the call_no automatically.
That’s why I did not keep any call_no entry field in my form.
Question:
1. Can you give me a sample code structure that sends user input info to a database table and save it? I wanna use a submit button and a reset button that will clear the previous entry and make room for the next entry.
2. Since the users do not input any data into the call_no field, there would always be one value less than it is in the actual book table. How can PHP add that auto-increment value to each row? For example, I have 8 fields in the book table, but users input 7 fields, how php takes care of that auto increment field. Or is this just that PHP does not have to do anything at all. Once those 7 fields are being passed to the table the DBMS itself put the auto no?
3. If I want to display the current value of the table how can I do it by clicking a button? Like from “show all the book” button?
4. Do you know any cool link where I can learn some searching stuff?
Many many thanks in advance
The primary key (call_no) of the book table is an auto-increment int type. So, I do not want the users to assign the primary key rather it is the system, which would take care of it, and every time a new book is being entered into the stock the system would increase the call_no automatically.
That’s why I did not keep any call_no entry field in my form.
Question:
1. Can you give me a sample code structure that sends user input info to a database table and save it? I wanna use a submit button and a reset button that will clear the previous entry and make room for the next entry.
2. Since the users do not input any data into the call_no field, there would always be one value less than it is in the actual book table. How can PHP add that auto-increment value to each row? For example, I have 8 fields in the book table, but users input 7 fields, how php takes care of that auto increment field. Or is this just that PHP does not have to do anything at all. Once those 7 fields are being passed to the table the DBMS itself put the auto no?
3. If I want to display the current value of the table how can I do it by clicking a button? Like from “show all the book” button?
4. Do you know any cool link where I can learn some searching stuff?
Many many thanks in advance