我试图运行MongoDB:
E:\mongo\bin>mongod
mongod --help for help and startup options
Sun Nov 06 18:48:37
Sun Nov 06 18:48:37 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.
Sun Nov 06 18:48:37
Sun Nov 06 18:48:37 [initandlisten] MongoDB starting : pid=7108 port=27017 dbpath=/data/db 32-bit host=pykhmer-PC
Sun Nov 06 18:48:37 [initandlisten]
Sun Nov 06 18:48:37 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
Sun Nov 06 18:48:37 …Run Code Online (Sandbox Code Playgroud) 我正在使用MySQL和PHP 5.3并尝试此代码.
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$con = mysql_connect("localhost", "root", "");
mysql_set_charset('utf8');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("kdict", $con);
$sql = "SELECT * FROM `en-kh` where english='a'";
echo $sql;
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
echo $row['english'] . " </br> " . $row['khmer'];
echo "<br />";
}
?>
Run Code Online (Sandbox Code Playgroud)
=>我得到了很好的UTF-8渲染显示,做得很好.
但是现在我创建了一个类PDO,以便于扩展和更容易
class crud {
// code..
public function conn()
{
isset($this->username);
isset($this->password);
if (!$this->db instanceof PDO)
{
$this->db = new …Run Code Online (Sandbox Code Playgroud) 我发现了这个案子
**php示例**
abstract class class1{
function test(){}
}
abstract class class2 extends class1{
abstract function test();
}
Run Code Online (Sandbox Code Playgroud)
这个oop概念在Java中运行,在PHP中它没有.(Cannot make non abstract method class1::test() abstract in class class2)
Java和PHP oop之间还有哪些细微差别?
<?php
$sth = $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();
/* Fetch all of the remaining rows in the result set */
print("Fetch all of the remaining rows in the result set:\n");
$result = $sth->fetchAll();
print_r($result);
?>
Run Code Online (Sandbox Code Playgroud)
上面的示例将获取结果集中的所有剩余行,并输出类似于:
Array
(
[0] => Array
(
[NAME] => pear
[0] => pear
[COLOUR] => green
[1] => green
)
[1] => Array
(
[NAME] => watermelon
[0] => watermelon
[COLOUR] => pink
[1] => pink
)
)
Run Code Online (Sandbox Code Playgroud)
是否有任何选项可以获得像my_sql_fetch_array返回的结果,如下所示:
Array
(
[0] …Run Code Online (Sandbox Code Playgroud) 我有一个输入标记字段,我想获取所选择的tages的ID所以我尝试了http://jsfiddle.net/u8zj5/19/但我的问题我想得到的id不是标签或值传递到id="show"但我失败了.
<input type="text" id="field1" name="field1" value=""/>
<span id="show">show ID here</span>
jQuery(document).ready(function(){
var availableTags = [{"id":"144","label":"Allicelabel","value":"Allice value"}];
jQuery("input#field1").each(function(){
var target = jQuery(this);
var currenttags = target.val();
target.hide()
.after("<ul class=\"tags\"><li>"+currenttags+"</li></ul>");
var instance = target.next();
instance.tagit({
tagSource:availableTags,
tagsChanged:function () {
var tags = instance.tagit('tags');
var tagString = [];
for (var i in tags){
tagString.push(tags[i].value);
}
$("#show").html(tagString.join(','));
},
sortable:true,
triggerKeys: ['enter', 'comma', 'tab']
});
});
Run Code Online (Sandbox Code Playgroud)
});
使用jQuery Tagit(演示页面)的任何人都可以帮我解决这个问题
我有
list('327VUQ56156TX374');
['3', '2', '7', 'V', 'U', 'Q', '5', '6', '1', '5', '6', 'T', 'X', '3', '7', '4']
Run Code Online (Sandbox Code Playgroud)
我希望得到像这样的数组关联,它的索引.[ 1=>'3',... 16=>'4' ]
有人可以告诉我,谢谢
我有一个
$a = array(9=>"a",8=>"c",5=>"d");
Run Code Online (Sandbox Code Playgroud)
我想对数组的唯一键进行排序$a并保持值的顺序.
所以它会 array(5=>"a",8=>"c",9=>"d");
我怎么能在php数组中做?
我用root运行了这个命令:
[root@localhost git-shell-commands]# ssh git@192.168.1.12
git@192.168.1.12's password:
Last login: Wed Jun 20 15:08:26 2012 from new-host.home
fatal: Interactive git shell is not enabled.
hint: ~/git-shell-commands should exist and have read and execute access.
Connection to 192.168.1.12 closed.
[root@localhost git-shell-commands]#
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉如何解决这个问题?
我的表有这样的数据结构
cate_id task_id date_start date_end other
34 14 2012-06-27 10:21:39 2012-06-27 10:21:42 Volume
34 14 2012-06-27 10:21:42 2016-01-01 00:00:00 Volume
UPDATE tbl SET other ='new'
WHERE task_id =14
AND cate_id=34
AND DATE_FORMAT('date_start','%Y-%m-%d')='2012-06-27'
AND DATE_FORMAT('date_end','%Y-%m-%d')='2016-01-01';
Run Code Online (Sandbox Code Playgroud)
我的目标只是将日期与格式'%Y-%m-%d'进行比较,而不是整个值.
可以像上面的mysql脚本一样吗?因为它成功执行了sql脚本,但是没有更新我具体的col?有人可以告诉我吗?谢谢