I have a SQL DB that is just one table with one row that I would like to increment from my iphone, just to test out communication with a server.
I have done this with the phone before but I have never done the stuff on there server side and would like to learn.
so far I have created the sql db as said above. it is pretty much just this.
CREATE TABLE workers
(
id SMALLINT NOT NULL AUTO_INCREMENT
)
that could be slightly wrong.. it took me a couple of times to get it to work on the server and I am only writing it from memory now.
However now I would like to figure out how to just make it increment from a php script on my server… so far for the script I have done the basic stuff you do to get it to check for the DB connectivity so it looks a little something like this..
<?PHP
$con = mysql_connect("db.url.com","pass","username");
if (!$con){die('Could not connect: ' . mysql_error());}
mysql_select_db("db", $con);
?>
I am not sure what to do now.. I would guess its some type of insert statment, but im not sure of this as I am using Auto Increment on that row…
any help would be greatly appreciated.. hopefully once I have had help figuring this out I will be able to move on and do more complex things myself 🙂
The mysql connection:
Then the INSERT:
Hope it helps! =D