« first day (1902 days earlier)      last day (3268 days later) » 
00:00 - 16:0016:00 - 00:00

00:00
which is why adding HTTP/2 server support won't really help much with the testing.
You're probably best off with a subset of an existing HTTP/2 server in PHP (Hint: Aerys :-P)
 
3 hours later…
03:29
Hi
Happy new year in advance to all the genuis programmers of stackoverflow
 
1 hour later…
04:45
hey people who's online?
04:57
an awful lot of lurkers.
05:25
hi , all
do we have any alternative apart from cookies , sessions in php
i523.photobucket.com/albums/…
can u take a look how can i process a query in adding a data to motherboard table with connecting it to the two tables who doesnt have any data in it also
05:57
moin
morning php lovers and creator's
06:14
hi do any one know the alternatives of cookies apart from sesstion
?
06:40
hi
@AnmolRaghuvanshiVersion1.0 good evening
07:05
Good morning
mornfh
You don't have a pair of hand warmers I can borrow?
Whats wrong about this code?
$collections = [];

if ($result = mysqli_query($connection, $sql)) {
  while($row = mysqli_fetch_array($result)){
	  $collections = $row;
  }
  echo json_encode(array('test'=>$collections[0]));
}
07:20
You forgot about [] while assigning $row to $collection
Oh I see!
so $collection becomes a $row for each iteration i suppose
@KrystianKrasowski weird, im getting back an object and not a string as id expect
Can you show sql?
sure
$sql = "SELECT test FROM sandbox";
07:25
ok I see
You need to change fetch mode if u want to retrive single column value in each $row
I suppose it would be some kind of FETCH_COLUMN in mysqli style
so instead of array
fetch_row
hehe thanks for pointing that out. Im very thankful
07:27
no problem :)
@KrystianKrasowski is mt_rand better than rand?
well, I have no idea :)
I know w3schools sucks but check this out w3schools.com/php/func_math_mt_rand.asp
The mt_rand() function generates a random integer using the Mersenne Twister algorithm. This function produces a better random value, and is 4 times faster than rand().
It might be actually true
07:53
it is true if you read the official PHP docs and not crappy W3Schools. secure.php.net/manual/en/function.mt-rand.php
always use the official docs
please =o)
08:13
hai guys, php codeigniter, if we pass a value from view using ajax will it print in controller using print_r, by fetching as an array.
yeah it will print
what problem are you facing?
its not printing can i post my code here
function myFunction()
{

$("#val_check").click(function()
{
var menu_id = $(this).val();
alert(menu_id);
$.ajax(
{
method: "POST",
url: "<?php echo base_url();?>index.php?admin/ajax_check",
// path to the controller
datatype : "json",
cache: "false",
data: {"id": menu_id},
success: function(data)
{
console.log("Data sent to server");
confirm("helo");
window.location.reload();
}
});
});
}
function ajax_check()
{
$email = array();
$email['data']=$this->input->post('id');
print_r($email);
echo "<script>alert('Done');</script>";
// $this->crud_model->update_data($email);

}
Actually my ajax success function works but in controller nothing happening
08:37
@Crysis so the controller is not firing? If so, are you sure the route is not set as GET?
09:04
If a variable shows string(0) "" on var_dump(); should a if(empty($string)){ ...something.... } not catch it?
yes, it should.
morning DaveRandom
MGE
MGE
09:30
Hello, how can I get min timestamp and max timestamp records in the same sql query?
Got a question. How come I only get the first 3 in the array while the others are now shown?
$sql = "SELECT test FROM sandbox";

$collections = [];

if ($result = mysqli_query($connection, $sql)) {
  while($row = mysqli_fetch_row($result)){
	  $collections[] = $row;
  }
  echo json_encode(array('test'=>$collections[rand(0, count($collections)-1)]));
}
collections has 4 elements in it, yet only a few are shown, the rest is blank
MGE
MGE
I cant do this
SELECT Sum(MAX(checktime) - MIN(checktime)) FROM codes WHERE checktime!= '' AND status=2
@Asperger The code seems to specifically show one random row from the results, doesn't seem to fit your description of a problem?
@MGE What are you expecting that to do? Don't you just want SELECT MAX(checktime) AS maxtime, MIN(checktime) AS mintime FROM codes WHERE checktime!= '' AND status=2
Also you should make checktime a TIMESTAMP NULL DEFAULT NULL column, the checktime!= '' for a timestamp is horrible
@crypticツ iam sorry i dont know much about what u asking about route, u mean routes.php?
meurning!
09:45
o/ @Naruto <3
@Epodax creepy?
Not much :D
MGE
MGE
@DaveRandom and checktime!= NULL right?
finally: SELECT MAX(checktime) - MIN(checktime) AS differencetime FROM codes WHERE..
In that particular case, you wouldn't need the predicate at all because NULL values are ignored in min/max operations, as with many aggregates
@Feeds The coding love The coding violence
10:27
@Ocramius stop doing bullshit and do some work instead :D
//ignore. Congrats. man, you're awesome
10:59
@PeeHaa Hope you won't put things on fire like you did the day before christmas ;)
 
1 hour later…
12:28
Morning roomies o/
@Naruto I know myself too good to tell you either way
12:46
Thought for the day: if you have a poo today it will be the last one you have this year, so make sure you enjoy it.
Sharing some of your wisdom 'eh DaveRandom?
What would you do without me?
I don't know Dave, my life certainly would be a lot more dull and gray without your tips of wisdom to give life a broader perspective.
hi can someone advise me how i can access a nested item in json please {"item":[{"error":"true","success":"false","resultcode":"404","key":null}]} , i am trying with this $result = $json['item'][0]['success'];
3 messages moved to bin
12:54
We will not star your messages unless you say something worth starring. kthxbai
8
@n4zg do a var_dump of $json to inspect your variable
I think we only had a single hatwhorelike that this hat year. Either I have been drinking too much or people just got sane this year
@n4zg Did you pass true to the second arg of json_decode()?
yes
@PeeHaa I suspect the former for 2 reasons: 1) you are you 2) people are people
12:56
:-)
Hrm, I think I've found a bug on SO chat regarding view profiles from here..
They all suck? That's not a bug
var dump string(75) "{"item":[{"error":"true","success":"false","resultcode":"404","key":null}]}"
@n4zg Then that should work, as @Clayton said please pastebin a var_dump() of you $json var
It's even worse on main :P
12:56
Also be careful with that data, it has stringly-typed bools in it
eeeeeeew
Where did you get that filth from?
@n4zg That's a string, you haven't json_decode()ed it...
Anyone else getting "page not found" when trying to view Clayton's profile via the (User profile on SO) ?
@n4zg json_decode($json, true); ... then you can access the nested value.
@Epodax wtf
12:58
@Epodax yeah
@Epodax yea
@Clayton you don't exist, apparently
!!magic
I found him on SO
and apparently the ID part of the url is wrong
@DaveRandom how so?
12:59
Probably a merge gone wild?
@MarkBaker good, thanks :-)
Dunno, just found it odd. Oh well
i have done the following $json = json_decode($arr,true);
It's like girls gone wild, but fewer bikinis and more @Ocramius
I would hit that
13:01
you know it baby
@Ghedipunk thanks, I used of MarkBaker's solution
@Clayton Just your profile link is not working, you user ID seems to be foobar, it's SO's fault rather than yours though I think
Is there a finders fee for finding bugs?
whoa so weird... view it here: stackoverflow.com/users/747678/clayton
@Epodax ninja badge I think. But AFAIK that's just for security bugs?
13:03
Awh.
@Epodax Yeh, you get a pat on the back and a dirty look from balpha
I'll take whatever I can get :P
Maybe that's why I can't change my winter hats! bugs everywhere!
Humm.. Do I need to post it on meta or can I swat someone here?
Ugh, damn you people, I blame you for me not getting any work done today.
13:06
posted on December 31, 2015 by nlecointre

/* by iradorn */

That's my story and I'm sticking to it.
thanks that is working now :-)
@Epodax I can post it
Meh, all ready writing it on the meta, but if you'd rather do it yourself then do poke me so we avoid duplicating each other.
Hi guys, pretty basic question but I don't get how shall I use it. Im looking to put to upper-case a string in Laravel so i found upper() but I don't get how to use it.
Let say I have this {{$d->nb_days}}
How can I Upper this ?
I tried upper($d->nb_days)
But it did not work..
13:13
@Epodax if you already have it then go for it. You can mention that I recently merged my account with an old one too. I've experienced a couple strange issues since doing the merge.
@Baldráni It's a function. It returns a value. It doesn't modify the existing value. So you have to reassign it $d->nb_days = upper($d->nb_days)
Well, might be better if you do the posting if you want to mention multiple issues, not really my ball game for those :P
@Sherif Hum.. :( Isn't there a way of dong it like {{$var|upper}}
@Baldráni I have no idea what the blade syntax is for that. Sorry, I just use PHP <?=upper($var)?>
I don't bother learning a new syntax just to be able to do same exact things I can already do in PHP :)
I'm their documentation might tell you though.
13:17
@Sherif Could make sense, it just in template I don't like to had php :)
Any way ty
@Baldráni That's Smarty syntax. That's different from vanilla PHP code
It's also the same syntax for about 43 billion other PHP templating engines
I'm pretty sure Laravel uses Blade by default.
Maybe. I've only dealt with Smarty
I can never understand why people bother learning a new syntax just to do what PHP already lets you do...
"1st world problems"
100% added cost. 0% added value.
WIN!
I love the typo in the title of this Q stackoverflow.com/questions/34546951/…
13:19
> advance scrip
?
> getting fetal error
2
Oh, apparently there is more than one typo there.
@Machavity lol
I totally glossed over the fetal error.
Too many fetal errors can result in excessive crying, sleepless nights, and a life time of expenses.
@Epodax another user with the same issue, chat.meta.stackexchange.com/users/259867/normal-human click on his profile link to the right of 'parent profile' .. yay bugs.
13:22
I have discovered a bug in the Internet.
It's called ACK
Apparently if you just drop all TCP/IP packets from the Internet you don't get this bug.
ayep
You've got a real NACK for spotting these things
good night everybody!
innorite! :D
I really really really think we should try and persuade the IETF to change the flags names:
SYN -> OHAI
PSH -> GUESSWHAT
ACK -> INORITE
FIN -> KTHXBYE
RST -> YUNOMAEKSENSE
13:32
@DaveRandom I'm all for it. Except now you may have to rewrite about a billion lines of code :/
@Sherif rewrite? why? It'd just be the official names… code will still be working because binary protocol
@bwoebi Well, you may have to rewrite some constants then :p
I'm pretty sure somebody defines those constants somewhere in their code.
Or maybe just some comments? github.com/pkelsey/libuinet/blob/…
initial grep says we may actually be alright
At the very least a ton of documentation.
13:56
Was playing with PHP7...
Gets me...
Notice: Use of undefined constant “LOL” - assumed '“LOL”' in /Applications/MAMP/htdocs/index.php on line 14
How can I get rid of this ugly error?
$test->tests(“Lol, haha!”);
Doing this gets me:
@HassanAlthaf Stop writing code in Word.
Parse error: syntax error, unexpected '!', expecting ',' or ')' in /Applications/MAMP/htdocs/index.php on line 15
@NikiC I am doing it on TextEdit for fun
Is it because of that?
@HassanAlthaf Yes
If you write code, use a proper editor
Your editor is using "smart" quotes
@HassanAlthaf go to settings of textedit, there you can disable these "smart" replacements
You were right
Thank you guys, I just switched to brackets.
14:10
Ah none the less, Happy new years fokes, I'm going home
@NikiC I feel like I should throw a custom exception for collision exceptions so that one can choose to explicitly not log them…?
(By other means than comparing the message directly)
Room11 o/
user924016
o\
14:25
Does anyone have experience with vfsStream?
user924016
I used it before
user924016
worked great for mocking file stuff
yeah, was just wondering how to insert a file in specific node/dir
the solution should be simple enough
@RonniSkansing any ideas?
user924016
nope, should be fairly simple...
@RonniSkansing yeah, said that first :D
user924016
but doesnt the first example use a directory?
@RonniSkansing nothing there
pardon?
user924016
$file = vfsStream::newFile('someFile');
$root->addChild($file);
user924016
did you try the addChild ?
how to point to dir deeper in the structure?
smth like
$thisIsDirSomwhereDeeper->addChild
smth like node locator
user924016
14:33
I think you create the directory, set itas root and add child
user924016
@sitilge ala
user924016
vfsStream::setup('home');
$file = vfsStream::url('home/test.xt');
file_put_contents($file, "The new contents of the file");
@RonniSkansing the vfs has already been created with a given structure
@RonniSkansing that is not what I am looking for (since you are telling nothing new - it creates a new vfs)
user924016
14:39
@sitilge have you tried getChild(...) on the root ?
user924016
the directory object has a couple of methods I think you can deliver to ->at( here )
@RonniSkansing if you getChild on the root then it should return only the root's children.
And it does. The dir I am looking is DEEPER in structure. How to point to this dir, that is the question?
user924016
@sitilge what is the name of the dir inside the $root ? what does var_dump($root->getChild('ChildFolderName')) give you?
NULL
The structure is given here stackoverflow.com/questions/34545159/…
user924016
14:46
so $root->getChild('dir') is null?
> We are using Salt encryption on our website, passwords are not stored in plain text. Please let us know if you have any concerns regarding the security of your data.
user924016
@PeeHaa o/
Yo ronni
user924016
Hope you have a great new years
@RonniSkansing yap, since it has only one child 'path'
14:48
I wish you the same
user924016
thx
15:06
posted on December 31, 2015 by nlecointre

/* by Superpicsou */

$sql = "INSERT INTO table (col1) VALUES ('$array['property']');
How do I escape the single quotes in my array property? I'm not doing something right.
Don't
Use prepared statements
2789
Q: How can I prevent SQL-injection in PHP?

Andrew G. JohnsonIf user input is inserted without modification into an SQL query, then the application becomes vulnerable to SQL injection, like in the following example: $unsafe_variable = $_POST['user_input']; mysql_query("INSERT INTO `table` (`column`) VALUES ('$unsafe_variable')"); That's because the us...

@Waxi Check out PDO.
What if SQL injection is not an issue?
It is
1 min ago, by Waxi
How do I escape the single quotes in my array property? I'm not doing something right.
15:09
If you're using, mysql_*, it is removed anyway from PHP7.
So make the change.
Now or never.
Shit ok...time to teach myself this PDO stuff then.
or use mysqli. PDO sometimes only emulates preapred statements
user924016
You can turn emulation off. @Machavity
PDO gives you multiple other drivers, which are not MySQL.
MySQLi is only for MySQL.
user924016
you prepared statements, but also check the link which gives you the right syntax if some day you actually want to interpolate
15:17
Yeah I was looking for something quick and dirty like this curly braces thing, since I was being lazy, but couldn't get it to work, so I'll look into prepared statements and PDO usage...thanks guys.
@PeeHaa's into that sort of thing
Totes
I have a really shitty problem ....
2
Q: How to pass parameters to a dynamic query?

stackI have a query which is not constant all the time ..., In fact it will be generate according to some factor. And it is sometimes like this: select * from table1 where id = :id And sometimes else it could be like this: select * from table1 where id = :id union all select * from table2 wher...

This is invalid, right? SELECT * FROM table1 WHERE id=:id UNION ALL SELECT * FROM table2 where id = :id
user924016
try it
15:31
I did
it has error
It can be done, but don't.
If it's all going to refer to the same value you can just do table2.id = table1.id
@DaveRandom it couldn't, It says you cannot to use :id twice
user924016
You question on site seems to be answered? @stack
no ^
15:32
You should use WHERE id IN (<list of IDs>) rather than UNION btw
But sometimes tells me that database is an utter mess and you are trying to remove the stink by working around it instead of fixing the situation
@PeeHaa that was a example. in reality I cannot do that
user924016
@stack but you got a answer what is wrong with the answer?
@stack It can be changing one of the PDO connection attributes actually, but I'm not going to tell you which one because (as I mentioned) you shouldn't
moment
emulation is still enabled by default on rottensql connections right? @DaveRandom
15:33
@RonniSkansing that answer just created a solution for binding, not a good idea for query. because in the query there is identical parameters
lol 3 edits :P
@DaveRandom Why I shouldn't ?
3v4l.org/tbnLX click link after 12 Happy new years PHPians
user924016
@stack ? the answer tell you the full story, do a foreach over your params/values, which part is that is not good enough?
Ashamed to say this, but I'm not going the prepared/PDO route. It's beyond my understanding and I'm not ready to teach myself all this new shit. I'm assigning my array properties to variables and inserting those. Go ahead, shame me.
15:34
@PeeHaa orly? Did they change the replacement engine so that param reuse doesn't work any more?
See "Using an array to construct a value list for an IN (<value list>) clause"
@RonniSkansing wait ...
Dunno, but I think mysql is still emulating it by default
Regardless of whether you use IN, it's the same principle
user924016
@Waxi what are you coding on?
@DaveRandom OH OH ...! You have faced with that already ...
15:36
It's a wiki question because it gets asked a lot
@PeeHaa must have been a rough night again then? :P
IIRC @ScottArciszewski was the last person trying it, but people lester didn't like it
@RonniSkansing What you mean, what I'm working on?
@Naruto tcertainly was
user924016
like, is it hobby, school, work ?
15:37
@DaveRandom ah, if I read the answer I will get a solution ? (because it is too long and I don't know English as well)
@PeeHaa how's the project going?
It's for work, I'm making a timeclock for the company.
Which one? :P
@Waxi If you are not going to do it the right way don't expect us to help you with the crappy way
the one I jsut randomnly find bugs on ^^
Understandable, but if I'm going to fix one query, I need to fix them all, so I'm gonna write them all out like I have been, then I'll have to come back and fix them all. I have a file with a switch that is handing all the ajax calls and running queries depending on the call. It's really lousy, but it works.
15:39
Ah. I've been working on it for while now, but I cannot keep working on the same project for so long.
when I get back at work on monday I'll check it :) (read: destroy it)
I am now looking at a wordpress installation to find out how much I can delete while it keeps working
@stack yes, it covers what you need
user924016
@PeeHaa all of it!
@Naruto \o/
15:40
anyway, just came here before I go out, I hope everynoe as a good night!!! try to keep it down @PeeHaa ^^
later!!
user924016
laters
@RonniSkansing It's really really hard to find out what can safely be removed. Such a mess. I think I will start at least with that multisite stuff because most people don't use it (I think)
later @Naruto
user924016
@PeeHaa yea, dead code is a real hustle
I am currently at the first line of the index file
define('WP_USE_THEMES', true);
@Waxi You could start by using PDO to execute your queries, that will make it less painful when you come to convert them to prepared statements because you won't need to worry about changing the way the connection is passed around
user924016
15:41
but are we talking a production site which is bloated out or are you trimming down wp?
No fucking clue why that constant is needed
@RonniSkansing trimming down wp for shits and giggles
user924016
fun
@RonniSkansing "trimming down wp" with an axe, presumably
user924016
But maybe it would be easiest to regress from features
Sadomasochism, a subset of BDSM, is the giving or receiving of pleasure from acts involving the receipt or infliction of pain or humiliation. Practitioners of sadomasochism may seek sexual gratification from their acts. While the terms sadist and masochist refer respectively to one who enjoys giving or receiving pain, practitioners of sadomasochism may switch between activity and passivity. The abbreviation S&M is often used for sadomasochism, although practitioners themselves normally remove the ampersand and use the acronym SM or S/M. Sadomasochism is not considered a clinical paraphilia unless...
user924016
15:42
pick a feature unneeded
user924016
remove it
Yeah I think that makes sense
Just so hard to see what uses what in there
user924016
I think wp has some functional or e2e tests
I suggest the first feature you look at removing from WP is WP
4
@PeeHaa they probably should have renamed that article into "PHP"
15:43
@RonniSkansing Linky?
@Ocramius heheh
@DaveRandom embrace extend extinguish
if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) :
	$template = false;
	if     ( is_404()            && $template = get_404_template()            ) :
	elseif ( is_search()         && $template = get_search_template()         ) :
	elseif ( is_front_page()     && $template = get_front_page_template()     ) :
	elseif ( is_home()           && $template = get_home_template()           ) :
	elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) :
	elseif ( is_tax()            && $template = get_taxonomy_template()       ) :
WTF have I gotten myself into this time...
@PeeHaa I threw up a bit in my mouth
Thanks @RonniSkansing @Ocramius
user924016
15:46
any time
user924016
you could get started by trying to remove the awful xmlrpc
Yeah I was just opening that
user924016
Are you commiting later to a fork on github?
user924016
I wanna see how this turns out
@DaveRandom Do you know when you select (mark) community wiki checkbox, then you won't earn reputation when your answers get upvote? If yes, why? are you insane??
15:48
@RonniSkansing Probably this one github.com/7press/7press
user924016
ah cool
> * @internal This file must be parsable by PHP4.
idonteven
421
A: What are "Community Wiki" posts?

Justin StandardWhy have Community Wiki posts? One of the goals of the website is to be a continually evolving source of good information. Community wiki posts help enhance the wiki aspect of the site. For more information about the proper use of community wiki, see The Future of Community Wiki. How do Com...

> Community wiki posts work by partly transferring ownership of the post from the original author to the community. They make the post easier to edit and maintain by a wider group of users, but they do not contribute to any user's reputation.
I have >20K rep, I don't need any more because I can do everything on the site.
:-)
ok
@DaveRandom However I think the number or rep isn't just for doing everything on the site, It also shows your grandeur (specially against the female users)
Let's make this a real challenge!
<?php declare(strict_types=1);
I'll show you guys my entire PHP script so you can laugh and see why people like me give PHP a bad name, and no, I'm not proud of it...actually embarassed.
00:00 - 16:0016:00 - 00:00

« first day (1902 days earlier)      last day (3268 days later) »