小编Cla*_*ont的帖子

在MongoDb中查找下一个文档

如果这是我的收藏结构:

{   "_id": ObjectId("4fdbaf608b446b0477000142"),
    "name": "product 1",
},
{   "_id": ObjectId("fghfghfgjhjghkgk"),
    "name": "product 2",
},
{   "_id": ObjectId("fghfghfgjhjghkgk"),
    "name": "product 3",
}
Run Code Online (Sandbox Code Playgroud)

我查询产品1,有没有办法查询下一个文件,在这种情况下,产品2?

php mongodb

7
推荐指数
2
解决办法
3440
查看次数

CodeIgniter GROUP_CONCAT并加入

我试图找到一种方法将这两个表连接在一起,我能够做到,但如果找到多个匹配的值,它会再次显示产品表中的所有内容.现在我试图将MySQL group_concat一起使用,以便能够在数组中的一个字段中列出所有tName但是我一直在使用MySQL收到错误:

错误号码:1064

您的SQL语法有错误; 检查与MySQL服务器版本对应的手册,以便在第2行的'FROM(sp_product)LEFT OUTER JOIN sp_product_typeON sp_product_type.`tCat' 附近使用正确的语法

选择sp_product.name,sp_product.price,sp_product.perm_name,sp_product.description,GROUP_CONCAT(product_type.tName SEPARATOR FROM(sp_product)LEFT OUTER JOIN sp_product_typeON sp_product_type.tCategory= sp_product.typeWHERE perm_name='bacon'

$this->db->select('product.name, product.price, product.perm_name, product.description, GROUP_CONCAT(product_type.tName SEPARATOR ',') as product_type.tName'); 
$this->db->from('product');
$this->db->where('perm_name', $this->uri->segment(2));
$this->db->join('product_type', 'product_type.tCategory = product.type', 'LEFT OUTER');
$query = $this->db->get(); 
Run Code Online (Sandbox Code Playgroud)

我有什么想法我做错了吗?

php mysql codeigniter

6
推荐指数
1
解决办法
2万
查看次数

从数据库创建Google Sitemap

我正在尝试从我的数据库提供的信息为谷歌创建一个站点地图,一切正常,除非我尝试使用image:image和image:loc我在我的xml文件中收到此错误:

此页面包含以下错误:

第17行第8行的错误:未定义图像上的命名空间前缀图像

下面是第一个错误之前的页面呈现.

我的代码:

//create the xml document
$xmlDoc = new DOMDocument('1.0');

//create the root element
$root = $xmlDoc->appendChild(
          $xmlDoc->createElement('urlset'));
$root->appendChild(
    $xmlDoc->createAttribute("xmlns"))->appendChild(
      $xmlDoc->createTextNode('http://www.sitemaps.org/schemas/sitemap/0.9'));       

foreach($r as $spirit){

$urlSpirit = 'http://urlroot.com' . $spirit['Category'] . '/' .  $spirit['subcategory'] . '/' . $spirit['permName'];
$imgSpirit = 'http://urlroot.com' . $spirit['picture'];
  //create a url element
  $urlTag = $root->appendChild(
              $xmlDoc->createElement("url"));

  //create the loc element
  $urlTag->appendChild(
    $xmlDoc->createElement("loc", $urlSpirit));

  //create the changefreq element
  $urlTag->appendChild(
    $xmlDoc->createElement("changefreq", 'weekly'));

  //create the priority element
  $urlTag->appendChild(
    $xmlDoc->createElement("priority", '1.0'));

  //create the lastmod element
  $urlTag->appendChild(
    $xmlDoc->createElement("lastmod", …
Run Code Online (Sandbox Code Playgroud)

php xml dom

3
推荐指数
1
解决办法
3414
查看次数

Jquery keyup多个输入

我试图这样做,当有人使用输入时,将显示与其对应的文本.

<div class="content1" style="display: block;">Content 1</div>
<div class="content2" style="display: none;">Content 2</div>
<div class="content3" style="display: none;">Content 3</div>
<div class="content4" style="display: none;">Content 4</div>

<ul class="addReview">
        <li><p>Input 1</p><input type="text" name="input1" value="" id="input1" autocomplete="off" maxlength="2"  /></li>
        <li><p>Input 2</p><input type="text" name="input2" value="" id="input2" autocomplete="off" maxlength="2"  /></li>
        <li><p>Input 3</p><input type="text" name="input3" value="" id="input3" autocomplete="off" maxlength="2"  /></li>
        <li><p>Input 4</p><input type="text" name="input4" value="" id="input4" autocomplete="off" maxlength="2"  /></li>
    </ul>
Run Code Online (Sandbox Code Playgroud)

我会为每个输入执行键盘功能还是有办法制作一个键盘功能?

jquery

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

php ×3

codeigniter ×1

dom ×1

jquery ×1

mongodb ×1

mysql ×1

xml ×1