logs archiveIRC Archive / Freenode / #php / 2015 / July / 23 / 1
runinsquares
so IN i'm allowed to do it?
JZA
__adrian: well here is on, and the error logs are at /var/log/apache2/error_log
is not specified thought but they are working
runinsquares
Alphos, i have to say it's mildly confusing :@
JZA
just dont present any errors
Alphos
runinsquares !+prepared statement with in
php-bot
runinsquares, $pdo->prepare( 'SELECT * FROM mytable WHERE myfield IN ( ' . rtrim( str_repeat( '?, ', count( $values ) ), ', ' ) . ')' )->execute( $values ); /* or */ $pdo->prepare( 'SELECT * FROM mytable WHERE myfield IN ( ' . implode( ', ', array_fill( '?', count( $values ) ) ) . ' )' )->execute( $values );
__adrian
JZA, http://php.net/manual/en/errorfunc.configuration.php#ini.error-log
Alphos
runinsquares but if you have to perform multiple inserts, just execute your statement multiple times
__adrian
if it's screwy, then error message are probably being sent to apache
         

Alphos
in the case of IN, there is no workaround. in the case of INSERT, there is one : just run ::execute() several times
MikeJackson
__adrian: Example of the data (output, formated) http://imgur.com/D7pz78D
Alphos
[22:14:37] <Alphos> runinsquares $s1 = $pdo->prepare( 'INSERT INTO mytable VALUES (?,?,?,?)' ); $s1->execute([1,2,3,4]); $s1->execute([5,6,7,8]); $s1->execute([9,10,11,12]); $s1->execute([13,14,15,16]); /// you don't have to redefine the statement, one time does the trick. you just execute it several times, for instance in a loop
__adrian
MikeJackson ok. are you having problems figuring HOW you're going to do this (the cocept), or with actually DOING it (execution)?
likecolacola
Hey, i am C junior developer and want a crash PHP course to start playing with wordpress, any idea on where to start?
__adrian
*concept
Alphos
likecolacola !+php 101
php-bot
likecolacola, For an introductory tutorial, for beginners, to get you started with PHP, you may want to checkout http://php.net/tut or http://ss23.github.com/php-tutorial/ or http://sheriframadan.com/php-101
__adrian
"crash" and "wordpress" actually go together very well. i wouldn't even bother with a tutorial.
likecolacola, is your goal to learn PHP? or just to mess around with WP?
runinsquares
Alphos, yeah i did something like rtrim already, was quite useful
__adrian
also, http://phptherightway.com/#the_basics
MikeJackson
__adrian: bit of both. I have total ot calcualted down at the bottom from each row. What I'm trying to work out is how to get a daily total of hours, if day is over 8 hours then split the time to overtime and regular time.
Alphos
MikeJackson !+sqlfiddle
php-bot
MikeJackson, Please don't provide your data as an image. Just like there are pastebins ( /msg php-bot pastebin ), there are tools like SQLfiddle that will provide a way for us to query the data as if it were in a database, without the hassle to copying it. http://sqlfiddle.com/
__adrian
sum the days' totals first, split into T + OT.
Alphos
__adrian sorry to jump in, but do you have any idea how much what you're talking about sounds like WITH ROLLUP ? :p
__adrian
hmm.... :)
likecolacola
__adrian, i want to learn PHP but we could say that i have a death line on productively messing around with WP
__adrian
AliG1000
Just as a double-check that regex is NOT the right tool to use. My starting text is this '413083, 413130, 413101' and my grep is this: http://picpaste.com/grep_trip_patterns-p7utcLkZ.png I guess I don't understand why regex cannot be used in this case.
         

Alphos
AliG1000 !+str_getcsv
php-bot
AliG1000, array str_getcsv(string input[, string delimiter[, string enclosure[, string escape]]]) - Parse a CSV string into an array - http://php.net/str_getcsv
__adrian
likecolacola: that's ...unfortunate. YES, you need to know the basics of php to work effectively with wordpress; but wp is certainly NOT a good example of how to use php.
runinsquares
AliG1000, because there are better alternatives
Alphos
AliG1000 i'll keep passing you that until you stop using regular expressions to parse your CSV, deal ?
__adrian
likecolacola so hit those introductory tuts. then hit google/stackoverflow for your wp-specific problems, keeping in mind that you will be exposing yourself to awful things which you should not necessarily commit to your "toolbox."
AliG1000, there are simply far better/faster/easier/more reliable tools.
likecolacola
__adrian, after C i got the Java basics in a week or so, should i expect the same from learning php?
__adrian
maybe.
php has some oddities around it.
likecolacola
haha, Java too xd
runinsquares
__adrian, http://hastebin.com/onikidixir.php you made this last night, is "use" here like permanently passing a parameter without the need to set it?
merkazu
needle or haystack, you have 50% chance of getting it in the right order
JZA
__adrian: the comment with error_log gives me a file but not sure where would this be generated.
__adrian
php uses a lot of words you might be familiar with, but to mean slightly different (or soemtimes completely different) things.
JZA
error_log = php_errors.log
__adrian
JZA, i would recommend an absolute path.
unless you know where that path resolves to.
Alphos
merkazu did you know USB plugs had three sides ? you first try to put them with the logo up, they don't get in. then you try to put them with the logo down, they still don't get in. and finally you try again with the logo up, and this time they go right in. it's kinda the same with needle/haystack order :p
__adrian
error_log = /var/www/logs/php_error.log
or something
merkazu
quantum superposition
likecolacola
Alphos, __adrian thanks a lot for the guidance ! <3
__adrian
runinsquares, yes, `use( $var )` copies that var into the function's scope.
Alphos
likecolacola you're welcome ;)
__adrian
welcome
runinsquares
__adrian, nice
JZA
__adrian: done, still no luck, I mean no file is generated
__adrian
still wsod?
JZA
yeah
__adrian
dunno. have you tried linting the file?
php -l
runinsquares
__adrian, would getFooByID->execute() not work if you don't use "use"? i assume because it's anonymous?
__adrian
because $getFooByID would not be in scope.
(it would be undefined inside the function)
JZA, to be clear, are you getting a WSOD? i.e., with a HTTP 500 status (you're not just running a script which, intentionally or not, has no output)?
runinsquares
__adrian god i'm so out of practice i forgot function scope ><
__adrian
:)
JZA
__adrian: yeah no syntax error found on both
runinsquares
__adrian, btw can you do this: $myVariable = function Foo($blah) {}; // name function?
JZA
I thought it was a permission issue, but I confirm the issue is somewhere else.
__adrian
JZA i know it's a stupid question, but you'll feel worse if we come across it later
can you pastebin? how big is this script?
runinsquares
__adrian, iirc you can do it in JS and it helps with debugging but been AGES since i've done that
__adrian
runinsquares do what?
OH, no.
runinsquares
name anonymous fn
JZA
__adrian: pretty big, is a admin.php panel that includes a bunch of functions
__adrian
if you want to reference an anon function inside itself, you have to do: $foo = function()use( &$foo ){ $foo(); /* recursion! */ };
note use() by reference
runinsquares
OT: i would love that hastebin color scheme for sublime
__adrian
JZA: i'd start splitting things out, then... seeing if you can further isolate where the problem is actually happening.
:/
JZA
Alphos
i vote for a boycott on hastebin. it captures and preventDefaults spacebar scrolling
JZA
the issue happened after importing the lib/f.php file
runinsquares
__adrian, half-saved in my brain, i'll maybe come back to that in the future :]
NoiseEee
nobody is going to read through that file JZA
runinsquares
although it looks kinda straight forward @ reference
__adrian
JZA, if it happens after lib/f.php, have you examined that file?
JZA
Alphos
JZA php -l lib/f.php
JZA
Alphos: I also get no error
__adrian
and, to be clear, if you do NOT require f.php, do the error go away?
JZA
__adrian: well it gives me errors about not findign the function (from f.php)
*finding
__adrian
but no wsod
JZA
no, no wsod
__adrian
can you die("hello!") _immediately after_ requiring f.php?
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 next »