Home >Backend Development >PHP Tutorial >Knock-PHP with MySQL, JSON, -phpmysqljson_PHP Tutorial

Knock-PHP with MySQL, JSON, -phpmysqljson_PHP Tutorial

WBOY
WBOYOriginal
2016-07-12 09:03:551013browse

knock-PHP with MySQL, JSON, -phpmysqljson

hi

Code~

1. php and mysql

5.4 Modify interface

The same interface and program.

Interface article.modify.php

b208591d3379a9b9027abd4a67b7a890
f353394f84fa2d8b14603b4f027ce290
8dc7f2d928fb4d37e355eddb9277ea5b
93f0f5c25f18dab9d176bd4f6de5d30e
97f2b6ae5f4f65bc7d15c6c9b9e8be8c
b2386ffb911b14667cb8f0f91ea547a7Untitled Document6e916e0f7d1e588d4f442bf645aedb2f
080b747a20f9163200dd0a7d304ba388
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
531ac245ce3e4fe3d50054a55f265927
9c3bca370b5104690d9ef395f2c5f8d1

6c04bd5ca3fcae76e30b72ad730ca86d
9ea27d0275302792e69cbca35403aa31
a34de1251f0d9fe1e645927f19a896e8
e6ad83ab497e230da4b3565c52354d7d8e99a69fbe029cd4e2b854e244eab143Backend management system128dba7a3a77be0113eb0bea6ea0a5d0b90dd5946f0946207856a8a37f441edf
5194ba175fd9c71e9a9f6e68244d73a8
a34de1251f0d9fe1e645927f19a896e8
83f4212ec992bc98817c6964fdaa358ee388a4556c0f65e1904146cc1a846bee6773c72bd9cbcac0b847af5136b8e9b9Publish article5db79b134e9f6b82c0b36e0489ee08ed94b3e26ee717c64999d7867364b1b4a3
e388a4556c0f65e1904146cc1a846bee03d65f3639bdfd01ef8ef185a1e8c4c0Manage article4a11e5928b3688cf38c9163b657eb5ac94b3e26ee717c64999d7867364b1b4a3 f2f8c79184db2cda899f23d9bbd9c1835db79b134e9f6b82c0b36e0489ee08edb90dd5946f0946207856a8a37f441edf
f057dcd9504fb06d6ce14b0c9f72eb6ce6efaa7663c34015b392ce606eb8b53b
263a1b61bab45cf7792f2870c6ae4ac5" />
8cd90dcd28cddbfc43e9125de32db4f4
a34de1251f0d9fe1e645927f19a896e8
9a2bb6d1b64570c9c7944801cbf3e642Modify articleb90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
869607f7a5db885bab7a1e67cd40bc84titleb90dd5946f0946207856a8a37f441edf
af0c4914484f1dc10ed1fa1d8a6c0228da58338324c635d359bdae23668cda498c1ecd4bb896b2264e0711597d40766c
< ;input type="text" name="title" id="title" value="a9440fa8616433e736b33543984ed1ad"/>b90dd5946f0946207856a8a37f441edf
2688fc03e5140d9bef12bef73424f836
a34de1251f0d9fe1e645927f19a896e8
b6c5a531a458a2e790c1fd6421739d1cAuthorb90dd5946f0946207856a8a37f441edf
b6c5a531a458a2e790c1fd6421739d1ccdab4a28d75bcb78c0ee640a4e49ea63"/>b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
b6c5a531a458a2e790c1fd6421739d1cIntroduction90cc1e42bbf9b97c5947038eac7f874e
b6c5a531a458a2e790c1fd6421739d1c2192b6d7889cc1f3779462482d58b1388c1ecd4bb896b2264e0711597d40766c
949acb445012f5f3a8e868df2e2c5559f3d633873abbe8a0504d0f9dcae6c0e140587128eee8df8f03d0b607fe983014b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
b6c5a531a458a2e790c1fd6421739d1cContent b90dd5946f0946207856a8a37f441edf
b6c5a531a458a2e790c1fd6421739d1cc74c863ba09c9e6cc6772e048b66f1037ee4fd3731e78fef47a3b9fbda2afc0f40587128eee8df8f03d0b607fe983014b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
b72d3e0fc7857976c6d0e2af718d1da357f35cb5b70cd80c4f17b76cffb35426b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
f16b1740fad44fb09bfe928bcc527e08
f5a47148e367a6035fd7a2faa965022e b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
7a02907c20434e1c153321b4510a39168e99a69fbe029cd4e2b854e244eab143Copyright128dba7a3a77be0113eb0bea6ea0a5d0 b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
f16b1740fad44fb09bfe928bcc527e08
36cc49f0c466276486e50c850b7e4956
73a6ac4ed44ffec12cee46588e518a5e

The key point is the reading of php and the php call of value in html.

Modify program article.modify.handle.php

392a60549ca019ed1bbf57562f31d8e5alert('Article modified successfully');window.location.href=' article.manage.php';2cacc6d41bbb37262a98f745aa00fbf0";
}else{
echo "3f1c4e4b6b16bbbd69b2ee476dc4f83aalert('Failed to modify article');window.location.href='article.manage.php ';2cacc6d41bbb37262a98f745aa00fbf0";
}
?>

5.5 Article Deletion

First do a demand analysis: It is slightly different from the above. Deleting an article does not require an interface, just a delete button to delete it . So there is only one file. The key sql statement is only one sentence

$delsql="delete from article where id=$id";

aritcle.del.handle.php

require_once('../connect.php');

//Read the id number. Unlike others that pass values ​​
$id = $_GET['id'];
$deletesql = "delete from article where id=$id";
if(mysql_query($deletesql) ){
echo "3f1c4e4b6b16bbbd69b2ee476dc4f83aalert('Article deleted successfully');window.location.href='article.manage.php';2cacc6d41bbb37262a98f745aa00fbf0";
}else{
echo "3f1c4e4b6b16bbbd69b2ee476dc4f83aalert('Failed to delete article');window.location.href='article.manage.php';2cacc6d41bbb37262a98f745aa00fbf0";
}
?>

5.6 Article Management List

Requirements analysis: A list displays all articles, followed by two buttons, Delete (link to the deleted module in the previous section) and Modify (link to the previous module)

So, you only need one file, just display the module

article.manage.php

38b907f9b712c3e9a049ddb23c8c12ae
7dbae950fec47d4baf649a20351858b7
68ccb177a5de0ef9542dde7d35bae727
93f0f5c25f18dab9d176bd4f6de5d30e
6889641c4b5f0f72b19e7ffabc82c0f8
b2386ffb911b14667cb8f0f91ea547a7Untitled Document6e916e0f7d1e588d4f442bf645aedb2f
080b747a20f9163200dd0a7d304ba388
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
9c3bca370b5104690d9ef395f2c5f8d1

6c04bd5ca3fcae76e30b72ad730ca86d
9ea27d0275302792e69cbca35403aa31
a34de1251f0d9fe1e645927f19a896e8
e6ad83ab497e230da4b3565c52354d7d8e99a69fbe029cd4e2b854e244eab143后台管理系统128dba7a3a77be0113eb0bea6ea0a5d0b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
aef77cad2279d5dbe29cd517f85309a1e388a4556c0f65e1904146cc1a846beef2f8c79184db2cda899f23d9bbd9c183发布文章5db79b134e9f6b82c0b36e0489ee08ed94b3e26ee717c64999d7867364b1b4a3
e388a4556c0f65e1904146cc1a846bee03d65f3639bdfd01ef8ef185a1e8c4c0管理文章5db79b134e9f6b82c0b36e0489ee08ed94b3e26ee717c64999d7867364b1b4a3b90dd5946f0946207856a8a37f441edf
cab2e0eb2b6a14d9d3fc0e99a26d03d2e96cc7a8570ca0192a89f6cabdd4e510
a34de1251f0d9fe1e645927f19a896e8
e5d60f02b0a575a6efead733b014e8a3文章管理列表b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
eb9c997c246d21af6c7e049b62317f33编号b90dd5946f0946207856a8a37f441edf
87c05eba041368fd143d4a8e77ce4839标题b90dd5946f0946207856a8a37f441edf
4ea2c9333bf5f8a3f0c7add6e36674c0操作b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
4d61c824e91b6e8ea2615db733ae67c9
a34de1251f0d9fe1e645927f19a896e8
17ec627c593f37401a286d876136ca3f 8ef339f36e8f45b302655906e29b0fb4b90dd5946f0946207856a8a37f441edf
17ec627c593f37401a286d876136ca3f 62cf44779f0e817b4a533c4e8d2b3f6fb90dd5946f0946207856a8a37f441edf
17ec627c593f37401a286d876136ca3f删除5db79b134e9f6b82c0b36e0489ee08ed 修改5db79b134e9f6b82c0b36e0489ee08edb90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
f16b1740fad44fb09bfe928bcc527e08b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
a34de1251f0d9fe1e645927f19a896e8
7a02907c20434e1c153321b4510a39168e99a69fbe029cd4e2b854e244eab143版权所有128dba7a3a77be0113eb0bea6ea0a5d0b90dd5946f0946207856a8a37f441edf
fd273fcf5bcad3dfdad3c41bd81ad3e5
f16b1740fad44fb09bfe928bcc527e08
36cc49f0c466276486e50c850b7e4956
73a6ac4ed44ffec12cee46588e518a5e

5.7 函数总结

mysqli_connect()

mysqli_select_db()

mysqli_query()

mysqli_error()

mysqli_fetch_assoc()

mysqli_num_rows()

六、前台管理界面的开发

6.1 文章列表

article.list.php

c15949648cdf8288e0bfc90c1e49a6b4
85ed68d7dfada1d22c39fefc425538d6
68ccb177a5de0ef9542dde7d35bae727
93f0f5c25f18dab9d176bd4f6de5d30e
93f4134200fbaea07288b4d6d3ee4f08
b2386ffb911b14667cb8f0f91ea547a7文章发布系统6e916e0f7d1e588d4f442bf645aedb2f
0ebbac6612164b53b6873c4856052de1
b71cca3b5c8dd9854cebafea413d7903
d9446244151c70e0784e5fac710017b8
9c3bca370b5104690d9ef395f2c5f8d1
6c04bd5ca3fcae76e30b72ad730ca86d
f005529f17a8328d00deaded84cdd461
885d62ccb7e7073052ccbb5d95afe261
ada442393f9f941237cb0e496c17b0f5
e10ab5513b15fdfc05a0ecf2f711572e
4a249f0d628e2318394fd9b75b4636b1ee7959cc8dd4be16ef633321c03dac32php与mysql2cdea26b4c3988e37d674b56660962a72eb235f530502820017cce1685312d595db79b134e9f6b82c0b36e0489ee08ed473f0a7621bec819994bb5020d29372a
c1a436a314ed609750bd7c7d319db4da2e9b454fa8428549ca2e64dfac4625cd
16b28748ea4df4d9c2150843fecfba68
6fe94dc97080d2a50cb38590b83c99e9
ff6d136ddc5fdfeffaf53ff6ee95f185
ef5dc968b76d5ea7ce8b8602c8c59a96daa82133ed999687cbc8fbda1de20792文章5db79b134e9f6b82c0b36e0489ee08edbed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c699d4e2cb62e3e8795ebfaa8f3c00a206关于我们5db79b134e9f6b82c0b36e0489ee08edbed06894275b65c1ab86501b08a632eb
25edfb22a4f469ecb59f1190150159c6527c555f81bbddecb148d7cac968948a联系我们5db79b134e9f6b82c0b36e0489ee08edbed06894275b65c1ab86501b08a632eb
929d1f5ca49e04fdcb27f9465b944689
16b28748ea4df4d9c2150843fecfba68
16b28748ea4df4d9c2150843fecfba68
1b9e17970470766f68c5157fa7288096
16b28748ea4df4d9c2150843fecfba68

7dbdfc863970ad32b837af26a285be77
2e6435b1c650e24d96a0e84f220b6333
fccb2af87397a62c26a7393addef0532
2e5b75b4e7112102b07f8e97327f44b2
c33d31893b052a559757edf37d66d4e4
b994dfffbc1e89ce6029c98990541e4d
527db218a609cb4e96157e28dc6f988cabe998dc78790b06e70f078b00eb20f198f9a04ca611ea6b8841d5dba0bafc34

string

 <span>'username'</span> <em>(length=8)</em>
  1 <span>=></span> 

string

 <span>'age'</span> <em>(length=3)</em>

["username","age"]

a:2:{i:0;s:8:"username";i:1;s:3:"age";}

--Commonly used JSON functions

json_encode()——JSON encryption

json_decode()——Decryption

1.3 JSON example explanation

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1077541.htmlTechArticle Knock on -PHP and MySQL, JSON, -phpmysqljson hi Knock on the code~ 1. The modification interface of php and mysql 5.4 is the same Interface and program. Interface article.modify.php ?php require_once('../connect.php'); //Read...