3 Replies - 3273 Views - Last Post: 31 March 2014 - 05:14 PM

#1 4this  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 23
  • Joined: 05-March 14

Sql and php code working fine at localhost, but not on hosting server

Posted 07 March 2014 - 04:23 AM

Hi there,

I hope that this is the appropriate place to ask the next thing.

So this is my issue -

I've been testing a Sql table and php file using XAMPP locally and all seem to work fine.

The process of things is like that -

I've got an android app - there's a sign up option, when a user enters info and press sign up,
then there's a line of info sending into the php file, and the php inserting the info into the sql table.
If all going fine the php file echos the number 1 - is if to say all went fine.
Then the app recive the output number from the php file and by the output, ti show a message at the app.

Now when i tested the code at localhost, like i said before, and when the user signed up - i've got the message saying all went ok - as if to say the number from the php was 1.

So then i decided to decided to check the code online.
In order to do so i've opened up an account at "serversfree.com". I've placed the sql file at the mySQLdatabase option, and the php file at the file manager, and of course i've changed the needed values at the php file (like loclahost into the DB address and etc).


The thing is that when im running the app now and try to sign up, strange thing is happening - on the one hand i can see that the user info is sure getting into the sql table BUT on the other hand it sure seem like the app not receiving the number 1 - because now the user get a message like the sign up process cannot be completed.

Again, Mind that im using the same code at the online server and at the local server - so my assumption, is that it doesn't have to do with the code, but with the server environment.

The thing is i can't put my finger on what could be the problem.
For example there's an option there with the name PHP Configuration - which allows you to chose a php version - there's PHP 5.2 or 5.3 or 5.4 - i've tired to switch between those three but still the same issue.

What you think could be the problem? Do you have a suggestion where and how can i test the code online?

Thank you in advance for any kind of help

Is This A Good Question/Topic? 0
  • +

Replies To: Sql and php code working fine at localhost, but not on hosting server

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9094
  • View blog
  • Posts: 34,148
  • Joined: 12-June 08

Re: Sql and php code working fine at localhost, but not on hosting server

Posted 07 March 2014 - 08:57 AM

There could be a multitude of problems.. something with the host.. something with your android app trying to interact with data being allowed out.. open ports.. etc..
Was This Post Helpful? 0
  • +
  • -

#3 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5247
  • View blog
  • Posts: 27,069
  • Joined: 10-May 07

Re: Sql and php code working fine at localhost, but not on hosting server

Posted 07 March 2014 - 09:04 AM

View Post4this, on 07 March 2014 - 06:23 AM, said:

Now when i tested the code at localhost, like i said before, and when the user signed up - i've got the message saying all went ok - as if to say the number from the php was 1.

So then i decided to decided to check the code online.

This takes into assumption that when you setup your localhost environment, you did so with the same permissions as your online host. If you gave your localhost full access, root level, or anything more than just apache/www, chances are your online host is not doing this.

I suggest checking the logs of each. & log often in your code. This will shows you what you should see (localhost) & what is going wrong (online).
Was This Post Helpful? 0
  • +
  • -

#4 Logik22  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 164
  • Joined: 12-December 11

Re: Sql and php code working fine at localhost, but not on hosting server

Posted 31 March 2014 - 05:14 PM

Does PHP give you any debugging info?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1