var form = document.getElementById('some_form')
form.addEventListener('submit', function (event) {
console.log('Form elements', form.elements)
event.preventDefault()
// Do your Chrome Storage stuff here with form elements
})
答案 0 :(得分:0)
请注意, mysql _ 已弃用,但您可以使用限制:
mysql_query("DELETE FROM l2 WHERE
data IN (
SELECT Top 10 data
FROM l2
ORDER BY data desc
LIMIT 10
)", $con);
答案 1 :(得分:0)
正如其他人所提到的,你真的应该使用更现代的扩展来连接MySQL数据库。 PDO是一个不错的选择:
<?php
$dbConn = new \PDO(
'mysql:host=localhost;dbname=my_db;charset=utf8',
'user',
'password',
[\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION]
);
$sql = <<<SQL
DELETE FROM l2 WHERE data NOT IN (
SELECT data FROM (SELECT data FROM l2 ORDER BY data DESC LIMIT 10) d
)
SQL;
$dbConn->exec($sql);
答案 2 :(得分:0)
<?php
$dbh = new PDO('mysql:host=localhost;dbname=deletelimit10', "root", "");
$query = $dbh->query("DELETE FROM content
WHERE
name NOT IN (
SELECT * FROM (
SELECT name
FROM content
ORDER BY name DESC
LIMIT 10) k
)"); // Run your query
?>
运行complet PDO后,我们只有10行。
完成PDO:
$attributes = array(
'config' => array(
'conditions' => array()
),
"effects" => array(array(
"attributes" => array(array(
'attribute_id' => "comment.value",
'label' => "Comment",
'required' => true,
'substitutions' => array(),
'type' => "text",
'value' => "This is a test comment from flow"
)),
'type' => "comment.create",
)),
'name' => 'Test Flow via API',
'type' => 'item.create'
);
这&#34; k&#34;是:每个派生表(AKA子查询)必须确实有一个别名。即括号中的每个查询都必须给出一个别名(AS无论如何),可以用来在外部查询的其余部分中引用它。 我的表名是&#34; name&#34;表中的列名称为&#34; name&#34;。