The following figure shows the front-end and back-end. the front-end uses the template last Friday. the background is hand-written. today, I learned that css overflow settings are out of range. I can give the scroll bar or hide the scroll bar overflow: hidden is another mysql class for hiding php. super... "/> <scripttype =" text/javascript "src
The following figure shows the front-end and back-end. the front-end uses the template of last Friday. the back-end is hand-written.
Today I learned
When the css overflow settings are out of the range, you can give the scroll bar or hide the scroll bar.
Overflow: hidden is hidden.
I wrote another mysql class in php, which is super simple.
[Php]
/**
* Mysql operation class
*/
Class db_mysql
{
Var $ conn;
Function _ construct ($ localhost, $ userName, $ password, $ dbName)
{
$ This-> conn = mysql_connect ($ localhost, $ userName, $ password );
Mysql_select_db ($ dbName, $ this-> conn );
Mysql_query ("set names utf8", $ this-> conn );
}
Function _ destruct ()
{
Mysql_close ($ this-> conn );
}
Function query ($ SQL)
{
// Echo $ SQL;
Return mysql_query ($ SQL, $ this-> conn );
}
}
?>
/**
* Mysql operation class
*/
Class db_mysql
{
Var $ conn;
Function _ construct ($ localhost, $ userName, $ password, $ dbName)
{
$ This-> conn = mysql_connect ($ localhost, $ userName, $ password );
Mysql_select_db ($ dbName, $ this-> conn );
Mysql_query ("set names utf8", $ this-> conn );
}
Function _ destruct ()
{
Mysql_close ($ this-> conn );
}
Function query ($ SQL)
{
// Echo $ SQL;
Return mysql_query ($ SQL, $ this-> conn );
}
}
?>
Today I encountered a tangle of problems, interactive actions... I wanted to write a single entry form of mvc, but the speed of code writing would not be slow, and then I took a solution that seems good all the time.
1. create the action folder and type. php for article column operations.
2. create article. php for document operations,
In this case, I only need to "/action/type. php? Action = list "get it done. then execute the corresponding code to determine what to execute. the switch statement is used.
[Php]
? Php
Require '../inc. php ';
Switch ($ _ GET ['action']) {
Case 'submit ':
If (! Empty ($ _ POST ['typename']) {
$ Json ['state'] = "no ";
$ Bool = $ db-> query ("insert into typename ('name') value ('{$ _ POST ['typename']}')");
If ($ bool ){
$ Json ['state'] = "OK ";
} Else {
$ Json ['error'] = 'column insertion failed ';
}
Echo json_encode ($ json );
}
Break;
Case 'List ':
$ Result = $ db-> query ('select * from typename ');
$ Arr = array ();
While ($ row = mysql_fetch_assoc ($ result )){
$ Arr [] = $ row;
}
Echo json_encode ($ arr );
Break;
Default:
# Code...
Break;
}
?>
Require '../inc. php ';
Switch ($ _ GET ['action']) {
Case 'submit ':
If (! Empty ($ _ POST ['typename']) {
$ Json ['state'] = "no ";
$ Bool = $ db-> query ("insert into typename ('name') value ('{$ _ POST ['typename']}')");
If ($ bool ){
$ Json ['state'] = "OK ";
} Else {
$ Json ['error'] = 'column insertion failed ';
}
Echo json_encode ($ json );
}
Break;
Case 'List ':
$ Result = $ db-> query ('select * from typename ');
$ Arr = array ();
While ($ row = mysql_fetch_assoc ($ result )){
$ Arr [] = $ row;
}
Echo json_encode ($ arr );
Break;
Default:
# Code...
Break;
}
?>