PHP cannot write HTML form data to MySQL database mysql database form
PHP is getting started. I am trying to write a library database, and there are some problems with database writing.
Total interface module
Data processing for book entry-collection of books
Approve preview data
'; Echo 'cip book in version cataloguing:'. $ CIP .'
'.'Title: '. $ title .'
Title: '. $ subtitle .'
Series Name: '. $ series .'
'; $ Creator1loc = code2loc ($ creator_loc_id1); echo'Author 1: ['. $ creator1loc.'] '. $ creator_1 .'
'; $ Creator2loc = code2loc ($ creator_loc_id2); echo' Author 2: ['. $ creator2loc.'] '. $ creator_2 .'
'; $ Publoc = code2loc ($ publoc_id); echo'Published by '. $ publoc.'. $ publisher .'
'; $ Language = code2lang ($ lang_id); echo ''. $ language. 'release version is '. $ edit_date. 'Di '. $ edit_no. 'version '. $ version_date. 'Di '. $ version_no. secondary printing
'; Echo'Keyword Group 1: '. $ subj_key_1 .'? '. $ Subj_key_2 .'? '. $ Subj_key_3 .'
'; $ Clssys1 = code2clssys ($ clssys_id_1); echo 'keyword Group 2:'. $ subj_key_4 .'? '. $ Subj_key_5 .'? '. $ Subj_key_6 .'
'; $ Clssys1 = code2clssys ($ clssys_id_1); echo $ clssys1. 'classification:'. $ class_no_1 .'
'; $ Clssys2 = code2clssys ($ clssys_id_2); echo $ clssys2. 'classification:'. $ class_no_2 .'
'; $ Priceunit = code2punit ($ punit_id); echo'Price '. $ price. $ priceunit.'. number of Tibetan books '. $ amount.'. Related Books ISBN '. $ rlt_isbn .'
'; Echo'Remarks '. $ noteinfo .'
'; Echo 'database write information'; include 'Insert. php';/* load data into the database module */?>
- /"> 《 "Page on Douban
- "> 《 Pages on Amazon (China website)
Confirm to add
Developed by SJHSTONE in 2014.
Database connection module (dbconnect. php)
Insert. php)
All values referenced from $ POST _ [] global variables can be correctly displayed during echo,
Connect to and write 13-bit ISBN and 10-bit CIP data in the libr_metacode table,
However, data in other tables cannot be written.
The following table structures are involved:
Libr_metacode-> meta_isbn char (13) primary key-> meta_cip int (10) libr_title-> meta_isbn char (13) primary key-> title varchar (70)-> subtitle varchar (50) -> series varchar (30) libr_author (one-to-many)-> rec_id int (5) auto-numbered primary key-> creator varchar (30)-> creatorloc_id int (3)
If you are interested, go to http://sjhstone.name/book/sandbox.rarto check the source code proposal and the password forcsdn (the running environment is WampServer on Windows)
Reply to discussion (solution)VALUES ('$ isbn', '$ cip ')";
Escape all
Addslashes ($ isbn)
Or
Mysql_real_escape_string ($ isbn)
Shape like
Or die ('unable to write data block 1 ');
Is changed to shape
Or die ('unable to write data block 1'. mysqli_error ($ dbc ));
You can know where the problem is.
VALUES ('$ isbn', '$ cip ')";
Escape all
Addslashes ($ isbn)
Or
Mysql_real_escape_string ($ isbn)
They are all characters that do not need to be escaped, and they are only tested locally, so they do not need to be injected ......
Thank you!
Shape like
Or die ('unable to write data block 1 ');
Is changed to shape
Or die ('unable to write data block 1'. mysqli_error ($ dbc ));
You can know where the problem is.
I have never seen this error correction function before.
By the way, I would like to explain where there are reference commands.
Everything is in the PHP Manual