duanchen7036 2016-08-03 22:40
浏览 71
已采纳

在本地计算机上工作的多个MySQL查询但不是远程计算机

I have a dev Windows VM that serves an angularJS app via WAMP. I have been working on the app locally on an iMac that uses MAMP Pro, getting data from the database I've set up on the VM. Unfortunately, when I uploaded everything to the VM for remote testing, the queries start returning empty data and then quit altogether.

In the app is a PHP script that connects to the database using an object supplied via angular's $http method, assembled using a service to provide the query and success/failure functionality. The PHP script then returns a JSON object constructed from the result of the query. This script is used multiple times to get the data for the app. The login scenario is a good example:

In verifyUser = function(username){}, the db is queried for a user, base on a text field entry:

query:"SELECT * FROM xmx_users WHERE user='" + username + "'"

If no user exists with username, addUser = function(username){} is called to add them the db:

query:"INSERT INTO xmx_users (`user`) VALUES ('" + username + "')"

Otherwise the user's content provider list is requested via getUserProviders = function(username){}:

query:"SELECT * FROM xmx_users_providers WHERE user='" + username + "'"

If no provider list exists for the user, get a default list of all providers via getDefaultProviders = function(){}:

query:"SELECT * FROM xmx_providers WHERE active=true;

As stated above, this chain of queries works perfectly on my local machine.

When running on the VM, the first query runs as it does locally up until getDefaultProviders = function(){}, which returns an empty result, and the app just sits there.

What confuses me is how it works for the first three functions but quits the fourth, and that it's only happening on the VM.

Any ideas on what may be causing this? I can post code as necessary, just figured maybe there might be some non-code things to look at first?

  • 写回答

1条回答 默认 最新

  • dsepcxw181184853 2016-08-03 23:39
    关注

    After continued digging I found the problem... I was copying some of the data from an Excel spreadsheet and Wamp evidently didn't like some of M$'s hidden formatting. :O

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算