• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 22:29
CEST 04:29
KST 11:29
  • 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
Serral wins HomeStory Cup 2910Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
Reynor: GSL Loss Wasn't About Preparation Format9[IPSL] Spring 2026 Grand Finals - This Weekend!0Weekly Cups (July 6 - 12): Protoss strike back4BSL Season 22 Full Overview & Conclusion8BSL Season 22 Full Overview & Conclusion8
StarCraft 2
General
Reynor: GSL Loss Wasn't About Preparation Format Weekly Cups (July 6 - 12): Protoss strike back Co-op Commander Guide: Kerrigan Serral wins HomeStory Cup 29 Is the larve respawn broken?
Tourneys
GSL CK #5 Race War WardiTV Summer Cup 2026 RSL Revival: Season 6 - Qualifiers and Main Event HomeStory Cup 29 Vespene Cup #1 — $300+ USD, July 10
Strategy
[G] Having the right mentality to improve
Custom Maps
New Map Maker - Looking for Advice - Love or Hate Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 534 Burning Evacuation Mutation # 533 Die Together Mutation # 532 Nuclear Family
Brood War
General
Pros Debate: Zerg Unfairly Nerfed? (ASL S22 map) screpdb: new Starcraft reporting tool BSL Season 22 Full Overview & Conclusion BGH Auto Balance -> http://bghmmr.eu/ ASL 22 Proposed Map Pool
Tourneys
[Megathread] Daily Proleagues [IPSL] Spring 2026 Grand Finals - This Weekend! [ASL22] Wildcard Qualifier IPSL Spring 2026 Top 4!
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers Creating a full chart of Zerg builds Relatively freeroll strategies
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Stormgate/Frost Giant Megathread Path of Exile Summer Games Done Quick 2026!
Dota 2
Looking for a Dota Mentor 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
TL Mafia
NeO.D_StephenKing vs This Guy From 1 Million Dance TL Mafia Community Thread TL Mafia Power Rank Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread UK Politics Mega-thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club The HerO Fan Club!
Media & Entertainment
Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion! Series you have seen recently...
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Tennis[sport] Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Simple Questions Simple Answers FPS when play League Of Legend on laptop How to clean a TTe Thermaltake keyboard?
TL Community
The Automated Ban List
Blogs
The Experiences We Want and …
TrAiDoS
An Exploration of th…
waywardstrategy
Gauntlet SC2: A Retrospectiv…
Ctone23
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 7672 users

The Big Programming Thread - Page 329

Forum Index > General Forum
Post a Reply
Prev 1 327 328 329 330 331 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.
Yoshi-
Profile Joined October 2008
Germany10227 Posts
Last Edited: 2013-07-24 21:11:59
July 24 2013 20:54 GMT
#6561
On July 25 2013 05:44 tofucake wrote:
There are a bunch of php websocket libraries. socketo.me is probably the most well known. And even without that PHP still supports sockets (I made a bnet bot in php+ajax almost a decade ago).


Yea I know I already realized that and removed that part.

On July 25 2013 05:43 fdsdfg wrote:

Isn't google chat (chat from the gmail web interface) done using ajax?


Just did a quick check doesn't look like ajax, or at least the firebug console doesn't show any ajax request that could be related to it.
Yea, they use long polling or httpstreaming for it: http://stackoverflow.com/questions/2440135/is-long-polling-the-most-efficient-way-to-create-a-web-real-time-app/2440150#2440150
They arguably uses "Ajax", but not the same way how OP does
nunez
Profile Blog Joined February 2011
Norway4003 Posts
July 24 2013 20:55 GMT
#6562
On July 25 2013 05:28 fdsdfg wrote:
Show nested quote +
On July 25 2013 05:12 czaku wrote:
On July 25 2013 04:54 tofucake wrote:
On July 25 2013 04:32 czaku wrote:
Hi guys, i'd need some help from you, a couple of questions to be answered.
A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option.
I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me.
Any tips where i can start?

Why?


It's a project to pass the next semester from programming and she is not interested in learning it. So she asked for my help. Basically you show the teacher code, explain how it works and you passed.


On July 25 2013 05:00 fdsdfg wrote:
On July 25 2013 04:32 czaku wrote:
Hi guys, i'd need some help from you, a couple of questions to be answered.
A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option.
I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me.
Any tips where i can start?


Just write a 1-line batch file that calls format and throws the output away. You're reinventing the wheel if you try to write a new format utility for no reason.



The problem is it has to be in C/C++ and i prefer C at the moment.


You're asking for help on writing your friend's school project for her? She should fail if she can't learn the stuff. Programmers work on teams, and I wouldn't wish a useless teammate on any fellow programmer, which is what you're trying to inflict.


i too enjoy moralizing instead of shutting up when i am unable to answer.
conspired against by a confederacy of dunces.
KainiT
Profile Joined July 2011
Austria392 Posts
July 24 2013 20:58 GMT
#6563
On July 25 2013 05:02 LukeNukeEm wrote:
Hi, I have a question for the c++-gurus:
given
template<class T = void>
class foo
{
};

int main(void)
{
foo<> foo1;
foo<int> foo2;
}
and that I am lazy, is there a way to make
foo foo1;
foo<int> foo2;
legal?
I know i can do this
namespace detail
{
template<class T = void>
class foo
{
};
}
using foo = detail::foo<>;

int main(void)
{
foo foo1;
detail::foo<int> foo2;
}
, but now i have to write detail:: for every class with a non-default template parameter.
Is there any magic available to make this work, perhaps with template aliases?


I am afraid there isn't, but I do not really get your "problem". Writing "<>" is too much work? I find it helpful that the compiler makes one aware of which classes are actually templated.
With great power comes great responsibility.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-07-24 21:18:31
July 24 2013 21:16 GMT
#6564
I've got a question from a relative today what a programmer is supposed to do when it comes to "domain requirements", e.g. it's required from you to create software that will be used in (say) architecture development or any other non-computer field really. The problem is you're a software engineer not an architect, physician or whatever.

What I answered was that the contractor of the project (or the manager) should be responsible to teach/give enough material to programmers to fullfill application requirements. However, is this what's done in practice? Am I close to truth?

Edit: The purpose of the question was that he thinks everyone should understand everything even if it's just a little bit.
1handsomE
Profile Blog Joined July 2011
United States199 Posts
Last Edited: 2013-07-24 21:22:32
July 24 2013 21:22 GMT
#6565
Hi. I am a relatively junior level programmer (2 years professional experience) who just got an actual programming job (UI Programmer) in the game industry. I was wondering if there was anyone else on the forums who works in the industry?

Edit: DM me, let's be friends!
MarineKing / Jaedong / DeMusliM / SeleCT / Maru hwaiting!
fdsdfg
Profile Blog Joined February 2010
United States1251 Posts
July 24 2013 22:08 GMT
#6566
On July 25 2013 05:55 nunez wrote:
Show nested quote +
On July 25 2013 05:28 fdsdfg wrote:
On July 25 2013 05:12 czaku wrote:
On July 25 2013 04:54 tofucake wrote:
On July 25 2013 04:32 czaku wrote:
Hi guys, i'd need some help from you, a couple of questions to be answered.
A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option.
I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me.
Any tips where i can start?

Why?


It's a project to pass the next semester from programming and she is not interested in learning it. So she asked for my help. Basically you show the teacher code, explain how it works and you passed.


On July 25 2013 05:00 fdsdfg wrote:
On July 25 2013 04:32 czaku wrote:
Hi guys, i'd need some help from you, a couple of questions to be answered.
A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option.
I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me.
Any tips where i can start?


Just write a 1-line batch file that calls format and throws the output away. You're reinventing the wheel if you try to write a new format utility for no reason.



The problem is it has to be in C/C++ and i prefer C at the moment.


You're asking for help on writing your friend's school project for her? She should fail if she can't learn the stuff. Programmers work on teams, and I wouldn't wish a useless teammate on any fellow programmer, which is what you're trying to inflict.


i too enjoy moralizing instead of shutting up when i am unable to answer.


If he asked for $20 and you didn't send him $20, would it be right to assume that you don't have $20 to your name?
aka Siyko
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
Last Edited: 2013-07-24 22:22:52
July 24 2013 22:20 GMT
#6567
On July 25 2013 06:16 darkness wrote:
I've got a question from a relative today what a programmer is supposed to do when it comes to "domain requirements", e.g. it's required from you to create software that will be used in (say) architecture development or any other non-computer field really. The problem is you're a software engineer not an architect, physician or whatever.

What I answered was that the contractor of the project (or the manager) should be responsible to teach/give enough material to programmers to fullfill application requirements. However, is this what's done in practice? Am I close to truth?

Edit: The purpose of the question was that he thinks everyone should understand everything even if it's just a little bit.


Probably not a bad idea to understand the industry in which your code will be running. In particular, there are script compliance rules for certain industries which require obnoxious certifications in order to have use your code.
Check out MISRA for automotive, for example.
http://en.wikipedia.org/wiki/MISRA_C
In this sense, an 'industry panel of experts' has strict rules regarding what features of the language you can use, and how you should use them. It even has rules about benign features, like whitespace. Some certifications require some really strange stuff, like a clean desk, and showing up on time to work as part of the software requirements. I guess it makes sense that if you control the programmer's level of reliability, then his code ought to be more reliable as well. I figure that in pratice, there have been very few software bugs in certified environments, like automotive, space, trains, medical, architecture, etc...

+ Show Spoiler +
Probably worth noting that code that is to specifications is usually 10x harder to debug than hacked together garbage from a jr. dev .
Any sufficiently advanced technology is indistinguishable from magic
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2013-07-24 23:07:45
July 24 2013 23:05 GMT
#6568
On July 25 2013 07:20 RoyGBiv_13 wrote:
Show nested quote +
On July 25 2013 06:16 darkness wrote:
I've got a question from a relative today what a programmer is supposed to do when it comes to "domain requirements", e.g. it's required from you to create software that will be used in (say) architecture development or any other non-computer field really. The problem is you're a software engineer not an architect, physician or whatever.

What I answered was that the contractor of the project (or the manager) should be responsible to teach/give enough material to programmers to fullfill application requirements. However, is this what's done in practice? Am I close to truth?

Edit: The purpose of the question was that he thinks everyone should understand everything even if it's just a little bit.


Probably not a bad idea to understand the industry in which your code will be running. In particular, there are script compliance rules for certain industries which require obnoxious certifications in order to have use your code.
Check out MISRA for automotive, for example.
http://en.wikipedia.org/wiki/MISRA_C
In this sense, an 'industry panel of experts' has strict rules regarding what features of the language you can use, and how you should use them. It even has rules about benign features, like whitespace. Some certifications require some really strange stuff, like a clean desk, and showing up on time to work as part of the software requirements. I guess it makes sense that if you control the programmer's level of reliability, then his code ought to be more reliable as well. I figure that in pratice, there have been very few software bugs in certified environments, like automotive, space, trains, medical, architecture, etc...

+ Show Spoiler +
Probably worth noting that code that is to specifications is usually 10x harder to debug than hacked together garbage from a jr. dev .


That MISRA stuff is interesting. Especially this:

Avoiding using functions and constructs that are prone to failure, for example, malloc may fail.


What do they use instead of malloc? Is there even an alternative to it for dynamic memory assuming they need one?

Plus, this seems like underestimating malloc imho. You can always:


if (variable != NULL) {
...
}
else {
printf("Screw you\n");
}
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2013-07-24 23:24:33
July 24 2013 23:14 GMT
#6569
double post
There is no one like you in the universe.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2013-07-24 23:32:01
July 24 2013 23:24 GMT
#6570
On July 25 2013 05:12 czaku wrote:
Show nested quote +
On July 25 2013 05:00 fdsdfg wrote:
On July 25 2013 04:32 czaku wrote:
Hi guys, i'd need some help from you, a couple of questions to be answered.
A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option.
I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me.
Any tips where i can start?


Just write a 1-line batch file that calls format and throws the output away. You're reinventing the wheel if you try to write a new format utility for no reason.



The problem is it has to be in C/C++ and i prefer C at the moment.



You can run command line inside C++ using system() I think.



On July 25 2013 08:05 darkness wrote:
That MISRA stuff is interesting. Especially this:

Show nested quote +
Avoiding using functions and constructs that are prone to failure, for example, malloc may fail.


What do they use instead of malloc? Is there even an alternative to it for dynamic memory assuming they need one?

Plus, this seems like underestimating malloc imho. You can always:


Maybe they prefer if you used realloc and calloc? No clue :d


On July 25 2013 02:11 tec27 wrote:
Show nested quote +
On July 24 2013 18:33 WolfintheSheep wrote:
On July 24 2013 17:52 tec27 wrote:
On July 24 2013 17:29 Blisse wrote:
Programmers aren't Product Managers. Product Managers talk with higher-ups and Architects who may or may not communicate with Senior Developers before reaching decisions in what designs/implementation details are used in the product - way before you actually have a project to work on. Assuming you're not in very new start-ups, because for most programmers you'll be joining several years in and hopping right into their chosen language. Programmers rarely make real important implementation decisions unless there's a huge issue and/or oversight found.

Whatever company you work at sounds incredibly dysfunctional and you should seek new employment ASAPly

It sounds to me like you don't have much working experience in the field.

Most companies anywhere work like this. Architecture and frameworks are chosen by cost evaluation, programming languages are chosen based on software compatibility or legacy code, and projects are always set before programmers and low-level designers have heard anything except rumours.

And believe me, if you think that's dysfunctional, a company where programmers use whatever they want is several magnitudes worse.

So you think a company where PM's are deciding what technology you'll use and "Solution Architects" (who are clearly, in his example, *not* anyone actually touching the code) are making decisions from on high which you have no actual say in makes for a good place to work? I'm not trying to insult the company, I'm just trying to give advice. If you work at a place that does that, they're treating you like shit and you can do better. If you want to be treated like shit, then have at it


Well, Solution Architects need to touch the code in order to know what it can and cannot do. Not sure where you got the idea that they knew nothing about coding, most of them were previous programmers and moved up? You have a say in what you do. It's just your say is not relevant unless the architect completely missed something in the design requirements.


On July 25 2013 02:55 tec27 wrote:
Decent programmers are not going to say "I like python" and think that's a good reason for choosing it for a project. If your company doesn't trust you to be able to pick the right tool for the job, they think you're a moron and unless you actually believe you are a moron, you should find a new job. Its really not that difficult.

There are plenty of companies that will treat you like shit, I'm not arguing that they don't exist. I'm just saying that if you have any self-respect and desire to actually work effectively, you shouldn't work for them.


Do your companies actually allow you to pick your tools for the job? I'm not sure what kid of jobs we're describing here because I really don't think it's the same set. I'm not aware of jobs where you're given "arbitrary project" as a programmer and then management is like, "do it", and then you do it in whatever way you want. For the most part I would've thought sometime somewhere in management they've received design requirements from the customer and then they consulted with a consultant/architect on what can and cannot be done (who may consult with you if he/she requires), then they delegate the task to you and your programming team. Not sure what hierarchical system you're describing though.


Anyways, the way you describe this is like you're looking down on code monkeys, and while they're pretty bad, that's a huge reality of the profession and you shouldn't be an asshole about people who have to program in those environments and have yet to figure out they don't belong.
There is no one like you in the universe.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
July 24 2013 23:42 GMT
#6571
On July 25 2013 07:08 fdsdfg wrote:
Show nested quote +
On July 25 2013 05:55 nunez wrote:
On July 25 2013 05:28 fdsdfg wrote:
On July 25 2013 05:12 czaku wrote:
On July 25 2013 04:54 tofucake wrote:
On July 25 2013 04:32 czaku wrote:
Hi guys, i'd need some help from you, a couple of questions to be answered.
A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option.
I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me.
Any tips where i can start?

Why?


It's a project to pass the next semester from programming and she is not interested in learning it. So she asked for my help. Basically you show the teacher code, explain how it works and you passed.


On July 25 2013 05:00 fdsdfg wrote:
On July 25 2013 04:32 czaku wrote:
Hi guys, i'd need some help from you, a couple of questions to be answered.
A friend of mine has a project to do during holidays. She needs to low level format whole HDD (this means filling each byte with 0x0). And now it begins. It cannot show any dialog, so calling system("format c:/") is not an option.
I've seen some codes in C++ but i'd prefer it to be C as i have it in school (basically whole theory covered so i only need experience and research) so i can understand your tips better. Is it even possible in C? In C++ i can try using CreateFile() and then ReadFile(), WriteFile() with HDD. But then i thought of bad sectors and it snared me.
Any tips where i can start?


Just write a 1-line batch file that calls format and throws the output away. You're reinventing the wheel if you try to write a new format utility for no reason.



The problem is it has to be in C/C++ and i prefer C at the moment.


You're asking for help on writing your friend's school project for her? She should fail if she can't learn the stuff. Programmers work on teams, and I wouldn't wish a useless teammate on any fellow programmer, which is what you're trying to inflict.


i too enjoy moralizing instead of shutting up when i am unable to answer.


If he asked for $20 and you didn't send him $20, would it be right to assume that you don't have $20 to your name?

depends on context.
conspired against by a confederacy of dunces.
DeltaX
Profile Joined August 2011
United States287 Posts
July 25 2013 00:00 GMT
#6572
On July 25 2013 08:24 Blisse wrote:

Do your companies actually allow you to pick your tools for the job? I'm not sure what kid of jobs we're describing here because I really don't think it's the same set. I'm not aware of jobs where you're given "arbitrary project" as a programmer and then management is like, "do it", and then you do it in whatever way you want. For the most part I would've thought sometime somewhere in management they've received design requirements from the customer and then they consulted with a consultant/architect on what can and cannot be done (who may consult with you if he/she requires), then they delegate the task to you and your programming team. Not sure what hierarchical system you're describing though.


Anyways, the way you describe this is like you're looking down on code monkeys, and while they're pretty bad, that's a huge reality of the profession and you shouldn't be an asshole about people who have to program in those environments and have yet to figure out they don't belong.


I think it depends on various factors including:

1. Size of team
2. Who came up with the project
3. Culture of organization (related to first 2)

If the team is going to be large and a "higher up" came up with the project, it is unlikely you will have much choice on something as core as the programming language or major tools that affect others. If on the other hand it is a smaller project, or you/your manager came up with the project idea yourselves and got it approved, then you could make almost any decision and as long as you can justify it, then go for it.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
July 25 2013 00:09 GMT
#6573
On July 25 2013 06:22 1handsomE wrote:
Hi. I am a relatively junior level programmer (2 years professional experience) who just got an actual programming job (UI Programmer) in the game industry. I was wondering if there was anyone else on the forums who works in the industry?

Edit: DM me, let's be friends!


oh damn nice job. I want to get into UI programming maybe UX design, though design doesn't really fit into programming. congrats.
There is no one like you in the universe.
ThatGuy
Profile Blog Joined April 2008
Canada695 Posts
July 25 2013 01:11 GMT
#6574
On July 25 2013 06:22 1handsomE wrote:
Hi. I am a relatively junior level programmer (2 years professional experience) who just got an actual programming job (UI Programmer) in the game industry. I was wondering if there was anyone else on the forums who works in the industry?

Edit: DM me, let's be friends!


Hia, yeah, I also do UI programming for Ubisoft . Good luck in the field!
phar
Profile Joined August 2011
United States1080 Posts
July 25 2013 03:34 GMT
#6575
On July 25 2013 08:05 darkness wrote:
What do they use instead of malloc? Is there even an alternative to it for dynamic memory assuming they need one?

Read up on the code they use on Mars. You don't use dynamic memory.
Who after all is today speaking about the destruction of the Armenians?
Fawkes
Profile Blog Joined May 2010
Canada1935 Posts
Last Edited: 2013-07-25 03:49:07
July 25 2013 03:44 GMT
#6576
A php related question.

I'm working on some old code written by someone who I can't really get a hold of anymore. Is there a reason why these two blocks of code work differently in php? I just started dabbling with php within the last month.


$sql = "select achievement from achievement_list";
$sql = $sql." where achievement_id = ";
echo "$sql<br>";

This echos
"select achievement from achievement_list where achievement_id = "


$sql = "select achievement from achievement_list where achievement_id = ";
echo "$sql<br>";

This echos nothing.

Another possibly somewhat related thing was trying this (this code is the same block as the first, except there's a value 1 at the end)

$sql = "select achievement from achievement_list";
$sql = $sql." where achievement_id = 1";
echo "$sql<br>";

This echos
"select achievement from achievement_list where achievement_id = " missing the 1.

I realize the first two queries don't actually do anything. With a quick glance from anyone experienced with php, is this something obvious I am missing or there may be more than meets the eye and I would need to investigate deeper?

My actual end goal was to end up doing something like

$sql = "select achievement from achievement_list";
$sql = $sql." where achievement_id = $achievementsel";
echo "$sql<br>";

which I was trying to pass it some selection menu's value when the form was submitted. But it wasn't working, so I simplified the query and then ended up with the weird situations above.
Taeyeon ~ Jennie ~ Seulgi ~ Irene @Fawkes711
tofucake
Profile Blog Joined October 2009
Hyrule19228 Posts
Last Edited: 2013-07-25 03:52:52
July 25 2013 03:50 GMT
#6577
They work as expected for me. There is likely something else you've left out is futzing with $sql
https://tofucake.net/fawkes.php
https://tofucake.net/fawkes.phps
Liquipediaasante sana squash banana
Fawkes
Profile Blog Joined May 2010
Canada1935 Posts
July 25 2013 03:54 GMT
#6578
Alright thanks. At least I know it is supposed to work.
Taeyeon ~ Jennie ~ Seulgi ~ Irene @Fawkes711
Fawkes
Profile Blog Joined May 2010
Canada1935 Posts
Last Edited: 2013-07-25 06:03:57
July 25 2013 04:45 GMT
#6579
Let me rewrite this to the simplest way possible.


$sql = "select achievement from achievement_list";

$sql = $sql." where achievement_id = 1";

//$sql = $sql." where achievement_id = ".$achievementsel;


$sql = "select achievement from achievement_list";

//$sql = $sql." where achievement_id = ".$achievementsel;

$sql = $sql." where achievement_id = 1";


These two chunks of code, are not doing the same thing for me and I have no idea why.

+ Show Spoiler [frustration x1000000000000] +


//$sql = "select achievement from achievement_list";

//$sql = $sql." where achievement_id = ".$achievementsel;

//$sql = $sql." where achievement_id = 1";

$sql = "select achievement from achievement_list where achievement_id = 1";
echo "$sql<br>";



$sql = "select achievement from achievement_list where achievement_id = 1";

//$sql = "select achievement from achievement_list";

//$sql = $sql." where achievement_id = ".$achievementsel;

//$sql = $sql." where achievement_id = 1";

echo "$sql<br>";


The first chunk of code prints "select achievement from achievement_list where achievement_id = 1". Second does nothing.
For the record, the code after these lines just perform the query using $sql.


Wow this is so inconsistent, I don't even know what is going on anymore.
Taeyeon ~ Jennie ~ Seulgi ~ Irene @Fawkes711
HardlyNever
Profile Blog Joined July 2011
United States1258 Posts
July 25 2013 05:08 GMT
#6580
The comments and line breaks shouldn't affect anything. It looks like it is supposed to pull "achievementse1" from some form or something where the user inputs that value. I can't really tell what else is supposed to be going on with what you have shown.
Out there, the Kid learned to fend for himself. Learned to build. Learned to break.
Prev 1 327 328 329 330 331 1032 Next
Please log in or register to reply.
Live Events Refresh
PiGosaur Cup
00:00
#90
CranKy Ducklings178
davetesta57
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft539
RuFF_SC2 146
Nina 129
FoxeR 67
StarCraft: Brood War
Rain 3978
GuemChi 2943
NaDa 61
Counter-Strike
summit1g7793
tarik_tv4429
taco 268
minikerr52
Super Smash Bros
hungrybox507
Other Games
C9.Mang0339
ViBE246
Maynarde165
XaKoH 125
CosmosSc2 20
Organizations
Other Games
gamesdonequick2884
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 15 non-featured ]
StarCraft 2
• Hupsaiya 105
• EnkiAlexander 50
• CranKy Ducklings SOOP28
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Lourlo235
Other Games
• Scarra2371
Upcoming Events
The PondCast
7h 31m
Kung Fu Cup
8h 31m
Replay Cast
1d 6h
CrankTV Team League
1d 8h
Replay Cast
2 days
CrankTV Team League
2 days
Replay Cast
2 days
RSL Revival
3 days
Clem vs Lambo
Scarlett vs Cure
CranKy Ducklings
3 days
IPSL
3 days
Dragon vs Hawk
[ Show More ]
RSL Revival
4 days
Classic vs Trap
herO vs SHIN
Sparkling Tuna Cup
4 days
IPSL
4 days
Bonyth vs Ret
WardiTV Weekly
5 days
Monday Night Weeklies
5 days
PiGosaur Cup
6 days
Liquipedia Results

Completed

YSL S3
HSC XXIX
Eternal Conflict S2 E2

Ongoing

IPSL Spring 2026
Acropolis #4
CSL 2026 Summer (S21)
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
SCTL 2026 Spring
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026

Upcoming

Escore Tournament S3: W3
ASL S22 SEASON OPEN Day 1
Escore Tournament S3: W4
ASL S22 SEASON OPEN Day 2
Escore Tournament S3: W5
CSLAN 4
Blizzard Classic Cup 2026
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
Light Tournament 2026
Eternal Conflict S2 Finale
Eternal Conflict S2 E3
Logitech G Connect 2026
StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
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 © 2026 TLnet. All Rights Reserved.