I am trying to create a mobile application using PhoneGap and jQuery Mobile. In my application, I have a page where there is a link to a PHP file that updates MYSQL and goes to the next page. But with PhoneGap, I need to have all the PHP files on an external server, so I cannot use the current solution for this application.
This is the PHP that I use to update MYSQL
<?php $var = @$_GET['id'] ; $con = mysql_connect("localhost","username","abc123"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("database", $con); mysql_query("UPDATE table SET condition=true WHERE ID= \"$var\" "); header('Location: http://1.2.3.4/test'); mysql_close($con); ?>
So, how can I run this PHP when the user clicks a button? With jQuery / AJAX, I suppose?
user1323294
source share