« first day (2046 days earlier)      last day (2901 days later) » 

12:26 AM
@bwoebi Does the use statement add that much?
Especially on a never- to rarely-used code path.
 
@Trowski copies an array
(the statics hashatble)
but is it all exceptions? then prob. fine
 
Only should happen if a when callback throws, which should be never.
I felt it was more readable that way.
 
Wes
!!eval if(PHP_VERSION === '7.0.6') echo random_int(0, 1) ? "Go to bed" : "Have a coffee";
 
Wes
random_int is suspiciously always contrary to my will
 
Ekn
12:30 AM
!!eval if(PHP_VERSION === '7.0.6') echo random_int(0, 1) ? "Prepare some mate" : "Go to bed";
 
[ 7.0.6 ] Prepare some mate
 
Wes
you see...
 
Ekn
:) seems just in sync with mine
 
Wes
if i get to get to 5 am i can even go running... will be hard, as i'm already tired now (2:30am)
it rained for weeks, and even snowed once. in may, jesus christ. wtf is wrong with you, weather?
 
Ekn
12:37 AM
I'd just skip at 5am if I'm still awake and it's already 2.30 :p
It was already so cold this time last year here, I still get to go for a walk when sun is up around mid day nowadays. Still, I got to gather lots of wood today, prepared for the winter.
 
Wes
would love to live there. gather wood is something that almost doesn't exist in the western world :( how great would be to have a fireplace...
 
Ekn
well, people here still go buy leñas from supermarkets, but it just doesn't make sense when you have forests all around :p
 
Wes
i think we lost the pleasure of living that way because at first we thought stuff like radiators are way more practical than fireplaces, but hell reading a book while drinking some good whiskey in front a radiator is... sad. replace the radiator with a fireplace and everything changes
you know what i mean? :B
 
Ekn
agreed
I do :3
 
true
 
Wes
12:46 AM
i'm so envious
...here i come coffeemaker
 
12:58 AM
Do you have any opinion on github.com/async-interop/event-loop/pull/55 @Trowski ?
 
1:19 AM
difference between jsp and php?
 
Ekn
!!google what is the difference between jsp and php?
 
Search for "what is the difference between jsp and php?" (https://www.google.com/search?q=what+is+the+difference+between+jsp+and+php%3F&lr=lang_en)
• What is the difference between JSP and PHP? - jGu… - PHPis an open-source page scripting/templating system that is very similar to JSP and ASP. It defin… (http://www.jguru.com/faq/view.jsp?EID=10596)
• What's the difference between JSP and PHP? - Quor… - JSP was a means of providing a similar programming style to PHP and ASP. It is based on Java Servl… (https://www.quora.com/Whats-the-difference-between-JSP-and-PHP)
 
Adi
1:57 AM
what's up mates?
 
Wes
 
2:24 AM
o/
Moin
> With JSP, if the code inside a page gets too big, or if you want to use it elsewhere, you can cut it out, make it into a Java class, and invoke it from anywhere in your application (even not from a page). With PHP, you're stuck inside the HTML box.
meh
 
Wes
3:32 AM
lol, what an argument
other things in the checklist are even more funny
> JSP is much more powerful, since it has access to all the Java libraries. PHP only has access to PHP libraries
 
Ekn
lol
huh my google search resulted in two SO questions and the first link above, then quora etc
 
Goot morning
 
4:19 AM
'nin
 
Ekn
'n
 
4:32 AM
'
 
@Ekin puppy okay ?
 
Ekn
it is :) I found the mother 5 blocks away!
 
:o
abandoned also ?
 
Ekn
seems that night three of the newborns ran away
 
oh I c
so back with mother now ?
 
Ekn
4:38 AM
one died they said, another they found and the last one.. I found.
 
Ekn
yes cause at least for 35 days more they have to be together
 
wait, was it even big enough to run away ? do we believe that story ?
what if they ditched them, and you just caught them ?
 
Ekn
I don't really buy it so I'll go visit every day
 
yes, good
 
Ekn
4:39 AM
5 blocks... something that little
 
yeah, doesn't seem right to me
 
Ekn
yeah I'll see, I'm happy that I found the mother though
 
they said you can keep the puppy when he comes of age ?
 
Ekn
yes they did, so that's positive
 
maybe chuck them some money for food or something .... they maybe just couldn't afford the mothers appetite ...
which is a really sad thought ...
 
Ekn
4:42 AM
yes I already did that yesterday :) they really seem nice people so maybe it was a bit "unexpected" for them
but still I dunno why let that happen
 
maybe the mother took the pups away, but I can't see puppies that young running anywhere ...
the only reasons the mother would do that are danger or food
 
Ekn
right... the probabilities are higher for a human intervention
 
just keep going round and checking on them I guess ... they know someone is watching now, so can't really do anything ...
 
Ekn
yep that's the plan, I'll make sure they're okay
 
moin @Anmol
@Ekn looking forward to happier pictures :)
he looked so helpless the other day ...
 
4:48 AM
moin Joe :)
 
Ekn
o/
yeah will post when I get the chance :)
 
cool
 
5:01 AM
I'm so badly organized, I found out yesterday that my motorcycle hasn't been legal to use since 2nd march ... I've done maybe a thousand miles in that time ...
 
Ekn
ouch :|
 
also my car wasn't legal, technically, but I fixed that yesterday ... I'll probably get fined ... I'll take it, had I been stopped by police in the last couple of months on bike, they could have confiscated and destroyed it :o
we moved and I forgot to update all the addresses for vehicles, so the reminder letters that I needed to do stuff never came ... and I just happened to look yesterday at both of them ...
gotta take day off to take bike to garage and wait there while they make it legal ...
 
Ekn
good that you found out then.. I haven't seen police stopping bikes in any place I lived yet, a bit chance maybe
may I ask where do you live?
 
they don't really look at bikes ... most of their speed detection kit doesn't work reliably for them, because no anpr ...
Isle of Wight
but I've overtaken police cars on the motorway on mainland UK in the last couple of months hehe ...
 
Ekn
heh :) speaking of speed detection.. I'd like to specially thank to people who invented the anti-radar thingies :p
 
5:09 AM
(they sit on motorways at 10-15 mph under speed limit, so they can watch ...)
 
Ekn
yeah it must be a bit boring for them I imagine..
 
I've seen some gadgets for cars, and some paint for number plates ... they confiscate your vehicle if they catch you doing that kind of stuff here ...
 
Ekn
yeah I guess they do that everywhere
 
really ? it's a pretty recent that they started to do that here ...
maybe 5 years or so ... before you would just get fined and penalty points on license for everything ...
 
Ekn
oh really? I thought the gadgets were common
ah I see
 
5:13 AM
yeah I meant confiscating vehicles ...
in case not clear, confiscation is followed by destruction of vehicle, you don't get it back, and you don't get a choice ...
do they do that everywhere ?
 
Ekn
not sure if everywhere, but they confiscate the vehicles instead of just a fine in Argentina and Turkey, I remember someone telling me Germany as well but not sure.
I thought they do that in many other places too, because I thought the gadgets were common
heh I see nice beaches when I google search Isle of Wight
 
yeah :)
only ever 5 minutes from a beach on a 26 mile wide island ....
 
Ekn
how nice :)
 
few minutes walk ^
 
Ekn
looks like an amazing place
hope you enjoy your time there!
 
5:25 AM
the place looks like a painting, I'll never leave unless I'm leaving the UK altogether ...
 
Ekn
that just made me realize how I missed blue nice sea..
whoa that's a nice capture
 
hard to take a crap photo here :D
that's the pier from the other side in the first photo ...
 
Ekn
oh wow :)
 
the most beautiful place, even when it rains it's pretty ...
 
Ekn
Isle of Wight is noted.. the place is so beautiful indeed
 
5:29 AM
everyone should visit, I have many spare beds ...
 
Ekn
heh :)
 
wildlife is remarkable also, lots of migrating birds make stops on here ... one morning, I saw an actual crane sitting on the fence in my garden, I just watched until it flew away .... I don't remember much, but the visuals of that are burned into my memory ... it was amazing ...
 
Ekn
that kinda moments are so good... you actually remember the visual too later
I had that when I saw a bunch of hummingbirds with green bright back sides
I could say feeding a baby opossum was another one..
but an actual crane :p
 
awwww
 
Ekn
waking up to stuff like these fills one with determination, or at least you start your day good..
 
5:35 AM
it was actually kinda intimidating, I was only just outside my door and it was more than 20 meters away, but they are very large, when it opened it's wings to take off, it just didn't look real, and the noise it made getting into the air ...
amazing, I might never see another, there are very few breeding pairs here ... gutted I didn't get a picture, but I didn't dare to move once I saw it
 
Ekn
:)
well, you have seen and saved the moment in your memory
 
yeah I love the wildlife in the morning, I always watch a while ... there's a bunch of different species but I haven't learned what they all are yet ... and some of them you can't see, there's woodpeckers in my garden but I've never seen them ... they are extremely loud ...
 
Ekn
that makes it a kinda unique event as well
ha, ooh I think I never seen woodpeckers!
or maybe I didn't realize :p
 
you can hear them every morning and every night, and I've had the telescopic lens on the camera looking for them, but I can't spot them, I know they are in the trees in my garden ...
 
Ekn
hehe I'd like to see if you capture one day
 
5:42 AM
I'm determined to do that ...
 
Ekn
great :)
 
5:58 AM
When choosing a language "Use X because it's meant for that" is a valid argument, when *designing* a language, it is not. Please, stop. #php
 
morning
 
moin
 
Ekn
mornin
 
hey guys can you help me with my problem?
Error description: Field 'item_name' doesn't have a default value
 
6:15 AM
!!google Error description: Field 'item_name' doesn't have a default value
 
Search for "Error description: Field 'item_name' doesn't have a default value" (https://www.google.com/search?q=Error+description%3A+Field+%27item_name%27+doesn%27t+have+a+default+value&lr=lang_en)
• mysql error 1364 Field doesn't have a default val… - My table looks like create table try ( name varchar(8), CREATED_BY … set a default value for Create… (http://stackoverflow.com/questions/15438840/mysql-error-1364-field-doesnt-have-a-default-values)
• mysql - Field 'id' doesn't have a default value?… - The error I get is: Error Code: 1364. Field 'id' doesn't have a default value. CREATE TABL
 
user3119231
good morning.
 
morenin
 
o/
 
user3119231
weekend is over :(
 
user3119231
6:26 AM
welcome back at work sigh
 
Morning
 
if (isset($_POST['submit']))
{
$rec_qty=$_POST['rec_qty'];
$id=$_POST['item_id'];

for($i=0; $i < count($_POST['rec_qty']);$i++) {

$sql = mysqli_query($conn,"INSERT INTO itemlist (quantity) values('".$_POST['rec_qty'][$i]."') ") or die ("Error description: " . mysqli_error($conn));

$update = "$conn,UPDATE itemlist set quantity='$quantity' where item_id='$id'";

if($sql){

header("Location: received_item.php?attempt=success")
Error description: Field 'item_name' doesn't have a default value
 
...
a) The error is obvious.
b) Set item id as `1'; DROP TABLE itemlist; --`
This genuinely makes my head hurt. You're doing an INSERT rather than an update for one. The update is just a string.
 
sir kindly elaborate im just new to php...and I cant understand it very well
 
user3119231
start with something easier
 
6:39 AM
@MACKIEMACKO I don't have the time to try to fix all of this. Read about MySQL and PDO.
@MACKIEMACKO Read about MySQL injection, and until you understand it, don't use MySQL.
 
okay thanks
 
user3119231
@MACKIEMACKO lets pretend I let the client let $_POST["rec_qty"] be: "0); DROP itemlist"
 
@JoeWatkins wow
for some reason I always thought the Isle of Wight was just some rock in the sea with nothing to offer except for bad weather. TIL. TY!
 
welcome :)
there is a lot of bad weather, but even that is awesome, either your view is not obscured by land (weather over open water is beautiful, if you can see it), or because of the landscape, there are pockets of weather that you can look down on from some view points ... a really quite remarkable place ...
there's a village on one side of the island with it's own micro climate, when the summer really gets going, air temp can be +5 degrees there, wind is totally blocked, people have palm trees growing in their gardens there ... still in the uk ...
 
7:04 AM
The isle of wight is beautiful, my old boss lived there and we'd go to his place for summer parties at work.
Doesn't take long to get there from Waterloo :)
The benefit of living in a small country, I guess.
I assume you work remote, @JoeWatkins?
 
Adi
7:20 AM
hello guys, can someone help me in my problem in php?
 
@Adi Maybe :P
 
posted on May 23, 2016

New Cyanide and Happiness Comic

 
Adi
@MattPrelude how can i show you my codes?
 
@Adi gist or pastebin
 
@Adi Narrow down the code to the part that causes the problem, that should be short enough to paste here.
 
7:22 AM
moin
 
Adi
okay here is my problem. im trying to get the id of a particular data. after i get that, i have a submit button to process it and it will change it's status. but when i click it, i get an Undefined id

$query = "SELECT * FROM `crew_info` WHERE `id` = '".$_GET['id']."'";
$query_run = mysqli_query($conn,$query);

if(isset($_POST['submit'])) {

$query_update = "UPDATE `crew_info` SET `crew_status` = 'NEW' WHERE `id` = '".$_GET['id']."'";
if ($query_update_run = mysqli_query($conn,$query_update)) {
i get the error in the line with $query and $query_update
 
var_dump($_GET, $_POST);
 
Please don't pass $_GET variables straight into queries...
 
Adi
that $_GET is from another PHP page
what is the proper way to do it?
store it in variable?
 
@Adi Use bound parameters
 
7:26 AM
@Adi No it's not. It's always this page's $_GET
@Adi Read on Prepared Statements
 
If I submit a GET of 1; DROP TABLE crew_info; --
You're having a bad day.
 
Adi
yeah maybe
 
or
1' or 1 = 1; --
That gets me every record in the table
 
Adi
so i will remove my $_GET in my query?
 
Read about prepared statements
 
7:27 AM
I showed my brother once how SQL Injection works by hacking into the super badly written example app his highschool teacher gave the entire class
 
Adi
okay thank you
 
Totally blew his mind
 
It was funny
He hacked her live in class when he demonstrated his ability to log in
 
Adi
7:36 AM
how can i use prepared statement in UPDATE query @MattPrelude
 
$stmt = mysqli_prepare($conn, "UPDATE `users` SET `email` = ? WHERE `id` = ?;
mysqli_stmt_bind_param($stmt, 'si', $email, $id);
?
Or (better) use the OO way
 
anyways I got 34K in slither today
 
$stmt = $mysqli->prepare('UPDATE `users` SET `email` = ? WHERE `id` = ?');
$stmt->bind_param('si', $email, $id);
 
Adi
which one is better?
sorry im new in php
 
Object oriented is imo better
Some people may disagree
 
Adi
7:40 AM
still exploring the world of it
 
whichever you prefer
 
OO FTW
 
Both are better than not using bound parameters
 
if your code is mostly oo code, then use the oo api. if your code is mostly procedural, use the procedural api
 
Adi
i will try to practice if first
for now i will use this


$stmt = $mysqli->prepare('UPDATE `users` SET `email` = ? WHERE `id` = ?');
$stmt->bind_param('si', $email, $id);
is that okay?
 
Anonymous
7:42 AM
Mornin
 
@Jimbo congratz, but "speaking"? You meant regurgitating…
 
15 hours ago, by DaveRandom
He's going for the world record speakers-dinners-per-talk ratio
 
@Adi Yes, remember to read the documentation.
 
Adi
thanks for your help @MattPrelude
 
@Adi if this is your first venture into prepared statements, I highly recommend you start with PDO, it's a lot easier to use
!!docs pdo
 
7:47 AM
[ PDO ] Represents a connection between PHP and a database server.
 
user3119231
PHP Data Objects
 
Adi
@DaveRandom im currently using mysqli . im having some problem with my query haha
 
user3119231
I'm always using pdo.
 
@Adi If you've already written enough of your application that you can't change it, fine. But since you're presumably going to need to go through your application and turn everything into a prepared statement, it's worth swapping it out for PDO as well because it's just so much more user friendly.
 
Adi
@dave
@DaveRandom thank you for the advice. i will try it
 
7:50 AM
o/
 
Adi
@DaveRandom thank you
 
np :-)
 
8:15 AM
... ... ... how do you get the exit code from callback of register_shutdown_function($callback) ?
 
!!lxr register_shutdown_function
 
[ /ext/standard/basic_functions.c#5026 ] PHP_FUNCTION(register_shutdown_function)
 
hi all
 
@SergeyTelshevsky CLI SAPI I presume?
 
!!wotd
 
8:22 AM
jimjams: extreme nervousness; jitters.
 
I'm not aware of a way to do it but I'm looking in case there's something I don't know about
 
Adi
@DaveRandom can i send you questions in your email?
 
Uh... no? That's what this chat and the main site are for, I have a job and can't always respond, this community has a much higher availability than I do
Also I rarely read emails as it is
 
@FlorianMargaine a relict
 
Adi
8:26 AM
because im still having trouble with my codes haha
sorry
 
I'd like to have gone to PHP Bulgaria. Well Bulgaria alone looks fun.
 
@DaveRandom sure
 
Adi
can someone help me here?

$get = isset($_GET['id']) ? $_GET['id'] : "";
$query = "SELECT * FROM `crew_info` WHERE `id` = '$get'";
$query_run = mysqli_query($conn,$query);

if(isset($_POST['submit'])) {

$query_update = "UPDATE `crew_info` SET `crew_status` = 'NEW' WHERE `id` = '$get'";
if ($query_update_run = mysqli_query($conn,$query_update)) {

echo 'Crew Accepted';
}

}
when i click the submit button the query is not executing but there is no syntax error
 
unformatted code is unformatted
 
@Adi Where are the bound parameters?
 
8:31 AM
smells like a f-ing global $CLI_EXIT_CODE
 
@SergeyTelshevsky well, if you're in your callback, you haven't exited yet...
!!lxr exit
 
@FlorianMargaine Nothing went wrong but I couldn't find a suitable definition. Ping DaveRandom if you think I should have done.
 
@DaveRandom ^
 
Yeh I've not even tried to make that work, that would definitely need to be special cased (true of all lang constructs)
 
Adi
im confused using bound parameters @MattPrelude. i dont know how to convert my codes to iy
 
8:35 AM
@Adi Read the documentation, what you are doing is dangerous and it would be irresponsible to help make this production ready in its current state.
 
morning chaps!
 
@FlorianMargaine yeah, but that should be triggered from outside and the argument (exit code) passed to the callback
 
@SergeyTelshevsky I'm going to go with "you can't". It's in EG(exit_status) for all practical purposes, but I can't see any way that it gets exposed to userland. I'd recommend 3v4l.org/bkDTW if possible in a sane way?
 
$query = 'SELECT * FROM `crew_info` WHERE `id` = ?';
$stmt = mysqli_prepare($conn, $query);
mysqli_stmt_bind_param($stmt, 's', $_GET['id']);
@Adi Thats all you have to do, it's no more difficult than what you do now
I'm assuming your ID is a string because you have put quotes around it.
 
Adi
im trying to understand the documentation @MattPrelude
@MattPrelude i get an error in my mysqli_fetch_assoc($stmt);
 
8:44 AM
@Adi What's the error?
 
Adi
mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, object given in ...
error in query
 
!!plugin list
 
Currently registered plugins:
[X] Canonicals - Posts links to canonical resources on various subjects
[X] ChuckSkeet - Posts a random Chuck Norris/Jon Skeet joke on request
[ ] CodeFormat - Asks users to format their code when unformatted multi-line code blocks are posted
[X] PHPDocs - Searches the PHP manual and displays links with a summary of the result
[X] 3v4l - Executes code snippets on 3v4l.org and displays the output
[X] Google - Retrieves and displays search results from Google
[X] HTTPRequester - Sends HTTP requests and displays the headers of the response
 
@Adi mysqli_stmt_execute($stmt);
 
!!plugin enable codeformat
 
8:45 AM
Plugin 'codeformat' is now enabled in this room
 
@Adi Please read through the examples in the documentation.
if(1) {
test_jeeves();
echo 'Jeeves, why not complaining?'
}
 
3 lines minimum, ignores edits
 
if(1) {
test_jeeves();
echo 'Jeeves, why not complaining?' ;
}
 
@DaveRandom I went with a bit easier approach, I have a class Shutdown extends Exception which sets the global constant in it's __construct and that's being checked in the callback..
 
@MattPrelude rules are kind of sucky improvements welcome
 
8:47 AM
@DaveRandom If it does php -l that'll be why it failed
if(1) {
test_jeeves();
echo 'Jeeves, why not complaining?' ;
}
Hm
nvm
 
Actually looking at it, it may have been broken by some changes that were made yesterday to improve general handling of multiline messages
 
something like this: pastebin.com/ZHPkt5NJ
 
and the error handler checks via if(defined('CLI_EXIT_CODE')) {...}
 
Adi
@MattPrelude no error but i get unlimited loop of an empty table
 
8:49 AM
that's pretty strange that this is not built-in functionality..
 
@SergeyTelshevsky The problem with that is that it's catchable, and then it would fatal if you did it again
 
yeah, I had to catch this exception in the top-most scope and do an exit()..
 
@SergeyTelshevsky ...and it's now impossible to add it without either an extra API or a BC break
 
G'morning
 
@SergeyTelshevsky If you are going to have some mechanism that is not exit()/die(), I'd rather go with the static class approach... or even trigger_error() with some kind of custom error handler would actually be more robust than that, because with the exception approach some bit of code somewhere might unintentionally handle the exception and it wouldn't actually hit your top-level code
I suppose could add set_exit_code()/get_exit_code() core functions but I'm not sure that makes sense
Really it should just be passed as first arg to the shutdown function, that register_shutdown_function($callback, ...$args) signature doesn't make much sense in the days of closures and lexical scope
But impossible to fix without BC break :-(
@MattPrelude I'm not a fan of trying to lint the code, because a lot of the people who dump code also have syntax errors
 
8:59 AM
@DaveRandom I'm not either, I was just wondering if that was it.
 

« first day (2046 days earlier)      last day (2901 days later) »