首页 \ 问答 \ 上传到服务器时,DB :: raw是否会产生影响?(Does DB::raw affect when uploaded on server?)

上传到服务器时,DB :: raw是否会产生影响?(Does DB::raw affect when uploaded on server?)

目前使用此代码来获取mysql上的数据及其在本地主机上的工作,但是当我将其上传到我们的AWS服务器时,它会停止排序?

$raw = "( 3959 * acos( cos( radians('$lat') ) * cos( radians( '$lat' ) ) * cos( radians( longitude ) - radians('$lon') ) + sin( radians('$lat') ) * sin( radians( latitude ) ) ) ) AS distance";
$stores = DB::table('stores')
    ->select('storename', 'id', 'photo', 'address', DB::raw($raw))
    ->orderBy('distance')
    ->where('domain', $domain->appEnv)
    ->take(25)
    ->get();

当我上传AWS时,是否有某些内容会受到影响?

请注意,我们的数据库位于不同的RDS服务器上


Currently using this code to fetch data on mysql and its working on my localhost but when I uploaded it on our AWS server it stop sorting?

$raw = "( 3959 * acos( cos( radians('$lat') ) * cos( radians( '$lat' ) ) * cos( radians( longitude ) - radians('$lon') ) + sin( radians('$lat') ) * sin( radians( latitude ) ) ) ) AS distance";
$stores = DB::table('stores')
    ->select('storename', 'id', 'photo', 'address', DB::raw($raw))
    ->orderBy('distance')
    ->where('domain', $domain->appEnv)
    ->take(25)
    ->get();

Is there something that is being affected when I uploaded on AWS?

Note that our DB is on a different server for RDS


原文:https://stackoverflow.com/questions/31720363
更新时间:2023-08-07 19:08

最满意答案

std::random_shuffle (myarray, myarray + size);


std::random_shuffle(myarray, myarray + size);

相关问答

更多
  • 使用Random.nextInt() ,无法保证生成的数字是唯一的。 您应首先生成1到20之间的数字,然后将数字洗牌。 现在问题改为“如何随机改变数字?” 也许你可以参考JDK Collections.shuffle() 。 改组数字的算法很简单: 选择数组中的第一个元素并将其与随机位置的数字交换。 重复步骤1直到最后一个元素。 When you use Random.nextInt(), there's no guarantee that the numbers generated are unique. ...
  • 你也可以使用Collections.shuffle(List)来洗牌一个数组: Integer[] data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Collections.shuffle(Arrays.asList(data)); System.out.println(Arrays.toString(data)); 将打印例如[6,2,4,5,10,3,1,8,9,7]。 Arrays.asList不会创建一个新列表,而是一个用于该数组的List接口包装器,以便对该列表的 ...
  • 如果你在.NET 3.5,你可以使用下面的IEnumerable酷(VB.NET,而不是C#,但想法应该清楚...): Random rnd=new Random(); string[] MyRandomArray = MyArray.OrderBy(x => rnd.Next()).ToArray(); 编辑:OK,这里是相应的VB.NET代码: Dim rnd As New System.Random Dim MyRandomArray = MyArray.OrderBy(Function() ...
  • 事实上无偏差的洗牌算法是Fisher-Yates(又名Knuth)Shuffle。 请参阅https://github.com/coolaj86/knuth-shuffle 你可以看到一个很好的可视化在这里 (和原来的帖子链接到这 ) function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle. ...
  • 你也可以简单地使用array_rand选择一个随机密钥,而不是改变整个事情。 它不会比那更随机* 。 基于仅20次运行的测试数据,你不能说一些不随机的东西。 如果再运行几千次,它应该会均匀。 换一种说法: Dilbert http://img51.imageshack.us/img51/2848/dilberttourofaccounting.png *就PRNG至少而言。 You could also simply pick a random key using array_rand, instead o ...
  • 以下是一些示例代码:遍历数组,并随机将对象的位置与另一个对象切换。 for (int x = 0; x < [array count]; x++) { int randInt = (arc4random() % ([array count] - x)) + x; [array exchangeObjectAtIndex:x withObjectAtIndex:randInt]; } Here's some sample code: Iterates through the array, a ...
  • 你的数组不是一个数组。 做这个: var pics = Array.from(document.getElementsByTagName("img")); Your Array isnt an Array. Do this: var pics = Array.from(document.getElementsByTagName("img"));
  • std::random_shuffle (myarray, myarray + size); std::random_shuffle(myarray, myarray + size);
  • randomize()和random()不是标准C库函数。 您可以使用srand和rand来代替。 srand((unsigned)time(NULL)); for (i =0; i < DIM ; i ++) myVect[i] = rand()%100; 对于time()函数,你需要包含头文件。 randomize() and random() are not Standard C library functions. You ca ...
  • 首先,您应该照顾其他答案中提到的for循环条件。 然后,为了改组您的输入数组,您可以使用以下代码: import java.util.Random; public class Program { public static void main(String[] args) { int[] nums = new int[100]; for(int i = 0; i < nums.length; ++i) { nu ...

相关文章

更多

最新问答

更多
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • Java中的不可变类(Immutable class in Java)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • EXCEL VBA 基础教程下载
  • RoR - 邮件中的动态主体(部分)(RoR - Dynamic body (part) in mailer)
  • 无法在Google Script中返回2D数组?(Can not return 2D Array in Google Script?)
  • JAVA环境变量的设置和对path , classpth ,java_home设置作用和目的?
  • mysql 关于分组查询、时间条件查询
  • 如何使用PowerShell匹配运算符(How to use the PowerShell match operator)
  • Effective C ++,第三版:重载const函数(Effective C++, Third edition: Overloading const function)
  • 如何用DELPHI动态建立MYSQL的数据库和表? 请示出源代码。谢谢!
  • 带有简单redis应用程序的Node.js抛出“未处理的错误”(Node.js with simple redis application throwing 'unhandled error')
  • 使用前端框架带来哪些好处,相对于使用jquery
  • Ruby将字符串($ 100.99)转换为float或BigDecimal(Ruby convert string ($100.99) to float or BigDecimal)
  • 高考完可以去做些什么?注意什么?
  • 如何声明放在main之后的类模板?(How do I declare a class template that is placed after the main?)
  • 如何使用XSLT基于兄弟姐妹对元素进行分组(How to group elements based on their siblings using XSLT)
  • 在wordpress中的所有页面的标志(Logo in all pages in wordpress)
  • R:使用rollapply对列组进行求和的问题(R: Problems using rollapply to sum groups of columns)
  • Allauth不会保存其他字段(Allauth will not save additional fields)
  • python中使用sys模块中sys.exit()好像不能退出?
  • 将Int拆分为3个字节并返回C语言(Splitting an Int to 3 bytes and back in C)
  • 在SD / MMC中启用DDR会导致问题吗?(Enabling DDR in SD/MMC causes problems? CMD 11 gives a response but the voltage switch wont complete)
  • sed没有按预期工作,从字符串中间删除特殊字符(sed not working as expected, removing special character from middle of string)
  • 如何将字符串转换为Elixir中的函数(how to convert a string to a function in Elixir)