What should I learn & use to become a pro in PHP & Python Web development?
- by pecker
Hello,
I'll just show some code to show how I do web development in PHP.
<html>
<head>
<title>Example #3 TDavid's Very First PHP Script ever!</title>
</head>
<? print(Date("m/j/y"));
require_once("somefile.php");
$mysql_db = "DATABASE NAME";
$mysql_user = "YOUR MYSQL USERNAME";
$mysql_pass = "YOUR MYSQL PASSWORD";
$mysql_link = mysql_connect("localhost", $mysql_user, $mysql_pass);
mysql_select_db($mysql_db, $mysql_link);
$result = mysql_query("SELECT impressions from tds_counter where COUNT_ID='$cid'", $mysql_link);
if(mysql_num_rows($result)) {
mysql_query("UPDATE tds_counter set impressions=impressions+1 where COUNT_ID='$cid'", $mysql_link);
$row = mysql_fetch_row($result);
if(!$inv) {
print("$row[0]");
}
}
?>
<body>
</body>
</html>
Thats it. I write every file like this. Recently, I learnt OOP and started using classes & objects in PHP.
I hear that there are many frameworks there for PHP. They say that one must use these libraries. But I feel they are just making things complicated.
Anyway, this is how I've been doing my web development. Now, I want to improve this. and make it professional. Also I want to move to Python. I searched SO archives and found everyone suggesting Django. But, can any one give me some idea about how web development in Python works?
user (client) request for page ---
webserver(-embedded PHP interpreter)
---- Server side(PHP) Script --- MySQL Server.
Now, is it that instead of PHP interpreter there is python interpreter & instead of php script there is python script, which contains both HTML & python (embedded in some kind of python tags). Python script connects to database server and fetches some data which will be printed as HTML. or is it different in python world?
Is this Django thing like frameworks for PHP? Can't one code in python without using Django. Because, I never encountered any post without django
Please give me some kick start.