« first day (999 days earlier)      last day (3931 days later) » 

11:00 AM
vim always removes the new line at the end of file, and I get these in diffs all the time:
\ No newline at end of file
Anybody know how to fix this?
 
@an1zhegorodov Just tell diff to ignore it.
 
2
Q: PHP don't load extension

Ilya KeyI wrote my extension. Ubuntu system. php -c "/etc/php5/apache2/php.ini" -r "echo extension_loaded('my');" => 1 OK! But under apache - nothing! echo extension_loaded('my'); => "" Why? Php ini shows: "Loaded Configuration File /etc/php5/apache2/php.ini"

 
@Jack is there a hex format that adds 00 to each element ?
@Jack eg instead of FFD8 you have FF00D800
 
@iroegbu , check that needed config loaded
 
@hakre ^^ any ideas too
 
11:08 AM
@iroegbu , try to use DL
 
@Baba FF00D800 is wrong hex format.
 
Question can this code be more OOP?

class koffiequery {
public function koffie($str){

if(isset($_POST['submit'])){
$haal = "SELECT * FROM koffie ORDER BY RAND() LIMIT 1";
$jij = mysqli_query($connect, $haal);
$koffie = mysqli_fetch_assoc($jij);
echo "test";

return $antwoord;
}

}
 
@YogeshSuthar i know .... Am just curios why an OP would get that format
@YogeshSuthar do you want to take a look at the question ?
 
@Baba Yeah.
 
2
Q: convert binary data to image using php

Kartik itI have binary image data saved in my old database, it is saved by my old developer, now i want to display image from that using PHP, but i can not.. one example of data is here. binary data example: http://freezinfo.com/gg.php i have tried imagecreatefromstring, but not working. so, is t...

 
11:12 AM
@Baba Ehm, pack() and unpack() come to mind.
 
@Baba +1 very well explained answer. :)
 
@YogeshSuthar Thank you .. but how still curios how 00 got inserted
@Jack would any of this automatically insert 00 ?
 
@Baba Oh, read it again ... hmm, I dunno, utf-16? lol
 
@Baba May be his previous developer wants to secure data from other users. Just a random guess.
 
@YogeshSuthar why not pad with random hex ???
@YogeshSuthar 00 makes it too obvious
 
11:15 AM
@Baba Actually, if the data is dumped into a string and utf16 encoding is switched on in php.ini, it might happen.
 
@Jack anyway i knew the developer on the other end was a clown when it return the hex with HTML included
 
Damn clowns!
 
@Baba All developers not thinking in same way. :)
 
<html><head></head><body>FF00 .... </body></html>
@YogeshSuthar marriage of HTML + HEX ??? that is a destructiveness
@YogeshSuthar Nothing good can come out of that thinking
 
hahaha
 
11:19 AM
@Baba Can't pack take care of those 16bit numbers? Or drop each second?
And I dunno if reverse-engeneering is off-topic on SO ;)
 
@hakre How do you do that with pack ?
 
@Baba well extract an array of 16 bit numbers (with low nibble first), then map with chr() and then implode()?
 
@hakre did not want to use implode ... might be expensive
$newData = "";
for($i = 0; $i < strlen($data); $i += 4) {
    $newData .= $data{$i} . $data{$i + 1};
}
 
For your enjoyment:
0
Q: OOP how to show query

TredgedI just started with OOP and I am trying out some things but I got 2 simple questions which I need help for. The code below is it possible to OOP'efy it more? class koffiepost { public function koffie($str){ if(isset($_POST['submit'])){ $haal = "SELECT * FROM koffie ORDER B...

 
@hakre ^^ used simple loop taking first 4 only pad first 2
 
11:21 AM
> The code below is it possible to OOP'efy it more?
 
@DaveRandom hehehehe ... not sure where to start
@DaveRandom OOP'efy ... lol
 
@DaveRandom It can still be your enjoyment, but still improvement for others ;)
 
I really want to be constructive because I remember when I used to write things like that, and it wasn't so very long ago. But I really don't know where to begin
 
@Tredged it get migrated.
 
I love my ternaries.... :')
 
11:24 AM
@Tredged not sure if it will survive the migration
 
var ex = "No" + ((X.length != 0) ? ((Y.length != 0) ? 'Z' : 'Y') : 'X') + "Exception";
 
@YogeshSuthar What does that mean ?
 
@Tredged see your question. It get migrated to Code Review
 
:)
 
Looks like you need more MVC. And jQuery. — Jimbo 23 secs ago
 
11:26 AM
@Tredged coffee often helps!
 
@hakre Coffee for what ?
 
@Tredged questions asking whether code can improved or is okay are usually better suited for CodeReview.SE. Questions on SO should be about concrete programming problems you face instead.
 
@Gordon Thank you Gordon!
 
Coffee + Script == CoffeeScript. :P
 
@Tredged no problem
 
11:27 AM
@Tredged The part that I enjoyed was the word "OOP'efy". I will say this: that code is a long way from OOP. And (based on my personal experience) you have a long way to go before you will truly understand why. But please keep trying, I don't want to discourage you at all.
 
@DaveRandom Yea I lol'd at that word to :P
 
@Tredged Coffee for the brain :) (and also for me, I need some more)
 
@hakre Haha :P
 
oh. I just noticed I actually do have a CodeReview.SE account.
 
Me too, got 101 rep xD
 
11:30 AM
I have 166. Clearly I'm over 50% better than you.
 
xD
It is nice to have a community that actually provides help
 
Gordon, Essen, Germany
166 3
 
How do I force VIM not to add newline at the end of file?
 
@DaveRandom just like me :D
 
PLB
I've 167. :D
 
11:32 AM
0
Q: Why would Vim add a new line at the end of a file?

Buzu Possible Duplicate: VIM Disable Automatic Newline At End Of File I work with wordpress a lot, and sometimes I changed wordpress core files temporarily in order to understand what is going on, especially when debugging. Today I got a little surprise. When I was ready to commit my change...

 
@DaveRandom You are clearly around 164.35643564356435643564356435644% better than me
 
@Tredged I'll warn you now, it's likely that your question will get closed. Really it's two questions, firstly there's the code review element or if, that belongs where it is, then there's the second part of it - that part does belong on SO. I recommend you remove the second question from the code review, and ask a new question on SO that just asks that question (which I don't quite understand anyway, what exactly are you asking?)
 
@DaveRandom I second that
 
Ill delete that second part then! @DaveRandom
 
@Gordon thank you
 
11:34 AM
@Tredged when you create the new question on SO, don't forget to show what you have tried ;-)
 
I'll sure do @DaveRandom
 
0
Q: bug in user image in chat

NullPoiиteяIn chat certain users image is not showing correctly but when we change 16 to 18 in image src it just works fine please let me know if its dup i tried but couldn't find

 
@NullPoiиteя I think it is. It's a problem with the images hosted on SE (imgur) IIRC, gravatar work OK
 
what happened to my profile image here
 
They really need to pull their finger out as well, it was reported ages ago
 
11:36 AM
@NullPoiиteя That looks like a bad memory chip defect when resizing an image.
Bit level errors FTL.
 
lololololol
0
Q: Answer looks corrupted!

Joe TatavaranI'm dealing with RegEx therefore I browse various posts but today I found this one: Look here: First Answer looks corrupted! RegEx match open tags except XHTML self-contained tags I'm just guessing this may be by design? or some bug caused this?

 
@Tredged on a side note if you only need some clarifications on concepts or something, feel free to ask in here as well
 
I tried but no-one answered xd
Guess it went to fast
 
lmao
 
@Tredged maybe that or maybe no one was in the mood. can happen, too. dont take it personally though.
ok, im back to work again. laters
 
11:39 AM
@Gordon Nah its fine, goodluck Gordon!
 
Hey guys, can I ask for some advice? <-- quite a nooby
 
Discussion for all things PHP - Don't ask whether someone is here to help you. If someone is around and wants to help they will.
 
Is that what it says? Not seen it for ages
 
@DaveRandom LOL
 
Okay well, I need to write a PHP app that sends out emails but those emails all have attachments that need to be attached automatically.. This process needs to happen for 100 or so emails and I'm wondering what the best method or library will be?
 
11:41 AM
I think Don't ask whether someone is here to help you needs rephrasing a bit to include something about "don't ask whether you can ask a question because it is totally redundant and very annoying"
 
@SnakeEater doesn't sound fishy at all
 
XD
 
Its for a life insurance company, they need to send out policy documents.
 
@SnakeEater Are you attaching the same file to every email or does each email have a different attachment?
Also, do you have an SMTP server you need to relay through, direct send, pipe to Exchange or... etc etc
 
Each email has a different attachment, but I was thinking of naming those documents according to their policy numbers or someother unique ID
 
11:43 AM
I see. I think I know what I am doing, and why it's working. When passing the parameter, I'm actually assigning a value to a variable, which returns true. The true value is then passed to the function as the 2nd param. Mystery solved and yet another reason why PHP sucks comparative to Python. — Eduard Luca 1 min ago
 
0
Q: ekkk what is happening to my profile image in chat

NullPoiиteяI posted my meta profile link in chat and my image got defected this is how its looks in my profile as you can see and in chat I want that butterfly back :)

 
Why do i feel insulted when people abuse PHP rather than contribute or suggest ways of improvement ???
 
@SnakeEater How you handle that doesn't really matter tbh, it just changes the game somewhat (because you can't just send one email and BCC everyone into it)
 
0
A: OOP how to show query

JimboSomething important to remember: OOP is not about "shoving code in a class". OOP is about a different way of thinking - everything is an object, encapsulating data and self modifications of that data within methods. OOP also focuses on code-reuse. Can you re-use that code somewhere else? Na...

 
Yeah so each email needs to be unique, the body also has a couple of variables in it too
email body*
 
11:45 AM
Firstly, start here for the actual email construction and sending.
 
@NullPoiиteя Your butterfly is virus infected because of that it is not showing in chat. :P
 
Nextly, be aware that this is going to be sloooooow
I have spent the few days battling this on and off
 
^ Genuine opinions welcome, I'm always here to learn.
 
and im also not using a db, using an excel spread sheet :P
 
Why is my host redirecting the page I am using PDO on?
 
11:47 AM
Again, not really relevant to the program. You the program just has a data access module that is a black box to the rest of the code
@Tredged The fact that you are using PDO on it has nothing to do with it, I'll tell you that much
 
Sooo, I know you'll say I'm a hater, but PHP is sooo lame (specifically @Baba)
 
@EduardLuca define lame ?
 
Well, that was constructive and not even remotely inflamatory
 
well just as i commented, you can do things much faster in other languages
 
@EduardLuca You code in C++, don't you?
Disgusting.
 
11:49 AM
no, sadly PHP and a little Python
 
@DaveRandom thanks for the help mate, will let you know how it progresses (if you are interested) :)
 
Well if it's so lame, why do you use it?
 
PLB
@Jimbo IMHO, it'd be better to advice to look at basic concepts.
 
@PLB Like abstraction, encapsulation, polymorphism, the posh words etc?
 
PLB
yep
 
11:50 AM
@DaveRandom because it's my job.
 
@SnakeEater No worries. I do something similar and I've been looking into options for speeding it up recently. The first thing you should do though is just get the logic sorted, and SwiftMailer will help with that
 
@EduardLuca faster in other languages ? It depends on what you are writing
 
of course, all languages has ups and downs, but lately it seems to me that PHP has a lot of downs
have*
 
PLB
Also, I think that working with data-sources while trying to learn OOP principles is bad idea.
 
PHP is slower than C. But if it takes 2 months vs. 2 years to write the application, 30ms/request improved response time is going to take a long time to recoup.
5
 
PLB
11:52 AM
It's better to create little ideal worlds. @Jimbo
 
@DaveRandom +1
 
6
Q: Why decremented of NULL not negative in this array?

MR SrinivasI have tried this code $a = array_fill(0, 4, NULL); $a[0]++; ++$a[1]; $a[2]--; --$a[3]; var_dump($a); Result: array(4) { [0]=> int(1) [1]=> int(1) [2]=> NULL [3]=> NULL } Why value of 2 and 3 index is not negative?

 
i didn't mean the application is faster, the development is. and i'm not talking about C, i wouldn't use C for web.
 
@DaveRandom i second you +2
 
@PLB I updated the answer with some basic concepts
 
11:54 AM
lolzzz the question is getting upvotes faster. Is it sheap voting?
 
<?php

$db = new PDO('mysql:host=localhost;dbname=admin_heijmans;charset=utf8', 'admin', '******');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);

$stmt = $db->query('SELECT * FROM DWA');
$row_count = $stmt->rowCount();
echo $row_count.' rows selected';
?>
Why wont that work _
 
PLB
@Jimbo Your answer is more likely advice where/how to start learning OO architecture than reviewing current code. But +1 anyway, it's quite good.
 
@PLB Hah! It's awesome to know I'm not actually that full of sh*t!
 
PLB
:P
 
@EduardLuca and your preferred alternative would be...?
 
11:58 AM
@DaveRandom Think you can help :)?
 
@Tredged That should work... if it isn't working, what error message do you get?
 
Nothing lol
Blanco page
 
At least, it should work assuming the mysql connection details are correct and the DWA table exists
 
Yes connection is right and table does exist lol
 
@Tredged Add error_reporting(~0); ini_set('display_errors', 1); as the first line of your script
 
12:01 PM
@DaveRandom still blanco
 
If you ever get a WSOD that should be the first step
 
@Tredged Then the most likely answer is a syntax error
Check your web server's error log
 
@DaveRandom Either something compiled like C# or Python
 
@nikic What do you think about Named Parameters ?
 
12:03 PM
@DaveRandom Lol even the logs dont showup anything lol
 
@PeeHaa ping
 
@PeeHaa how are you doing today ?
 
@Baba I have being waiting the entire day for a client to give me. 5 minutes they said...
 
@EduardLuca .NET isn't really compiled. And I thought the point was speed of development? How does using a compiled language help with that?
 
12:05 PM
hi, everyone i am new to php..would anyone tell me which book i read.
 
@Tredged Then you quite possibly are viewing a cached version, try refreshing with ctrl+F5
 
@PeeHaa lol ....
 
@DaveRandom I also did that LOL this is creepy.
 
@DaveRandom debugging support out of the box is the first thing that comes to mind. Plus threadding.
 
@Sarah The Hitchhikers Guide to the Galaxy. It won't help you learn PHP but you should read it anway.
The best book for learning PHP is php.net/manual/en
 
12:07 PM
@PeeHaa PhpStorm vs ZendStudio ... which one do you prefer ?
 
@EduardLuca Threading is not only not required, it is usually counter productive for a web environment.
Worrying about parallelisation is the job of the webserver, not the application
 
@Baba phpstorm without any doubt
 
And debugging support out of the box isn't a solid reason either. XDebug is not exactly difficult to set up
 
That is if I have to choose (at gun point)
 
Wow she has 17 rep and is able to chat here ?
 
12:09 PM
@PeeHaa really .. have not used phpstorm before .. using ZendStudio at the moment
 
user image
3
golden
 
@DaveRandom So not true. What if you need to quickly make multiple API calls to a slow API? How would the webserver help then? Besides, apache doesn't handle PHP that well, opening up a separate process for each request? What's that about?
 
@HamZa Had 21 7 minutes ago
 
@Baba I was ranting on ZS some while back. I thinbk it was in deiscussion with @Jack
 
ah ok ...
Is it because of the mod tools lol ?
 
12:10 PM
Also XDebug is not ideal. It gives up when you need it the most.
 
@EduardLuca You don't need threading for that. You don't want threading for that either, it would be slower and more resource hungry than simple async calls.
 
@HamZa woops ...
 
@PeeHaa @Jack ..... Comments ?
 
With async calls it's harder to know when all calls are done. Hence you need to do more development :)
 
@EduardLuca Apache isn't the recommended (by most people in this room, anyway) way to serve PHP. And Apache can be made to run in a multithreaded MPM if you really want. And the prefork doesn't spawn a net process for each request, either.
 
12:12 PM
PDO is so much easier
 
@EduardLuca Couldn't disagree more
Where's @rdlowrey when you need him?
 
OK, I give up. This just started over a comment I left for @Baba on one of my questions about named params, so I just wanted to hear his take on why PHP is that great.
 
See no-one here is going to claim PHP is perfect. Named params are a feature that many would like to see. But what you did was effectively come in here spoiling for a fight.
26 mins ago, by Eduard Luca
Sooo, I know you'll say I'm a hater, but PHP is sooo lame (specifically @Baba)
^^ that's not a constructive way to start a conversation
 
@DaveRandom +1
 
true
 
12:18 PM
@EduardLuca Do you solemnly swear to take PHP as your friend ?
 
lol
 
It is my friend, just not my best friend anymore. I used to love it :)
 
I can't pretend PHP doesn't suck. But the alternatives also suck, they just suck in different ways.
4
 
Everything sucks. If you think your language doesn't suck you just haven't used it enough.
 
I mean language-wise, C# is much nicer to work with. .NET on the other hand... not so much
 
12:20 PM
@EduardLuca you sound more like you want divorce than marriage ... @DaveRandom is a divorce lawyer
 
@DaveRandom PHP is nicer to me , and easier also
 
@DaveRandom and @cspray +1
@Baba not necessarily divorce, just some time apart
 
Of course it's easier, that's the partly point of it. But that's also it's downfall - the more you abstract things, the hard it becomes to mess with the nuts and bolts when it is necessary to do so
 
@PeeHaa @hakre projecteuler.net/problem=79 nice challenge :p
 
12:23 PM
@HamZa simple
 
@Dev. Don't fear the strongly typed language. And don't fear the 100% OOP language. But if you don't understand those elements, you're gonna have a bad time
 
5
Q: Taking password letters not whole one, is this secure?

AhsanI found a site which is taking password letters from their users not the whole password. Is this secure? Or do they have saved password as salted hash (MD5)?

 
@Dev. learn the underlyinig concepts, not an ini-between implementation. period.
 
@DaveRandom Is this correct in a good way?

foreach($db->query('SELECT * FROM koffie') as $koffie) {
	echo nl2br("Naam:" . $koffie['naam'] . " \n Koffie: " . $koffie['koffie'] . "\n\n");
}
 
@HamZa very very very very very very very very very very BAD ...
 
12:26 PM
@HamZa remember the euler problems?
 
@Baba Check the answers, some of them are interesting
@kaᵠ haaa, when I was reading the answers I remembered P79 :D
 
@HamZa its also a terrible prevent key-loggers from obtaining the whole password.
 
@Baba Can you suggest an alternative ?
 
@HamZa design a keypad with random position
 
@HamZa i have seen banks offering a virtual keyboard (although i didn't check the source code) to enter a pin-like password
 
12:29 PM
@Tredged It's... acceptable - but why use nl2br() when you could just echo the <br>s directly?
 
the virtual keybd had shuffled keys every time
 
Because I disgust the <br /> I need a more nicer way xd
is there any disadvantage for nl2br @DaveRandom
 
@kaᵠ virtual keyboard is better if you know what you are doing
 
@kaᵠ is it online ?
 
@Tredged it's a function that does stuff, obviously it's gonna decrease your performance
 
12:30 PM
Kaspersky for example provides a virtual keyboard
 
yes online, @Baba should counter keylogs
 
@Tredged Well it's just giving your script more work to do. You're creating a string and doing a static replacement op on it, whereas you could just as easily create the end result string without the replacement
 
@dragon112 Ye thats true @DaveRandom Thanks both.
 
It doesn't really matter that much, but it's unnecessary work
 
@Baba keypad ? For real or virtual ?
 
12:32 PM
@HamZa virtual but you have to keep 3 things in mind
 
@Baba ???
 
randomize key position each time rendered; randomize key names each time
 
@HamZa 1. Random Position 2 . How you save entered Information bust Importantly Unique Key for each login attempt
 
ping -t @PeeHaa
 
Reply from @DaveRandom: No route to host
 
12:36 PM
@Baba and the 3rd point ?
 
ping -t @Lusitanian
(I can't believe I fell for that)
 
@HamZa Unique Key for each login attempt
 
@Baba makes sense ...
 
12:39 PM
@BenjaminGruenbaum +13 in three hours? That's impressive.
 
@HamZa Do you still need PHP solution to projecteuler.net/problem=79 ?
 
Poor guy's about to lose 130 rep :D
 
Is it possible that when I switched from mysqli to pdo my pageload time is 50% faster?
 
He shouldn't have answered a 'brain fart' question to begin with
@Tredged Everything is possible if you believe in yourself (also no)!
 
xD
 
12:42 PM
@Baba I once made it by hand
 
@HamZa oh ok
 
@Baba But that would be interesting to see a php solution. If you have an idea and the time ?
 
@HamZa ah lol. It's missing that the password length is known.
 
@HamZa you can read the forum since you solved it...
 
@kaᵠ yeah :p
 
12:44 PM
@hakre wow hakre..
@hakre Thanks lol
 
@hakre the length isn't known in that challenge
 
@HamZa yeah but on that SO question.
 
@hakre ah yes, my bad ^^'
 
@Tredged elaborated enough? :)
 
@hakre Amazing lol
 
12:59 PM
Morning
 
monring
 
@Baba that's a badly formed question. Are the tripplets in-order? Or not... ;-)
 
@ircmaxell Given that the three characters are always asked for in order
 
ah whoops
 
@Baba nice picture this gives: stackoverflow.com/a/17594208/367456 (and it's with pack/unpack)
 
1:09 PM
@DaveRandom It only does it for the same ones that the current prototype does.
 
@LeviMorrison Needz moar anchors :-)
 
@Baba It's a pity that question doesn't have better sample data - sample data with the minimal code containing the same number twice is much more interesting
 
@DaveRandom It gives you links like this, at least: prototype.php.net/manual/en/…
 
@ircmaxell which question is that ?
 
I misread it
 
1:12 PM
@Jasper yeah .. am curios how that hex was generated
 
@LeviMorrison Indeed, but what I would like is for The global keyword to be an anchor that points to that URL, so I can just right-click -> copy link address when I'm telling people to RTFM
 
@hakre Interesting approach +1
 
@Baba I think it was this way:
 
@Jasper lol
 
1:22 PM
posted on July 11, 2013 by Qafoo - PHP

I consider public methods not originating from an abstract class or interface a code smell – at least when following class based object orientation design principles. Let me explain why…

 
@Baba What's all this talk about ZS?
 
Can I report Feeds for trolling?
 
@Baba Not really important imho, but nice to have
 
@Jack PS vs ZS which is better .... Am using ZS now
 
Not sure about phpStorm ... do they have a free trial?
 
1:35 PM
use sublime =P
 
@NikiC seeing a lot of questions about that lately .. is it difficult to achieve in PHP
 
ZS is so-so ... the code helpers don't always work very well and it tends to slow down on bigger projects.
 
@Baba Hard to implement, yes
 
@tereško intelli-sense for php seems poor
 
And really close to the foo(['bar' => $baz]) syntax you can have now
 
1:36 PM
@Baba What is the most commonly used language that uses named parameters?
 
@NikiC I see why no one has taken it up yet
 
Sometimes you highlight a variable and nothing happens ... you click here and there and then on the variable again, then it highlights all occurrences ... it's like nobody tests this stuff.
 
@Jack yes
 
@Danack Most notably Python I believe.
 
@jack there's a link on the right to PHPstorm 7 with PHP5.5. support - that's an beta build so is license free for 30 days - though they also do a trial version as well.
 
1:38 PM
@Danack Python ?
@Jack so i guess you prefer PHPStorm
 
@Baba Dunno yet, I'll give phpStorm a whirl and let you know :)
 
@Danack Objective C also has something you might call named parameters, but without optional parameters it doesn't have many of the same issues/benefits
 
@Jack Using ZS now ... and am getting errors lately ... github issues
 
Anonymous
Working with PHPstorm is like flying a plane: So many options, features and things to click.
 
Anonymous
I probably know 1% of it, at this time.
 
1:43 PM
I've got a C background. If I ever wanted to call a function with a list of arguments worth worrying about which were optional, it would be time for a struct to hold them all. Much cleaner than named parameters and you can also do:
options = getDefaultOptions();
options.onlyThingICareToSet = 5;
callFunction(options);
Which in PHP => pass by an array.
 
@Danack That needs more than one line though ^^
 
options = getDefaultOptions(); options.onlyThingICareToSet = 5; callFunction(options);
 
........ooooooooooooOOOOOOOOOoooooooooooo.......
 
with arrays it is one line though, so that's okay :)
 
There - all on one line.
 
1:45 PM
@Danack One line === one expressoin ofc :)
 
What am I doing wrong?
 
@Baba What does ZS stand for?
 
@Jasper Zend Studio
 
Thanks
 
or Zuper Shaker @Jasper
 
1:47 PM
hehe
 
Could someone please help me _
$query = $this->db->prepare("SELECT * FROM `leden` WHERE `email` = ? AND WHERE `wachtwoord` = ?");
$query->bindValue(1, $email);
$query->bindValue(2, $password);
 
Anonymous
('1', $email) @Tredged
 
LOL
 
@Tredged Why are you not using named parameters?
 
What do you mean? @MadaraUchiha
 
1:48 PM
SELECT * FROM `leden` WHERE `email` = :email AND `wachtwoord` = :password
 
hello
 
Then you bind it by name.
 
@MadaraUchiha Because he's using mysqli not pdo ?
 
thats nice
 
@Simon_eQ How does that help?
 
1:49 PM
Upsides: More readable, and you don't need to worry about hte order.
 
its PDO?
 
@Danack It looks pdo to me.
 
@Danack If he were using mysqli, there wouldn't be bindValue (bind_value, if I'm not mistaken)
 
Well he should be using named parameters then!
 
@MadaraUchiha How would I define that :email ?
 
1:50 PM
@Tredged You name it whatever you want
 
Anonymous
`i dont know
 
Then you bind it to that name, instead of the number
 
Okay :)
 
$query->bindValue(":email", $email);
(If in the query, you called the parameter :email)
 
Or $query->execute([':email' => $email, ... ]);
 
1:51 PM
Yeah, it doesn't really matter. I just like binding each one individually (unless there's a need to do it otherwise).
 
does anyone know a workaround for IE9 and iframe height attribute? It is strange
 
@MadaraUchiha I would only do that if the type is important :)
Yes, make IE9 emulate IE7 ... problem solved =D
 
Anonymous
4
A: what is the PDO equivalent of mysql_real_escape_string

Simon _eQThere is none! That is why you use prepared statements. Just connect using: try { $conn = new PDO('mysql:host=localhost;dbname=mydb', 'root', 'test', array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION)); } catch(PDOException $e) { echo 'ERROR: ' . $e->...

 
Hmm ... $dbh->quote() :)
Saying "there is none" is not completely truthful.
 
@MadaraUchiha Other question if u would like to answer, $row_count = $query->rowCount(); after the query exceuted is that the right way to get the rowcount?
and @Jack
 
1:53 PM
@Tredged No.
 
@Jack Why not?
 
Though @DaveRandom will tell you that for MySQL it actually works :)
 
Anonymous
@Jack read the comments
 
It only works well for a few kinds of databases for SELECT. MySQL is one of those databases, but don't be surprised if it fails should you switch db types.
 
@Simon_eQ I didn't have to :) and I don't know what YCS was going on about either =p
 
1:56 PM
@MadaraUchiha Then what is the right way ? fetchAll()? PDO::FETCH numrowS?
 
@Tredged The most portable is to either iterate the result set or fetch them all and then get the number of rows.
 
@Jack without emulation. you know it bring another kind of pain
 
@Happyninja As I always say, IE was designed to hurt (developers).
 
Anonymous
@Jack it seems you are not the only one.
 

« first day (999 days earlier)      last day (3931 days later) »