小编sg5*_*552的帖子

Mysql中的数组WHERE LIKE?

我需要使用数组列表进行SELECT.$array_name包含:

Array ( [0] => gum.cn [1] => lol.com. [2] => ns1.blar.com [3] => test.com [4] => web.cn. )
Run Code Online (Sandbox Code Playgroud)

的print_r($ ARRAY_NAME);

  $string = implode(',',$array_name);


    $tank = "SELECT url FROM `PHP`.`db` WHERE url LIKE '%{$string}%'";
    $result1 = mysql_query($tank); 
      while ($jwp = mysql_fetch_array($result1)) 
      {     
      echo $jwp['url']; 
      echo "<br>"; 
      }
Run Code Online (Sandbox Code Playgroud)

为什么不上面的工作呢?我搜索其他例子,问题是没有使用LIKE条款,所以没有解决方案.请提前帮助,谢谢.

php mysql arrays

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

获取没有 TLD 的域名

我这里有这个代码:

    // get host name from URL
    preg_match('@^(?:http://)?([^/]+)@i',
    "http://www.joomla.subdomain.php.net/index.html", $matches);
    $host = $matches[1];

    // get last two segments of host name
    preg_match('/[^.]+\.[^.]+$/', $host, $matches);
    echo "domain name is: {$matches[0]}\n";
Run Code Online (Sandbox Code Playgroud)

输出将是 php.net

我只需要php没有.net

php preg-match

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

只接受信件

这应该只接受字母,但它还不正确:

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
    std::string line;
    double d;

    while (std::getline(std::cin, line))
    {
        std::stringstream ss(line);
        if (ss >> d == false && line != "") //false because can convert to double
        {
            std::cout << "its characters!" << std::endl;
            break;
        }
        std::cout << "Error!" << std::endl;
    }
    return 0; 
}
Run Code Online (Sandbox Code Playgroud)



这是输出:

567
Error!

Error!
678fgh
Error!
567fgh678
Error!
fhg687
its characters!
Press any key to continue . . .
Run Code Online (Sandbox Code Playgroud)

fhg687 应该输出错误,因为字符串中的数字.

接受的输出应仅包含字母,例如ghggjh …

c++ std

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

防止复选框和可单击表格行冲突

我有一个可单击的表格行和该行中的复选框。当用户单击该行时,用户将被重定向到其他页面。这是预期的行为。现在的问题是,当用户单击复选框时,用户也会被重定向到其他页面。这不是预期的行为。单击复选框不应触发redirect()方法

  handleChange(e) {
    this.setState({
      checkbox: e.target.checked,
    });
  }

  redirect() {
    Router.push('/registration/register/RegisterEditor', '/verification/e7fe5b68-94e8-435f-8303-5308fd1f7e69');
  }

              <tbody>
                {inventory.list().map((data, index) => (
                  <tr key={'asset'.concat(index)} onClick={() => { this.redirect(); }} tabIndex={index + 1} role="button">
                    <td className="text-center">{index + 1}</td>
                    <td>{data.item}</td>
                    <td width="3%">
                      <Input className="mx-auto" type="checkbox" onChange={this.handleChange} />
                    </td>
                  </tr>
                ))}
              </tbody>
Run Code Online (Sandbox Code Playgroud)

输出:

在此输入图像描述

我怎么解决这个问题?提前致谢。

javascript checkbox reactjs

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

div淡出后显示返回div

我有一个表单,其中用户单击按钮来更新配置文件.后<div>通知他们就会淡出.它的工作原理但问题是当用户再次单击"提交"按钮时,<div>将不再显示.我的代码在:

function(data){

    if (data.response==1) 
    { 
        $('#stage').html("<div style=\"background-color:#75A838; padding-left:20px;\">Your profile has been updated!</div>"); 
    }
    else if (data.response==0) {
    $('#stage').html("<div style=\"background-color:#FF7800; padding-left:20px;\">No changes have been made to your profile!</div>");
   }
            $('#stage').delay(2000).fadeOut();
Run Code Online (Sandbox Code Playgroud)

HTML代码

 <div id="stage" style="color: white;"></div>
Run Code Online (Sandbox Code Playgroud)

我错过了什么?请帮帮我.谢谢.

html javascript jquery

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

如何从反应模态引导程序中获得价值?

如何从引导模式中获得价值?我正在使用reacstrap https://github.com/reactstrap

这是我调用模态的页面

import { ButtonGroup, Button, Input, Row, Col } from 'reactstrap';
import RegisterLookup from '../lookup/RegisterLookup';

<RegisterLookup
  isOpen={this.state.register}
  toggle={this.toggleRegister}
  className={''}
/>
Run Code Online (Sandbox Code Playgroud)

这是我的模态组件:

  register() {
    console.log("da")
  }

render() {
    return (
      <div>
        <Modal isOpen={this.props.isOpen} toggle={this.props.toggle} className={this.props.className} size="lg">
          <ModalHeader toggle={this.props.toggle}>Register</ModalHeader>
          <ModalBody>
            <div className="row mb-2">
              <div className="col-sm-12">
                <Row>
                  <Col md="6" xs="12">
                    <FormGroup row>
                      <Label sm="4">Enter your name <span className="text-danger">*</span></Label>
                      <Col>
                        <Input />
                      </Col>
                    </FormGroup>
                  </Col>
                </Row>
              </div>
            </div>

          </ModalBody>
          <ModalFooter>
            <Button className="pull-right" type="button" color="primary" onClick={() => { this.register(); }}>
              <span className="hidden-xs-down">Register …
Run Code Online (Sandbox Code Playgroud)

modal-dialog twitter-bootstrap reactjs bootstrap-4 reactstrap

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

在coldfusion函数中使用sql查询的正确方法是什么

我有这个代码,将变量传递给函数并插入它.但是我收到了错误:

<cffunction name="insertSupplierPersonnel" output="false" access="public" returnType="struct">
    <cfargument name="name" type="string" required="true" />
    <cfargument name="email" type="string" required="false" default="" />
    <cfargument name="office_phone" type="string" required="false" default="" />
    <cfargument name="mobile_phone" type="string" required="false" default="" />
    <cfargument name="designation" type="string" required="false" default="" />

    <cfset var res = '' />

    <cfquery datasource="#session.dsn_aset#" result="res">
        INSERT INTO `supplier_personnel_incharge` (
            `name`,
            `email`,
            `office_phone`,
            `mobile_phone`,
            `designation`
        )
        VALUES
        (
            cfargument.name,
            cfargument.email,
            cfargument.office_phone,
            cfargument.mobile_phone,
            cfargument.designation
        ) ;
    </cfquery>

    <cfreturn res />
</cffunction>

<cfset res = insertSupplierPersonnel(name='#form.personnel_name#', email='#form.personnel_email#', office_phone='#form.personnel_office_phone#', mobile_phone='#form.personnel_mobile_phone#', designation='#form.personnel_designation#') />

<cfdump  var="#res#">
Run Code Online (Sandbox Code Playgroud)

我收到这个错误: …

mysql coldfusion function sql-insert coldfusion-2016

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

Mysql结合更新查询

mysql_query("UPDATE rekod SET ns = '1' WHERE zone ='255' AND data ='$id1'");
mysql_query("UPDATE rekod SET ns = '1' WHERE zone ='255' AND data ='$id2'");
Run Code Online (Sandbox Code Playgroud)

而不是两次运行查询是否有一种方法可以只更新一次?差异只是数据值.请帮帮我?

php mysql sql-update

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

根据需要设置reCaptcha字段

我使用新的reCaptcha和jQuery Validate插件.验证插件适用于我的表单但不幸的是它不适用于reCaptcha.我试图让它在下面工作:

HTML:

<div class="g-recaptcha" name="recaptcha" id="recaptcha" data-sitekey="XXXXX"></div> 
Run Code Online (Sandbox Code Playgroud)

使用Javascript:

 recaptcha: {
    required: true
      }    
Run Code Online (Sandbox Code Playgroud)

但它没有奏效.有谁知道如何解决这一问题.我只需要默认的这个字段是必需的错误信息.

jquery jquery-validate recaptcha

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

为什么用HashMap声明类似的对象名称没有冲突?

我有个问题.为什么由于变量冲突,下面的代码无法与eclipse一起运行?

PdfPTable testObj1 = new PdfPTable(6);
PdfPTable testObj1 = new PdfPTable(6);
Run Code Online (Sandbox Code Playgroud)

但如果我使用HashMap循环它将工作:

Map<String, PdfPTable> hash = new HashMap<>();

    for (i = 1; i <= 1; i++){
        hash.put("testObj" + String.valueOf(i), new PdfPTable(6));
        hash.put("testObj" + String.valueOf(i), new PdfPTable(6));
    }
Run Code Online (Sandbox Code Playgroud)

有人可以向我解释为什么可以运行底层示例吗?提前致谢.

java oop object hashmap

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

在TLD之后删除点

我有这个代码,我需要在TLD之后删除点(.)

<?php
$url ='15rm-mo.hello.com.';

    $response = preg_replace('/[^A-Za-z1-9-]/', '', $url);
    echo $response;

?>
Run Code Online (Sandbox Code Playgroud)

这是输出:15rm-mohellocom

我需要的是:15rm-mohello.com最后删除点.我可以在正则表达式中添加点,但两个点都将被删除.任何的想法?提前致谢.

php regex preg-replace

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

PHP验证IP地址

<?php
$subdomain ='hello.cheapantivirus.me';
        $ns1 = 'ns01.000webhost.com';

$host = "@$ns1 $subdomain";
$ip = `/usr/bin/dig $host +short A`;

 echo $ip; // output is 31.170.161.67

 $ip3 = '84.8.161.5';

 if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
   echo "valid"; 
}
else {
  echo " not valid"; // the $ip is invalid
}


 if(filter_var($ip3, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
   echo "valid"; // somehow this one is valid
}
else {
  echo " not valid";
}
?>
Run Code Online (Sandbox Code Playgroud)

我的问题是为什么$ ip filter被显示为无效但$ ip3当我手动分配IP时,$ ip3过滤器显示为有效.请帮帮我?

php ip networking ipv4 filter-var

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

Const值可以改变

我在这里关注meteorjs的教程:https://www.meteor.com/tutorials/react/forms-and-events

其中一个代码是使用const. const text = ReactDOM.findDOMNode(this.refs.textInput).value.trim();

据我在SO网站其他网站上的阅读所知,const价值无法改变.但是,当我键入我的应用程序输入框中的任何文本时,没有抛出重新分配const值的错误.

为什么会这样,我明白const错了?我希望有人可以向我解释并提前感谢.

示例代码:

import React, { Component, PropTypes } from 'react';
import ReactDOM from 'react-dom';
import { createContainer } from 'meteor/react-meteor-data';

import { Tasks } from '../api/tasks.js';
...some lines skipped...

// App component - represents the whole app
class App extends Component {
  handleSubmit(event) {
    event.preventDefault();

    // Find the text field via the React ref
    const text = ReactDOM.findDOMNode(this.refs.textInput).value.trim();

    Tasks.insert({
      text,
      createdAt: new Date(), // current …
Run Code Online (Sandbox Code Playgroud)

javascript const meteor reactjs

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