eurybaric wrote
I can manage coding in a couple of languages also (C++, Java, a bit of C#) and a bit of scripting so I dont think i'll have much of a problem grasping the coding concepts for databases (unless i have to code in some friggin thee eyed alien language like mathematica or mindfuck lol).
The language for relational databases is SQL. It is somehow annoying because it's a standard and there are quite some quirks in the language syntax. For example, to get data from a table you usually use a SELECT query. To update or insert data you use an UPDATE or INSERT query. The UPDATE/INSERT queries have a very different syntax than SELECT... so it all takes some time getting used to.
The SQL error messages aren't very helpful either. It just points you to the character where it all went wrong. Usually it's some character position in the query and is not of much use.
It's a quite old school thing, but please give a shout here if you need help.
To interface PHP with MySQL, you'd do something like this (in PHP):
$res = mysql_query("SELECT `id`,`title` FROM `books` LIMIT 5"); // get 5 books
if($res === false) {
// query failed - usually SQL syntax error, missing table, MySQL server down or something... let's see the error
// Warning: don't do this on a production code!!! Showing SQL errors to users is a security weakness.
echo "Ooops! Query failed with error: ".mysql_error();
} else {
// $res is a handle to a result set
while ($row = mysql_fetch_object($res)) {
echo "Book title: ".$row->title.", Book id: ".$row->id." <br/>";
}
}
Yes, every time... You can develop your own helper functions to make it shorter...
Also, you're supposed to use the PHP "mysqli_..." functions (MySQL Improved PHP extension), instead of "mysql_...", it's supposed to be better.