The picture below is today's front desk and backstage, the front desk is applied to the template on the Friday. Backstage is handy to write.
I learned it today.
CSS overflow settings can be used to scroll bars or hide scroll bars if the content is over range
Overflow:hidden is hidden.
PHP has written another MySQL class. Super simple
[PHP]
/**
* Classes for MySQL operations
*/
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);
}
}
?>
/**
* Classes for MySQL operations
*/
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 we encounter tangled problems, interactive actions. It's a single entry form for MVC, but it's not going to be slow, and then I've taken a seemingly good solution.
1. Create the Action folder, set up type.php for the article column operation
2. Establish article.php for the article operation,
In this case, I use Ajax to send a request just "/action/type.php?action=list". Then do the code to determine what to execute. A 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
}
?>
http://www.bkjia.com/PHPjc/477348.html www.bkjia.com true http://www.bkjia.com/PHPjc/477348.html techarticle The following picture is the front desk and backstage, the foreground is to apply the template on the Friday. Backstage is handy to write. Today, I learned that CSS overflow set content beyond the range can be used to scroll bar ...