小编dou*_*ood的帖子

将SQL数据从一个表移动到另一个表

我想知道是否可以将所有数据行从一个表移动到另一个表,这与某个查询匹配?

例如,我需要将所有表行从Table1移动到Table2,其中username ='X'和password ='X',这样它们将不再出现在Table1中.

我正在使用SQL Server 2008 Management Studio.

sql sql-server

64
推荐指数
7
解决办法
17万
查看次数

使用Google地图的geoJson文件中的点的自定义标记

我正在使用GeoJSON作为Google地图的数据源.我正在使用API​​的v3来创建数据层,如下所示:

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<script>
var map;
function initialize() {

  //Initialise the map
  var myLatLng = new google.maps.LatLng(53.231472,-0.539783);
  map = new google.maps.Map(document.getElementById('map-canvas'), {
    zoom: 17,
    center: myLatLng,
    scrollwheel: false,
    panControl: false,
    zoomControl: false,
    scaleControl: true,
    disableDefaultUI: true
  });

  //Initialise base folder for icons
  var iconBase = '/static/images/icons/';

  //Load the JSON to show places
  map.data.loadGeoJson('/api/geo');

}

google.maps.event.addDomListener(window, 'load', initialize);
</script>

<div id="map-canvas"></div>
Run Code Online (Sandbox Code Playgroud)

我的GeoJSON数据的来源如下:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "icon": "/static/images/icons/map-marker-do.png",
        "coordinates": [
          -0.53743,
          53.23437
        ] …
Run Code Online (Sandbox Code Playgroud)

javascript json google-maps google-maps-api-3

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

获取Magento的订单增量ID

我正在尝试在success.phtml页面上获取Magento中的订单增量ID,以便我可以将其用于联盟会员跟踪.

我正在使用以下代码,但它在第二行给出错误;

$order = Mage::getSingleton('sales/order')->getLastOrderId();
$lastOrderId = $order->getIncrementId();
Run Code Online (Sandbox Code Playgroud)

错误如下:

致命错误:在第34行的非对象上调用成员函数getIncrementId():$ LastOrderId = $ order-> getIncrementId();

我想知道是否有人对如何获得订单增量ID有任何想法?这是管理员中看到的参考号,通常类似于:#1000123

php magento

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

如果记录存在,则更新其他插入

我正在尝试在两个SQL Server 2008表之间移动一些数据.如果Table2中的记录与Table1中的电子邮件一起存在,则使用Table1中的数据更新该记录,否则插入新记录.

在表1中,我有许多列; 名字,姓氏,电子邮件等.

如果Table1中的电子邮件存在,我不太确定如何构造查询来更新Table2,如果表2中不存在Table1的电子邮件,我不会插入新行.

我尝试在Google上进行一些搜索,但大多数解决方案似乎都是通过创建一些存储过程来实现的.所以我想知道是否有人可能知道如何构建一个可能做到这一点的合适查询?

sql sql-server merge upsert sql-server-2008

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

IE11中的地理位置问题

我有以下代码,当用户点击/点击位置链接时,请求用户在浏览器中允许他们当前的位置.

这在Chrome,Safari和Firefox中运行良好,但我无法在IE11中使用它.有时它会显示用户提供位置的浏览器通知,但之后没有任何反应.

我想知道是否有其他人在使用谷歌地图并在IE11中请求位置以及是否有人有解决方案?

<p id="error"></p>
<form action="/" method="post">
<a class="location-link" id="location-link" href="#"><img src="/static/images/icons/location.png" alt="Get your current location" title="Get your current location" /></a><input type="text" name="location" value="" placeholder="Find a salon" >
<input class="viewbtn3" value="Submit" type="submit"></form>
<script src="/static/js/jquery.1.9.1.js"></script>
<script src="https://maps.google.com/maps/api/js?sensor=true"></script>

<script type="text/javascript">
$(document).ready(function() {
    if (typeof navigator.geolocation == "undefined") {
        $("#error").text("Your browser doesn't support the Geolocation API");
        $(".location-instruction span").hide();
        $(".location-link").hide();
        return;
    }
    $("#location-link").click(function(event) {
        event.preventDefault();
        var addressId = this.id.substring(0, this.id.indexOf("-"));
        var thisid = $(this).attr("id");
        //console.log(thisid);
        navigator.geolocation.getCurrentPosition(function(position) {
            var geocoder = new google.maps.Geocoder();
            geocoder.geocode({ …
Run Code Online (Sandbox Code Playgroud)

javascript internet-explorer google-maps geolocation

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

重写动态URL

我试图将1个动态URL重写为另一个动态URL,如下所示;

/category?category=News to
/categorysearch/result/?q=news
Run Code Online (Sandbox Code Playgroud)

我想知道是否有人知道如何在htaccess中完成这项工作?

谢谢.

apache .htaccess mod-rewrite

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

使用javascript substring()创建一个读取更多链接

我正在开发一个经典ASP页面,它从数据库中提取一些内容,并在前100个字符后创建一个Read more链接,如下所示;

<div class="contentdetail"><%=StripHTML(rspropertyresults.Fields.Item("ContentDetails").Value)%></div>

<script type="text/javascript">
    $(function() {

        var cutoff = 200;
        var text = $('div.contentdetail').text();
        var rest = $('div.contentdetail').text().substring(cutoff);
        if (text.length > 200) {
          var period = rest.indexOf('.');
          var space = rest.indexOf(' ');
          cutoff += Math.max(Math.min(period, space), 0);
        }

        var visibleText = $('div.contentdetail').text().substring(0, cutoff);

        $('div.contentdetail')
            .html(visibleText + ('<span>' + rest + '</span>'))
            .append('<a title="Read More" style="font-weight:bold;display: block; cursor: pointer;">Read More&hellip;</a>')
            .click(function() {
                $(this).find('span').toggle();
                $(this).find('a:last').hide();
            });

        $('div.contentdetail span').hide();
    });
</script>
Run Code Online (Sandbox Code Playgroud)

但是,脚本显然只是在100个字符后关闭文本.例如,我希望它继续写文本直到第一个句号或空格.这可能吗?

谢谢.

javascript jquery asp-classic

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

无效的列名SQL Server错误

我有一个存储过程,为'ContentMarginExVat'抛出'无效列名'错误;

SELECT  CategoryTitle, ContentID, ContentTitle, ContentMarginExVat, ContentWeight
FROM    VWProductsCurrent
WHERE   ContentID = @ContentID
Run Code Online (Sandbox Code Playgroud)

我检查了VWProductsCurrents和获取数据的关联表,这两个都选择了ContentMarginExVat,但SQL Server Management Studio 2008仍然说该列的名称无效.

想知道是否有人可能就此提出任何建议?

谢谢.

sql sql-server

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

Web.config重写地图

我正在尝试为当前站点的主页和各个页面执行一些重写规则,以便将人们指向新站点,如下所示;

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rewriteMaps>
                <rewriteMap name="Redirects">
                    <add key="/" value="http://www.domain2.co.uk" />
                    <add key="/contact-us/" value="http://www.domain2.co.uk/contact-us/" />
                </rewriteMap>
            </rewriteMaps>
        </rewrite>
        <httpErrors errorMode="DetailedLocalOnly" />
    </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

重定向似乎没有做任何事情.:(有人能告诉我,如果我的语法是正确的?

谢谢.

asp.net redirect

5
推荐指数
0
解决办法
752
查看次数

CodeIgniter get_where

我正在尝试使用get_where来获取所有者等于登录用户的所有数据库记录的列表.

这是我在我的控制器中的功能;

function files()
{
    $owner = $this->auth->get_user();

    $this->db->get_where('files', array('owner =' => '$owner'))->result();
}
Run Code Online (Sandbox Code Playgroud)

在我看来,我有以下几点;

<?php foreach($query->result() as $row): ?>

    <span><?=$row->name?></span>

<?php endforeach; ?>
Run Code Online (Sandbox Code Playgroud)

当我尝试访问视图时,我收到致命错误:在第1行的/views/account/files.php中的非对象上调用成员函数result().

想知道是否有人对这可能是什么有任何想法?

谢谢

php codeigniter

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