我正在创建一个注册用户的MySQL数据库,我想将md5用于密码,也用于电子邮件.
我认为这个选择可以提高用户安全性,但我还不是数据库的专家,我不确定这是否明智!
我希望这不是一个愚蠢的问题!
我正在尝试将标签序列添加到列表主题中.我不会创建唯一的tag列字段,因为我可能具有相同的副本,具体取决于用户语言,如示例中所示
table_houses
id name location
1 Victoria's Home New York
2 Black Mesa Lab New Mexico
3 Tube London
table_tags
id tag id_subjects language
1 garage 1 it
2 garage 2 fr
3 research 3 en
4 lab 3 en
5 laboratorio 3 it
6 garage 1 it <== how to avoid this duplicated INSERT like first row?
Run Code Online (Sandbox Code Playgroud)
我已经看到一些人们使用INSERT IGNORE INTO语句的例子,但我已经知道它仅适用于唯一的列,它用于跳过重复的错误.
是否存在某种方法只跳过同一种语言的重复标签?
我想知道是什么之间的差异$(this),并this在jQuery,并最终找到一种方式来获得$(this)从对象this(this是什么?):
var last_btn;
$("#element").click (function () {
if (last_btn != null && last_btn == this) {
// to unselect the current button
last_btn.removeClass ("selected"); // doesn't work because this is not $(this)
} else {
if (last_btn != null) last_btn.removeClass ("selected"); // to unselect another old button
last_btn = this;
$(this).addClass ("selected");
}
});
Run Code Online (Sandbox Code Playgroud)
正如本文所述,我需要使用this而不是$(this)对象,因为这是将jQuery对象分配给var而不会松散其实例的唯一方法.
我怎样才能做到这一点?
我正在尝试为我的后台input文本编写一个简单的剩余字符计数器,jQuery但它不起作用:
<script type="text/javascript">
$(document).ready(function(){
function text_counter (input_text, target) {
var max = $(input_text).attr("maxlength");
$(input_text).keydown (function () {
var timer = setTimeout (function () {
var text = $(input_text).text();
var current = text.length;
$(target).text(current + "/" + max);
}, 1);
});
}
text_counter ("#description", "#description_counter");
});
</script>
<input id="description" type="text" maxlength="250" value="Default text">
<span id="description_counter"></span>
Run Code Online (Sandbox Code Playgroud)
如果我开始在里面写input,那么span元素会在12/250这里变化并冻结(12 =="默认文本".length).
哪里我错了?
我正在编写一个jQuery插件,我需要使用一个$.ajax请求并使用附加参数处理回调,但我发现很难实现它.
简化版:
$('#element_id').click (function () {
var additional_params = { name:'mike', surname:'buongiorno' };
var ajax_params = {
type: "POST",
url: "some.php",
data:'data here',
complete:getResponse
}
sendAJAX (ajax_params, additional_params);
});
var sendAJAX = function (ajax_params, additional_params) {
$.ajax(ajax_params, additional_params);
}
var getResponse = function (data, additional_params) {
}
Run Code Online (Sandbox Code Playgroud)
确实存在某种方式做这样的事情传递additional_params给complete回调函数(在这种情况下getResponse)?
我试图做我的第一个步骤,CakePHP 2 console与Leopard和XAMPP,但我得到哪些不是很清楚,我的许多问题.
在CakePHP 2.0指南编写我需要正确/app/Config/database.php to设置确保它的工作,然后我用用户注册测试它,一切正常.
然后我读过我可以通过shell调用命令:
$ cake schema create DbAcl
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为我必须写入right path控制台应用程序,然后:
$ /Users/username/.../site.com/lib/Cake/Console/cake schema create DbAcl
Run Code Online (Sandbox Code Playgroud)
完成后,我收到此错误:
Welcome to CakePHP v2.0.4 Console
---------------------------------------------------------------
App : username
Path: /Users/username/
---------------------------------------------------------------
Cake Schema Shell
---------------------------------------------------------------
/Users/username/Config/Schema/db_acl.php could not be loaded
iMac-Name:~ username$
Run Code Online (Sandbox Code Playgroud)
我的CakePHP安装位于以下文件夹中site.com:
site.com/app
site.com/lib
site.com/plugins
site.com/vendors
site.com/etc.
Run Code Online (Sandbox Code Playgroud)
所以我这样做是为了将CakePHP文件夹更改为名为的安装文件夹 site.com
$ /Users/username/.../site.com/lib/Cake/Console/cake -app /Users/.../site.com
Run Code Online (Sandbox Code Playgroud)
现在我收到这条消息:
Welcome to CakePHP v2.0.4 Console
---------------------------------------------------------------
App : site.com
Path: …Run Code Online (Sandbox Code Playgroud) 好吧,我不确定我mobile first和non mobile first响应式布局之间有什么区别?
这就是我所知道的,也许有些事情是不对的:
我看到bootstrap设置和foundation设置之间存在差异,这种差异是否重要?
<!-- Bootstrap -->
<!-- I've read it's not mobile first -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Foundation -->
<!-- I've read it's mobile first -->
<meta name="viewport" content="width=device-width">
Run Code Online (Sandbox Code Playgroud)
最后,我所知道的,还有更多值得了解的东西吗?
哪里可以找到一个好的指南?
我第一次尝试使用日期,我用Flash做了一些事情,但它有所不同.
我有两个不同的日期,我希望看到他们与小时和天的差异,我发现了太多的例子,但不是我喜欢的东西:
<?php
$now_date = strtotime (date ('Y-m-d H:i:s')); // the current date
$key_date = strtotime (date ("2009-11-21 14:08:42"));
print date ($now_date - $key_date);
// it returns an integer like 5813, 5814, 5815, etc... (I presume they are seconds)
?>
Run Code Online (Sandbox Code Playgroud)
如何将其转换为小时或天?
我有一个table地方如果用户已经达到了一些像3 penalities的我应该算的,所以如果用户达到或超过3分,他被禁止:
table_warnings
- id
- user_id
- warning
- warning_date
id user_id warning warning_date
1 5478 1 2010-02-25 12:59:00
2 5478 1 2010-02-28 08:27:00
3 5478 2 2010-03-01 22:44:11
Run Code Online (Sandbox Code Playgroud)
我已经开始提出这个问题了,用户KM帮助我解决了SELECT类似这样的解决方案:
SELECT COUNT(warning)
FROM table_warnings AS w
INNER JOIN table_users AS u
ON w.user_id = u.user_id
WHERE w.user_id = 5478 AND warning_date >= '2010-02-05 12:59:00'
HAVING COUNT(warning) >= 3
Run Code Online (Sandbox Code Playgroud)
我可以找到一种方法SELECT来检索用户在过去30天内获得了多少个点数吗?
这可能是非常容易和简单的,但我还没有使用它,我如何从PHP获得相同类型的动态数量的输入文件?
我有一种情况,我想做一个动态数量的输入发送到PHP页面,如下所示:
使用jQuery,我可以添加这些输入来增加或减少字符数:
<!-- value is the character id -->
<tr><td><input type="checkbox" name="character" value="1256"></td></tr>
<tr><td><input type="checkbox" name="character" value="85"></td></tr>
<tr><td><input type="checkbox" name="character" value="901"></td></tr>
<tr><td>etc...</td></tr>
Run Code Online (Sandbox Code Playgroud)
我在表的末尾有一个输入提交,以便将数据发送到我的php页面,如何获取所有这些字符?我应该直接做某事AJAX还是可以通过$_POST变量处理?