0

Please I need some brain storming. I created an update query as seen below.

<?php require_once('Connections/@@@@@.php'); ?>
<?php
$result = mysql_query("UPDATE volunteers, vcodes SET volunteers.sn = vcodes.sn WHERE      volunteers.vid = vcodes.id");
?>    

It runs behind a form within a web application on my local server and produce the right result but when I upload it to the internet, it does not run but just sits there.

Can any one please help ascertain why it runs only on my local server but not on the internet. I am develop my application within Dreamweaver CS6.

Kermit
  • 33,827
  • 13
  • 85
  • 121
Prince Michael
  • 85
  • 3
  • 3
  • 10
  • Does your remote mySQL server is configured to receive remote connections? – ederpsampaio Jul 05 '14 at 04:07
  • [**Please, don't use `mysql_*` functions in new code**](http://bit.ly/phpmsql). They are no longer maintained [and are officially deprecated](http://j.mp/XqV7Lp). See the [**red box**](http://j.mp/Te9zIL)? Learn about [*prepared statements*](http://j.mp/T9hLWi) instead, and use [PDO](http://php.net/pdo) or [MySQLi](http://php.net/mysqli) - [this article](http://j.mp/QEx8IB) will help you decide which. – Kermit Jul 05 '14 at 04:12
  • user3614990: But I used mysql_query already as you can see from my detail – Prince Michael Jul 05 '14 at 04:13
  • Kermit: Could that be the reason why its not running – Prince Michael Jul 05 '14 at 04:15
  • These mysql_* functions are obsolete, but they were not removed yet. So, this is not the reason why the query is not running. – ederpsampaio Jul 05 '14 at 04:18
  • PLease can some one help me out with a working solution. I have been up all night trying to resolve this issue. I need help please.... – Prince Michael Jul 05 '14 at 04:21
  • Which mysql server is your script using? – didierc Jul 05 '14 at 06:21
  • WAMP in my local PC and Unix online – Prince Michael Jul 05 '14 at 06:24
  • "By default, mySql is configured to allow local connections only". Look at my link below for how to configure your mySql to connect remotely! – FoggyDay Jul 05 '14 at 19:04

2 Answers2

1

1) As others have pointed out, mysql_XXX functions are obsolete. For new code, you should absolutely use the new MySQL APIs: either PDO or mySqli:

2) Similarly, you should use prepared statements. Not "update..." or "select *". Especially if your server is facing the internet!

3) By default, mySql is configured to allow local connections only. This is a Good Thing. In general, your Web server will face the internet ... but all SQL queries and updates will be local, between your Web Server and MySQL. This is both more secure and more efficient.

3) If you want to use MySQL remotely, you must do two things:

a) Configure a MySQL account to allow remote access

b) Open your server's firewall to the MySQL port

Here is an article that discusses how to do this:

Community
  • 1
  • 1
FoggyDay
  • 11,962
  • 4
  • 34
  • 48
0

One of the reason may be your table and fields names are capitalized. You might be using windows in you local where they are not case sensitive and your remote server might be linux where table and field names are case sensitive. Make sure you are using lowercase letter for your fields and table names.

user1111
  • 11
  • 5