I got decent experience in Objective-C programming for the iOS devices, but i have come to a point where i want to expand my knowledge
I would like to start making databases stored on the internet. For a simply starter goal, i have set myself to create an online highscore, so that i can play a game on my iPhone and send a URL request to the database and then it will add that to a highscore list on a website.
Anyways, so far i understand i need PhP and mySQL for something like that (and more advanced stuff too). BUT, does that require some knowledge on website design? I have made a website or two using apples iWeb, but that hardly counts. I don't know HTML or CSS.
So, what do i start with here? I don't want to design cutting-edge websites, i wanna do the stuff behind em, like databases, but i still need to know how to actually make people see my database (just using simple graphics). I was thinking of getting the book PHP and MYSQL for dummies, but not sure if it requires me being able to make websites?
Any advice is greatly appriciated
Thanks on advance
I see that this was your first post so first of all, welcome to the forum.
you don't need to know HTML or CSS to achieve your goal.
basically want you are looking for is an API for your database.
in general you start by creating the database in phpmyadmin.
and then you write your php files that interact with the database
you will need pages that read data from the database.
for instance "get top 10 highscores" and then just print or echo the output to the page.
-> your phone will need to parse the information into usable data
and then you need other pages that will accept POST data and insert that in the database.
-> make sure that you protect these functions well so that no malicious code can be injected
this should be enough to get you started
Alright mate thanks, but are you sure i won't need to know HTML in order to create the webpages it is to be displayed on?
Well, let me see if i got this right:
HTML: Used to create websites (layout, images, links, text, tables)
CSS: Used by HTML for some styling thingy
PhP: Some programming related to database management?
SQL: Handles requests and works closely with PhP?
If what i wrote was correct, i would assume i need to learn HTML, PHP and SQL to achieve this, but i might not understand it, which is why i'm asking
Thanks a lot for helping me out!
Here is an article that might help you
Although it also states to
"pick technologies which interest you and never stop learning. Programming skills are always transferable and itll make you a better candidate when a suitable job eventually arises."
Well if you ask me. Learn HTML and CSS at first and then learn PHP and MySQL. I think that php and mysql are generally used to output web pages in html and so learning that later would be beneficial.
@seerex: I understood that you want to create a game for your phone.
the UI of the game/highscores/whatever is created on the phone.
in other words, you are not displaying a website on your phone but you are fetching the information FROM your database via a PHP API through a HTTP request.
If you want to display the highscores on the website, then yes, you need to learn html and css, but that is easy. the harder part will be the API.
and if you've got some experience with any C dialect then PHP shouldn't be a problem.
for the MySQL part, you will only need to look up the SELECT, INSERT, UPDATE and JOIN to begin.
check out w3schools, there is a lot of information to get you started.
to answer the question in the topic title: Start with html and CSS, then go to php and then MySQL
I can show you the basic code to do something like this if that helps. It would be something like what I have outlined below:
You need a script to catch the PHP request from a URL. You do that with a "GET" variable posed in the URL. Then you need the script that sends the URL. Lets start with sending the URL. That's easy, just put a dynamic hyper link wherever you are sending the high score from. Here is an example in HTML
<a href="yourserver.com/catch_score.php?score=79999&name=somename">Save your score</a>
=====End HTML code======
For example, you can enter the above code and save it as an HTML file and then set up your catch_score.php file like follows(lines starting with // are comments):
//connect to a database
//get the score from the url
$hscore = $_GET['score'];
//get the name that goes with score from url:
$sname = $_GET['name'];
//insert the score into a mysql table:
mysql_query("INSERT into scores (high_score,name) VALUES('$hscore','$sname')") or die(mysql_error());
====end PHP code=====
Then finally you will notice the first line of the code in an included file for a database connection. You will have to get the database connection string from your hosting provider and adjust the variables in the connection script below. Here is the database_connection.php file:
//connect to database:
$url = "localhost";
$user = "root";
$pass = "password";
$con = mysql_connect($url,$user,$pass);
mysql_select_db('dbname') or die('Could not select a database!');
====End PHP code=====
If you are using a VPS or other server you have direct access too, localhost will probably work for the $url variable, otherwise get it from your host. You can set up a new database name along with the user and password in cpanel. I also have a coding tips blog for mysql, PHP developers at jafty.com/blog that will help. In fact if you simply do a Google search for anything related to PHP and add the word Jafty in the search Google will point you to my blog with the appropriate information you are seeking more times than not.
The above is a simple demo that does basically what you describe and should at least get you started in the right direction.
Hope that helps,
best thing to learn is java, in my opinion...