• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 03:40
CET 09:40
KST 17:40
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #21: Winners10Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
StarCraft, SC2, HotS, WC3, Returning to Blizzcon!42$5,000+ WardiTV 2025 Championship7[BSL21] RO32 Group Stage4Weekly Cups (Oct 26-Nov 2): Liquid, Clem, Solar win; LAN in Philly2Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win10
StarCraft 2
General
RotterdaM "Serral is the GOAT, and it's not close" Mech is the composition that needs teleportation t StarCraft, SC2, HotS, WC3, Returning to Blizzcon! TL.net Map Contest #21: Winners Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win
Tourneys
Constellation Cup - Main Event - Stellar Fest $5,000+ WardiTV 2025 Championship Sparkling Tuna Cup - Weekly Open Tournament Merivale 8 Open - LAN - Stellar Fest Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection Mutation # 495 Rest In Peace
Brood War
General
BW General Discussion Where's CardinalAllin/Jukado the mapmaker? [ASL20] Ask the mapmakers — Drop your questions [BSL21] RO32 Group Stage BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL20] Grand Finals [BSL21] RO32 Group A - Saturday 21:00 CET [Megathread] Daily Proleagues [BSL21] RO32 Group B - Sunday 21:00 CET
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile Should offensive tower rushing be viable in RTS games? Dawn of War IV
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine YouTube Thread Dating: How's your luck?
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Learning my new SC2 hotkey…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Our Last Hope in th…
KrillinFromwales
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1106 users

The Big Programming Thread - Page 289

Forum Index > General Forum
Post a Reply
Prev 1 287 288 289 290 291 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
tec27
Profile Blog Joined June 2004
United States3702 Posts
Last Edited: 2013-04-24 03:14:56
April 24 2013 03:14 GMT
#5761
On April 24 2013 11:51 white_horse wrote:
Is it possible to teach yourself HTML and be pretty good at it? I'm planning on studying intensively on my own this summer.

Also, should I learn HTML first or PHP, or should I study both at the same time?

HTML is very easy, and it doesn't make sense to learn PHP without some knowledge of it. But it really shouldn't take you long at all to get your bearings, its just a language for structuring content so it doesn't have the complexity of an actual programming language (CSS, however, has some weirdness that programmers often have trouble understanding, but you won't really need to delve into that at the very beginning).
Can you jam with the console cowboys in cyberspace?
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2013-04-24 05:22:43
April 24 2013 05:22 GMT
#5762
On April 24 2013 11:51 white_horse wrote:
Is it possible to teach yourself HTML and be pretty good at it? I'm planning on studying intensively on my own this summer.

Also, should I learn HTML first or PHP, or should I study both at the same time?

HTML can be learned in a few minutes if you have a good resource. It's very simple. PHP is an actual programming language and is a lot more complex, and you'll need to know html before you can actually use it much. You can learn the two fairly well in a summer in my opinion.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
April 24 2013 08:33 GMT
#5763
hey, i have to rush off now, but perhaps one of you would fancy answering a question?

i am printing contents of my product table to a webpage (menu of food items)

my tutor used While to do this but i dont really know why, or why you cant use Foreach

i dont need a 100% answer, just a very general answer would be sufficient for me to see how my understanding lacks (i am total beginner). something like "they both work completely different and you need to study up on them properly to know why and how"

+ Show Spoiler +



<?php

$connection = mysql_connect("localhost", "jon1", "password");

mysql_select_db("takeaway");

$result = mysql_query("SELECT * FROM products");

while($row = mysql_fetch_array($result))
{

echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}

foreach($row = mysql_fetch_array($result))
{
echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}


?>


(the foreach doesnt work fyi. i have to fuck off now for 2 hours but will be back to have another look)
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
ZenithM
Profile Joined February 2011
France15952 Posts
Last Edited: 2013-04-24 08:58:28
April 24 2013 08:55 GMT
#5764
I never really understood what is "learning HTML". Like, it's a markup language, some way to structure data, in order to be visually represented, and only that. There isn't much to do with it or be understood, unless you delve into some advanced stuff.
What you should learn is the full combo "HTML + Javascript + CSS" or "HTML + PHP". You mainly have to learn a language that can use or produce HTML, otherwise it's pretty pointless.
tec27
Profile Blog Joined June 2004
United States3702 Posts
Last Edited: 2013-04-24 08:57:37
April 24 2013 08:55 GMT
#5765
On April 24 2013 17:33 FFGenerations wrote:
hey, i have to rush off now, but perhaps one of you would fancy answering a question?

i am printing contents of my product table to a webpage (menu of food items)

my tutor used While to do this but i dont really know why, or why you cant use Foreach

i dont need a 100% answer, just a very general answer would be sufficient for me to see how my understanding lacks (i am total beginner). something like "they both work completely different and you need to study up on them properly to know why and how"

+ Show Spoiler +



<?php

$connection = mysql_connect("localhost", "jon1", "password");

mysql_select_db("takeaway");

$result = mysql_query("SELECT * FROM products");

while($row = mysql_fetch_array($result))
{

echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}

foreach($row = mysql_fetch_array($result))
{
echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}


?>


(the foreach doesnt work fyi. i have to fuck off now for 2 hours but will be back to have another look)

Firstly, quit using the mysql library, its awful and deprecated. Use mysqli or PDO instead.

Secondly, you can't use foreach here because you don't actually have an array, all you have is a single function return value (which is a single row, although it is an array of *columns*). mysql_fetch_array returns 1 row at a time, and with the while loop version you're calling it over and over again as long as it returns a non-falsy value (so you iterate over all the rows).

Foreach however, instead of evaluating a condition each time, will loop through an array or an iterator. Since all you have here is one row, that clearly won't do what you want. You could, however, construct an Iterator class that makes calls to mysql_fetch_array() to iterate, and then you could get this syntax. Before you run off and do that though, just stop using the mysql functions and move to mysqli, where the result type already implements Iterator and can do this.
Can you jam with the console cowboys in cyberspace?
Rixxe
Profile Joined July 2011
United Kingdom136 Posts
Last Edited: 2013-04-24 08:59:31
April 24 2013 08:58 GMT
#5766
On April 24 2013 17:33 FFGenerations wrote:
hey, i have to rush off now, but perhaps one of you would fancy answering a question?

i am printing contents of my product table to a webpage (menu of food items)

my tutor used While to do this but i dont really know why, or why you cant use Foreach

i dont need a 100% answer, just a very general answer would be sufficient for me to see how my understanding lacks (i am total beginner). something like "they both work completely different and you need to study up on them properly to know why and how"

+ Show Spoiler +



<?php

$connection = mysql_connect("localhost", "jon1", "password");

mysql_select_db("takeaway");

$result = mysql_query("SELECT * FROM products");

while($row = mysql_fetch_array($result))
{

echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}

foreach($row = mysql_fetch_array($result))
{
echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}


?>


(the foreach doesnt work fyi. i have to fuck off now for 2 hours but will be back to have another look)


Generally you can make them do the same thing in the end (not 100% sure with php) however:

One of them is a general purpose loop with pre-condition and another is a dedicated loop operator to loop over ARRAYS.

In general i prefer to use Foreach, purely because i think it produces less bugs and issues, and for me is easier to read when looking through a mass of code.
*bleep* you up in a gangsta style!
Yoshi-
Profile Joined October 2008
Germany10227 Posts
Last Edited: 2013-04-24 09:07:42
April 24 2013 09:05 GMT
#5767
This is because foreach works completely different than while.
Foreach takes an array an iteriates over it.
e.g.:

<?php
$array = array("key1" => "value1",
"key2" => "value2",
"key3" => "value3",
"key4" => "value4",
"key5" => "value5"
);

foreach ($array as $key => $value) {
echo $key . " = " . $value. '\n';
}

Will result in:

key1 = value1
key2 = value2
....

So it loops through the array an execute the code for each element.

While however loops as long as the statement in between the "( )" is true, and than executes the code everytime.

The reason why you cannot use foreach in that case is, that if you have mutiple rows in your Mysql Table the mysql_fetch_* functions will only give you one row, and than put the pointer to the next row.
If mysql_fetch_array, gets called it will give you the first and than move on to the second.
If you call it again it will give you the second row and move the pointer to the third.
To get every row you need to repeat that for every row in your table, and if there are no more rows avaiable mysql_fetch_array will return "false".

The easiest way to do this is witj a while function, like in your example, after every iteration $row, will have a new content and the loop will run until you run out of rows(mysql_fetch_array returns false).

This only works with while(well you could make it work with foreach, but that would be retarded).


On April 24 2013 17:58 Rixxe wrote:

Generally you can make them do the same thing in the end (not 100% sure with php) however:

One of them is a general purpose loop with pre-condition and another is a dedicated loop operator to loop over ARRAYS.

In general i prefer to use Foreach, purely because i think it produces less bugs and issues, and for me is easier to read when looking through a mass of code.

You cannot say that one is better than the other, as they have quite different purposes.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2013-04-24 10:17:28
April 24 2013 10:15 GMT
#5768
wow thanks, thats just what i wanted to hear. theres so much you dont learn in a class, they give you the code and say "this is how you do it", then you get an assignment in which you copy/paste what you've done in class.

thankfully this is my last assignment for a while (excluding the CCNA, which you can also copy/paste directly off the internet to get a good grade in), as soon as i get it out the way im going to start a proper C++ book/tutorial.

never heard of mysqli - and how would i!? one thing at a time, let me get this submitted with a top grade based on the requirements (which are "paste what you done in class and screenshot it 100 times") then i can start from scratch in detail
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
April 24 2013 10:21 GMT
#5769
On April 24 2013 19:15 FFGenerations wrote:
wow thanks, thats just what i wanted to hear. theres so much you dont learn in a class, they give you the code and say "this is how you do it", then you get an assignment in which you copy/paste what you've done in class.

thankfully this is my last assignment for a while (excluding the CCNA, which you can also copy/paste directly off the internet to get a good grade in), as soon as i get it out the way im going to start a proper C++ book/tutorial.

never heard of mysqli - and how would i!? one thing at a time, let me get this submitted with a top grade based on the requirements (which are "paste what you done in class and screenshot it 100 times") then i can start from scratch in detail

You should hit me up for the C++ stuff
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
April 24 2013 10:33 GMT
#5770
On April 24 2013 19:21 CecilSunkure wrote:
Show nested quote +
On April 24 2013 19:15 FFGenerations wrote:
wow thanks, thats just what i wanted to hear. theres so much you dont learn in a class, they give you the code and say "this is how you do it", then you get an assignment in which you copy/paste what you've done in class.

thankfully this is my last assignment for a while (excluding the CCNA, which you can also copy/paste directly off the internet to get a good grade in), as soon as i get it out the way im going to start a proper C++ book/tutorial.

never heard of mysqli - and how would i!? one thing at a time, let me get this submitted with a top grade based on the requirements (which are "paste what you done in class and screenshot it 100 times") then i can start from scratch in detail

You should hit me up for the C++ stuff

i second this. you should even read his blogs. very easy to understand
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
FFGenerations
Profile Blog Joined April 2011
7088 Posts
April 24 2013 10:38 GMT
#5771
nice, ok;)
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
Arnstein
Profile Blog Joined May 2010
Norway3381 Posts
April 24 2013 10:53 GMT
#5772
On April 24 2013 11:51 white_horse wrote:
Is it possible to teach yourself HTML and be pretty good at it? I'm planning on studying intensively on my own this summer.

Also, should I learn HTML first or PHP, or should I study both at the same time?


www.codecademy.com, there you can learn both!
rsol in response to the dragoon voice being heard in SCII: dragoon ai reaches new lows: wanders into wrong game
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
April 24 2013 14:17 GMT
#5773
On April 24 2013 09:12 HadeCiao wrote:
I wanted to share my programming experience with you. I have always been fascinated about computers and algorithms. 1 year ago I downloaded logism, a logic circuit simulator. I wanted to understand computers from scratch. I finnaly was able to build a very small cpu and also a simple assembly language in which I could write pong.

Just recently I could afford more time to spend on learning how computers work. I have been reading now and then (also in this thread) about programming, As far as I knew Java, C and Basic are the most basic and common languages and Basic seemed to be ideal for a beginner like me. After watching a few tutorials, I started with pong then snake and tretris. Finnaly I ended up programming a metroid clone within the last 4 weeks.

The programming process itsself was great, i spend nights and nights solving those little problems and improving the game on a constant basis. After showing the game to a few friends I was suggested to give it a try and uploaded it to steam greenlight. The reactions are quite negative mainly due to the cheap graphics. However I am an aweful painter and now I am stuck a little. Need to calm down a few days :D However I do not regret anything and I want to give a shout how great and fun programming is.

Here is the promotion vid for those who are interested.

This looks pretty cool.
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
tec27
Profile Blog Joined June 2004
United States3702 Posts
April 25 2013 05:35 GMT
#5774
On April 24 2013 19:15 FFGenerations wrote:
never heard of mysqli - and how would i!? one thing at a time, let me get this submitted with a top grade based on the requirements (which are "paste what you done in class and screenshot it 100 times") then i can start from scratch in detail

Well, its quite simple to hear of it. Any time you go to the documentation for the mysql crap on the php site, they have a nice big warning bar telling you not to use it and to use mysqli instead, e.g.: http://www.php.net/manual/en/function.mysql-result.php

If your class is focused on copying and pasting, you should immediately stop going to that class and do something useful with your time instead.
Can you jam with the console cowboys in cyberspace?
billy5000
Profile Blog Joined December 2010
United States865 Posts
Last Edited: 2013-04-25 09:49:26
April 25 2013 08:11 GMT
#5775
On April 24 2013 11:51 white_horse wrote:
Is it possible to teach yourself HTML and be pretty good at it? I'm planning on studying intensively on my own this summer.

Also, should I learn HTML first or PHP, or should I study both at the same time?


Any reason why you want to learn php?

I'm not here to criticize--I'm fairly new to web development myself (getting the hang of play framework atm)--but I'm just wondering what made you choose php over other popular frameworks, such as rails and django.

I for one chose play because I was learning scala on the side. Thought it would be a good idea to do something with what I've learned. I also have a project in mind.

Note: I know it's wrong to consider php a web framework, but you know what I mean . I'm just not familiar with any popular php frameworks.
Tiger got to hunt, bird got to fly; Man got to sit and wonder, 'Why, why, why?' Tiger got to sleep, bird got to land; Man got to tell himself he understand. Vonnegut
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
Last Edited: 2013-04-25 10:35:28
April 25 2013 10:29 GMT
#5776
On April 25 2013 17:11 billy5000 wrote:
Show nested quote +
On April 24 2013 11:51 white_horse wrote:
Is it possible to teach yourself HTML and be pretty good at it? I'm planning on studying intensively on my own this summer.

Also, should I learn HTML first or PHP, or should I study both at the same time?


Any reason why you want to learn php?

I'm not here to criticize--I'm fairly new to web development myself (getting the hang of play framework atm)--but I'm just wondering what made you choose php over other popular frameworks, such as rails and django.

I for one chose play because I was learning scala on the side. Thought it would be a good idea to do something with what I've learned. I also have a project in mind.

Note: I know it's wrong to consider php a web framework, but you know what I mean . I'm just not familiar with any popular php frameworks.


There is one reason why PHP is a common choice to learn:
It's what everyone uses, so it provides the best job opportunities.

Yes, it's a horrible language and i don't like it but if you look at it from a real-world perspective, making code look pretty doesn't matter, results matter. That is what PHP has: Results.

I recommend to read PHP Sucks, But It Doesn't Matter from the blog of Jeff Atwood who explains it better than i can.

PHP, Python, Ruby, Scala, the choice of language doesn't matter in the end, only results do. Bad coders write bad code in every language.

On April 24 2013 17:55 tec27 wrote:
Show nested quote +
On April 24 2013 17:33 FFGenerations wrote:
hey, i have to rush off now, but perhaps one of you would fancy answering a question?

i am printing contents of my product table to a webpage (menu of food items)

my tutor used While to do this but i dont really know why, or why you cant use Foreach

i dont need a 100% answer, just a very general answer would be sufficient for me to see how my understanding lacks (i am total beginner). something like "they both work completely different and you need to study up on them properly to know why and how"

+ Show Spoiler +



<?php

$connection = mysql_connect("localhost", "jon1", "password");

mysql_select_db("takeaway");

$result = mysql_query("SELECT * FROM products");

while($row = mysql_fetch_array($result))
{

echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}

foreach($row = mysql_fetch_array($result))
{
echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}


?>


(the foreach doesnt work fyi. i have to fuck off now for 2 hours but will be back to have another look)

Firstly, quit using the mysql library, its awful and deprecated. Use mysqli or PDO instead.

***snip***


I wholeheartedly agree. PDO is so much better than the standard mysql_* functions and only a tiny bit more complex. Coming originally from Perl with it's DBI library, it feels a lot more natural to me as well. Anyone who still uses mysql_* deserves a strong kick in the lower body region.
Tobberoth
Profile Joined August 2010
Sweden6375 Posts
April 25 2013 10:39 GMT
#5777
On April 25 2013 19:29 Morfildur wrote:
There is one reason why PHP is a common choice to learn:
It's what everyone uses, so it provides the best job opportunities.

Yes, it's a horrible language and i don't like it but if you look at it from a real-world perspective, making code look pretty doesn't matter, results matter. That is what PHP has: Results.

I recommend to read PHP Sucks, But It Doesn't Matter from the blog of Jeff Atwood who explains it better than i can.

PHP, Python, Ruby, Scala, the choice of language doesn't matter in the end, only results do. Bad coders write bad code in every language.

It certainly provides the most job opportunities, but the best ones? I read an article several years back showing that Ruby web developers on average made quite a bit more money than PHP developers.

Obviously, PHP is still worth learning if you want a lot of opportunities, but I think the trend is to move away from PHP and there's far more opportunities now in other languages... and finding a job in pretty much any discipline shouldn't be a huge issue, it's more dependant on what you want to work with... Ruby for innovative upstarts, ASP/JSP are probably also very easy to find work in as part of bigger companies.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
April 25 2013 11:02 GMT
#5778
On April 25 2013 19:39 Tobberoth wrote:
Show nested quote +
On April 25 2013 19:29 Morfildur wrote:
There is one reason why PHP is a common choice to learn:
It's what everyone uses, so it provides the best job opportunities.

Yes, it's a horrible language and i don't like it but if you look at it from a real-world perspective, making code look pretty doesn't matter, results matter. That is what PHP has: Results.

I recommend to read PHP Sucks, But It Doesn't Matter from the blog of Jeff Atwood who explains it better than i can.

PHP, Python, Ruby, Scala, the choice of language doesn't matter in the end, only results do. Bad coders write bad code in every language.

It certainly provides the most job opportunities, but the best ones? I read an article several years back showing that Ruby web developers on average made quite a bit more money than PHP developers.

Obviously, PHP is still worth learning if you want a lot of opportunities, but I think the trend is to move away from PHP and there's far more opportunities now in other languages... and finding a job in pretty much any discipline shouldn't be a huge issue, it's more dependant on what you want to work with... Ruby for innovative upstarts, ASP/JSP are probably also very easy to find work in as part of bigger companies.


Average salary is a very wierd statistic since it only shows half the picture.

Ruby developers might earn more on average but that is because most of them are experienced programmers working in a company that is financially secure enough to take a risk with the language, so they have the freedom to pay more.

The huge amount of novice PHP programmers in low paying startups pulls the average salary down a lot. Good PHP programmers will earn as much as good Ruby programmers in the same context.

While there are jobs for all languages, the amount of PHP jobs is still higher than that of any other web language, especially for novice programmers. Experienced programmers will program in any language anyways, so they don't have to care about that.
mcc
Profile Joined October 2010
Czech Republic4646 Posts
April 25 2013 12:20 GMT
#5779
On April 25 2013 19:29 Morfildur wrote:
Show nested quote +
On April 25 2013 17:11 billy5000 wrote:
On April 24 2013 11:51 white_horse wrote:
Is it possible to teach yourself HTML and be pretty good at it? I'm planning on studying intensively on my own this summer.

Also, should I learn HTML first or PHP, or should I study both at the same time?


Any reason why you want to learn php?

I'm not here to criticize--I'm fairly new to web development myself (getting the hang of play framework atm)--but I'm just wondering what made you choose php over other popular frameworks, such as rails and django.

I for one chose play because I was learning scala on the side. Thought it would be a good idea to do something with what I've learned. I also have a project in mind.

Note: I know it's wrong to consider php a web framework, but you know what I mean . I'm just not familiar with any popular php frameworks.


There is one reason why PHP is a common choice to learn:
It's what everyone uses, so it provides the best job opportunities.

Yes, it's a horrible language and i don't like it but if you look at it from a real-world perspective, making code look pretty doesn't matter, results matter. That is what PHP has: Results.

I recommend to read PHP Sucks, But It Doesn't Matter from the blog of Jeff Atwood who explains it better than i can.

PHP, Python, Ruby, Scala, the choice of language doesn't matter in the end, only results do. Bad coders write bad code in every language.

Show nested quote +
On April 24 2013 17:55 tec27 wrote:
On April 24 2013 17:33 FFGenerations wrote:
hey, i have to rush off now, but perhaps one of you would fancy answering a question?

i am printing contents of my product table to a webpage (menu of food items)

my tutor used While to do this but i dont really know why, or why you cant use Foreach

i dont need a 100% answer, just a very general answer would be sufficient for me to see how my understanding lacks (i am total beginner). something like "they both work completely different and you need to study up on them properly to know why and how"

+ Show Spoiler +



<?php

$connection = mysql_connect("localhost", "jon1", "password");

mysql_select_db("takeaway");

$result = mysql_query("SELECT * FROM products");

while($row = mysql_fetch_array($result))
{

echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}

foreach($row = mysql_fetch_array($result))
{
echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}


?>


(the foreach doesnt work fyi. i have to fuck off now for 2 hours but will be back to have another look)

Firstly, quit using the mysql library, its awful and deprecated. Use mysqli or PDO instead.

***snip***


I wholeheartedly agree. PDO is so much better than the standard mysql_* functions and only a tiny bit more complex. Coming originally from Perl with it's DBI library, it feels a lot more natural to me as well. Anyone who still uses mysql_* deserves a strong kick in the lower body region.

I disagree with such generalized statement as "bad coders write bad code in any language". Quality of code is not binary measure. And languages influence how bad the code can get. Plus all programmers write bad code to some degree, good language helps you avoid some of that. Bad code is unavoidable, if language can prevent some of it, that language is better. Of course there is balance to be had between how much language constricts you without actually preventing you to use useful techniques.

PHP is terrible language and it matters (even though not to some very big degree). But which languages are used is not based on quality or even pure usefulness of the language, but on factors independent of the language itself (libraries, frameworks, community, support, ...). Basically PHP has results, because it is popular, simple feedback loop.

That is not to discourage someone from learning PHP, but if they are not pressed to start with it by necessity of earning money or something, it is not ideal first language, not even for creating web pages.
icystorage
Profile Blog Joined November 2008
Jollibee19350 Posts
April 25 2013 12:32 GMT
#5780
On April 25 2013 21:20 mcc wrote:
Show nested quote +
On April 25 2013 19:29 Morfildur wrote:
On April 25 2013 17:11 billy5000 wrote:
On April 24 2013 11:51 white_horse wrote:
Is it possible to teach yourself HTML and be pretty good at it? I'm planning on studying intensively on my own this summer.

Also, should I learn HTML first or PHP, or should I study both at the same time?


Any reason why you want to learn php?

I'm not here to criticize--I'm fairly new to web development myself (getting the hang of play framework atm)--but I'm just wondering what made you choose php over other popular frameworks, such as rails and django.

I for one chose play because I was learning scala on the side. Thought it would be a good idea to do something with what I've learned. I also have a project in mind.

Note: I know it's wrong to consider php a web framework, but you know what I mean . I'm just not familiar with any popular php frameworks.


There is one reason why PHP is a common choice to learn:
It's what everyone uses, so it provides the best job opportunities.

Yes, it's a horrible language and i don't like it but if you look at it from a real-world perspective, making code look pretty doesn't matter, results matter. That is what PHP has: Results.

I recommend to read PHP Sucks, But It Doesn't Matter from the blog of Jeff Atwood who explains it better than i can.

PHP, Python, Ruby, Scala, the choice of language doesn't matter in the end, only results do. Bad coders write bad code in every language.

On April 24 2013 17:55 tec27 wrote:
On April 24 2013 17:33 FFGenerations wrote:
hey, i have to rush off now, but perhaps one of you would fancy answering a question?

i am printing contents of my product table to a webpage (menu of food items)

my tutor used While to do this but i dont really know why, or why you cant use Foreach

i dont need a 100% answer, just a very general answer would be sufficient for me to see how my understanding lacks (i am total beginner). something like "they both work completely different and you need to study up on them properly to know why and how"

+ Show Spoiler +



<?php

$connection = mysql_connect("localhost", "jon1", "password");

mysql_select_db("takeaway");

$result = mysql_query("SELECT * FROM products");

while($row = mysql_fetch_array($result))
{

echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}

foreach($row = mysql_fetch_array($result))
{
echo "<strong>Name:</strong> " . $row["productname"] . "<br />";

echo "<a href='item.php?productid=" . $row["productid"] . "'>Details</a><br/>";
}


?>


(the foreach doesnt work fyi. i have to fuck off now for 2 hours but will be back to have another look)

Firstly, quit using the mysql library, its awful and deprecated. Use mysqli or PDO instead.

***snip***


I wholeheartedly agree. PDO is so much better than the standard mysql_* functions and only a tiny bit more complex. Coming originally from Perl with it's DBI library, it feels a lot more natural to me as well. Anyone who still uses mysql_* deserves a strong kick in the lower body region.

I disagree with such generalized statement as "bad coders write bad code in any language". Quality of code is not binary measure. And languages influence how bad the code can get. Plus all programmers write bad code to some degree, good language helps you avoid some of that. Bad code is unavoidable, if language can prevent some of it, that language is better. Of course there is balance to be had between how much language constricts you without actually preventing you to use useful techniques.

PHP is terrible language and it matters (even though not to some very big degree). But which languages are used is not based on quality or even pure usefulness of the language, but on factors independent of the language itself (libraries, frameworks, community, support, ...). Basically PHP has results, because it is popular, simple feedback loop.

That is not to discourage someone from learning PHP, but if they are not pressed to start with it by necessity of earning money or something, it is not ideal first language, not even for creating web pages.


out of curiosity, what is ideal in creating web pages?
LiquidDota StaffAre you ready for a Miracle-? We are! The International 2017 Champions!
Prev 1 287 288 289 290 291 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 1h 21m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Zeus 548
actioN 257
Larva 209
Sharp 92
PianO 31
NotJumperer 24
NaDa 14
Dota 2
Gorgc3222
NeuroSwarm88
League of Legends
JimRising 1144
Counter-Strike
fl0m2249
Stewie2K646
Heroes of the Storm
Khaldor122
Other Games
summit1g13576
Happy237
goatrope45
XaKoH 19
Organizations
Counter-Strike
PGL86
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH162
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota224
League of Legends
• Lourlo3853
• Jankos2899
Upcoming Events
Sparkling Tuna Cup
1h 21m
WardiTV Korean Royale
3h 21m
LAN Event
6h 21m
ByuN vs Zoun
TBD vs TriGGeR
Clem vs TBD
IPSL
9h 21m
JDConan vs WIZARD
WolFix vs Cross
BSL 21
11h 21m
spx vs rasowy
HBO vs KameZerg
Cross vs Razz
dxtr13 vs ZZZero
Replay Cast
1d
Wardi Open
1d 3h
WardiTV Korean Royale
2 days
Replay Cast
3 days
Kung Fu Cup
3 days
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
[ Show More ]
Tenacious Turtle Tussle
3 days
The PondCast
4 days
RSL Revival
4 days
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
4 days
WardiTV Korean Royale
4 days
RSL Revival
5 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
5 days
CranKy Ducklings
6 days
RSL Revival
6 days
herO vs Gerald
ByuN vs SHIN
Kung Fu Cup
6 days
BSL 21
6 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Liquipedia Results

Completed

BSL 21 Points
SC4ALL: StarCraft II
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
Stellar Fest: Constellation Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.