« first day (1265 days earlier)      last day (3908 days later) » 

11:00
But mysqli doesn't work on WP
@DavidH it seems your previous statement failed (probably), you passed a boolean to the mysql_num_rows function
@DavidH it does
I tried to several times but it kept failing
My mysql codes kept working
But mysqli didn't strangely
@DavidH Array given? Sounds like you called mysql_fetch_array...
So how does a Query relate to true/false?
This is the variable btw : $sql_assoc = $newdb->get_results ("SELECT * FROM locator_members WHERE MemberID ='" . $id . "'");
@DavidH Right, get_results is presumably returning an array of the result rows, not the result resource
var_dump() it
If you want to get the number of rows in the set, just do count($sql_assoc)
@DaveRandom Yea I think you're right, so I'll have to var_dump in a variable and add that variable into mysql_num_fields?
mysql_num_rows expects the mysql handle. this is something completely different
Um... wat?
if you already have a result in an array, use count($sql_assoc)
Hmm but is count comparable to field_count?
That's essentially what i'm trying to do on WP but I have absolutely no idea how that'd go
11:05
if ($sql_assoc) {
    $num_rows = count($sql_assoc); // number of rows in the set
    $num_fields = count(current($sql_assoc)); // number of fields in the first row
} else {
    $num_rows = $num_fields = 0; // the query failed or returned no rows
}
it depends on how get_results() works... i'll just assume it's a 2-dimensional array
then what @DaveRandom posted will work^^ thx
Because on Wp for results i'd foreach as result and than $result->value but on mysqli you'd do for ex $mysqli->field_count with $mysqli being the connection string
Let me try that
@davidh $sql_assoc = $newdb->get_results ("SELECT * FROM locator_members WHERE MemberID ='" . $id . "'"); <= I really hope you know how to sanitize $id
@seong I do! @DaveRandom Hmm I think i've phrased myself incorrectly
Basically what field_count does, is giving you the number of fields in a row right?
@DavidH Where the docs for the class that is in $newdb?
11:10
@DaveRandom I don't understand your question, what do you mean exactly?
@DaveRandom Wether it's global or if @newdb is phrased correctly, makes connections etc. was that your question?
Good (UGT) morning.
@DavidH What I mean is, where are the API docs for whatever you are using? Is it this?
@DaveRandom Yes that's it.
@DaveRandom Can I show you what i'd do in mysqli but what I fail to accomplish on WP?
Jesus that page makes me want to cry a bit
I know right
I have no choice unfortunately
11:15
> Remember to globalize $wpdb before using it in any custom functions
@seong That's why I can't use mysqli I HAVE to use mysql_
While it's kind of deprecated..
I globalized it
@DavidH Just tell me again exactly what you want, you want the number of columns in the result set yes?
@DavidH no, mysql is deprecated
11:16
The connection isn't the issue but my workaround solution is
Yea look this is what i'd do in mysqli:
$Sql = select query..
if($result = $mysqli->query($sql))
{
$numfields = $mysqli->field_count;
}
I fail to accomplish the same on WP since it doesn't support mysqli
i think you can configure wordpress to use mysqli instead of mysql
@tereško I'd like the latter. Unfortunately, my git shows off around 10% of my current skillset. So I definitely need to go with the first option and at the same time think of a way to demonstrate my skills. Thanks for suggestion.
@seong Yea but I have this preset working area (Im an intern remember) so I can't/probably may not change anything
@seong You can configure WordPress?! Sounds like a lie.
@DavidH OK you want what I suggested before then, does that not work?
Oh wait
11:20
@DavidH then you should at least advise them to change that. with php 5.5 your site won't work anymore
You need to cast the row to an array to get the correct count
or just request it as an array in the first place
@Leri lies! :D
@DaveRandom yea! but php.com literally says field_count shows the amount of columns in a table
But there are multiple fields in that one table (Since I fetch by ID I get 1 result with multiple rows)
@DavidH Yeh but you cannot get the from the stupid WPDB wrapper (well, maybe you can, but the docs are shocking and it doesn't explain how)
So the answer can't be 1 which I get
@DaveRandom Exactly..it's so saddening
11:22
$results = $db->get_results("SELECT * FROM foo");
if (!$results) {
    // you got no results, boo-hoo
}

$num_rows = count($results);
$num_cols = count((array) current($results));
$wpdb->get_col_info('name', -1);
jesus
this API...
@seong Feel my pain :P
this should do the trick
Let's try both
count($wpdb->get_col_info...)
11:24
if (function_exists('the_loop')) {
    posix_kill(posix_getpid(), SIGKILL); // die is too kind for wordpress
}
11
@DaveRandom $num_cols worked as a charm!
@seong I can't pull away from get_results because that's the query I need to use I get something else with get_col_info
@DaveRandom Your code has syntax error: count((array) current($results)); should be: count((array) current($results)); // WTF am I doing?!
@DavidH The issue is that count() returns 1 if you pass it an object, for no good reason. If you cast it to an array then it works as you would expect
jesus
Hey everyone!
11:26
@Leri inorite
@seong Don't torture yourself anymore. Thank you so much for the help all!
@DaveRandom Omg im learning!
Yeh that particular issue is just the result of PHP's own insane API
I really cannot even begin to imagine who though that returning 1 in that case is the right thing to do
Yea..it's so strange
It's about as correct as doing return rand();
Imagine if someone would want to see 1 but got the wrong "1" as result and found out later
11:29
These lines sets the session if I am not wrong.
session_start();
$_SESSION['sessionId'] = session_id();
I have two applications with different folders in the same server. But logging to one application logs into other application also as well. Can someone tell me how to avoid this?
@DavidH get_col_info() returns the column information for the last query. even though you are already in hell, this is slightly cleaner than working on the result array...
@Appu Yes, define different session names for both applications. Further reading: php.net/manual/en/function.session-name.php
It should probably just return false tbh, but there are so many cases where it would make sense to return the number of public properties that I suppose I could also live with that, but I think that would be O(n) because there won't be any stored count of specifically public properties, you'd have to iterate the whole HT
@seong I'm going to try that the next time i'm working with this....crap.
@DaveRandom Why not both?
That'd be the most obvious to the average and expert coders
How do you mean both? You can't have 2 return values...
11:32
Not even for errors?
Or incorrect results
@DaveRandom at least they added the Countable interface
I'm not familiar with the PHP api itself by the way
but for all other cases it should just slap you with an error
@Leri Thanks ya. I will look into that.
@seong I agree
11:35
@seong Yeh but the problem is people using stdClass as it it were interchangable with an array. I really don't get why people do that all tbh, it might make sense in some very narrow cases if object was a valid type hint or if PHP had a similar object model to Java where everything extends from the base Object class or if you could attach closures to objects as methods, but none of those things are true so the is literally nothing that stdClass gives you over an array
@DavidH How would you receive two return values in your code?
I mean you can use out params but they are generally nasty-nasty
jesus
xD
or -1... we've seen it all
@DaveRandom Param but you're right it's not correct to
It's not necessarily incorrect, it's just that PHP != C
Yea I have no idea how to explain it but I get your feeling!
i'm pretty happy i moved away from php now :D
11:38
@seong What are you focusing now?
Go
Oh right!
I listen to a radio that was coded/made with: PHP Python Go Bash and JS
The combination though..
@seong Not too much jobs who'll pay you for that. Nice language choice, btw.
@Leri So lucky I am my own boss working on our own products :D I love it!
@Leri I'm a total fanboy now. Never had so much fun programming since... I think since I first started programming
@seong I had the same experience when first tried lua. I wish I had more free time.
11:43
Has the darcula theme in phpStorm messed up any ones eyes? I've changed back to the regular white and grey now and it's much better
@David Cobalt was the best for me.
Reading bright multicoloured text on a dark background is surely not great for your eyes
Personal preference, imho. Well, we'd need professional to find that out. ^
@Leri oh yeah, Lua is probably the best you can get out of a scripting language
@Leri What IDE do you use?
11:51
@David VS 2012 light theme, eclipse also light, phpstorm cobalt (have not used for a while, because did not write single php line more than half a year), notepad++ and gedit (when writing C).
@Leri I don't have that Cobalt theme pre-installed
I am just going to stick to light themes from now on anyway. The darcula might be cool but staring at it for 14 hours a day and then looking out the window = not being able to see
@David Staring at screen for 14 hours constantly and looking away always === not being able to see properly. Well, darker themes make it even worse though. :)
Hi everyone I have a question if you don't mind
We do mind that you mind that we might mind.
Unless we don't! In which case we do mind if you don't ask a question.
12:04
@Leri I don't mind
@user3293145 Seriously: room-11.github.io/#dont_3
@ircmaxell Why?
read the question, and the answer
12:13
Huh, didn't read the answer.
Still, the question is valid
Even though the problem ended up being silly.
it is?
if you say so
The fact that the solution is bad, doesn't make the question bad, is it? :)
@SecondRikudo the question is literally "why doesn't my code work" without code...
@ircmaxell I voted cv. Not sure if it's just about "it's not working, help me!" - but definitely I see lack of efforts to resolve the issue
1 message moved to bin
spam is strongly discouraged in here
12:25
because..
+61 Oo
/me wants to be a room owner, atm
Does anybody know about the Microsoft MTA certification?
47 messages moved to bin
any one can help me
2 messages moved to bin
@user2848901 Yes, read: room-11.github.io
12:32
just ask away
:| What is this site, a personal site or something?

The theming and styling conflicts...ooch.
Maybe finding a consistent style and sticking to it will work a bit nicer, imo. That's just my unprofessional eye, though.
@Fabien lol
Considering coding webdriver to auto close-vote from cv-pls queue.
9 messages moved to bin
@Jimbo Yeah, but what should be the "reason"? You need to follow others there.
@webarto I'd be doing ones with 3+
@Fabien What's the thing in the middle?
12:58
Who knows.
@AustinBurk am new in web development i fix that error by adding https to youtube uri
Ah, okay.
I see that you have a login bar at the top and a box with login/signup on the left. Those are styled differently and don't fit right.


a) Is a login even needed for the visitor who's going to the site? What added features does logging in give you?
b) If so, maybe you could put little tabs at the top instead of a login, and keep your login box on the right, but have something else on the left to balance it all.
this chat is kind a twitter, right? not irc? :/
@aldy505 It doesn't use IRC commands, no, nor is it really much like Twitter at all
just a normal q/a chat then?
13:06
@aldy505 See the faq.
@aldy505 The chat is more for discussion, vs. the sites, which are more for q/a.
@seong Hey you there?
It's like twitter, but more chatty and without hashtags.
@DavidH yeah
so it's nothing like twitter
13:07
@seong Where can I actually see what the command differences are between mysql and mysql_*?
I can't really find anything or i'm searching incorrectly
@3ventic Well, you can type messages here, does that count? :P
I guess
@DavidH you mean mysqli? php.net/mysqli
@DavidH it's a completely different API
@seong No, you mentioned that mysql is deprecated and mysql_* is the closest coming one right?
@DavidH mysqli_* not mysql_*
I didn't know it was the same..
mysql_* is just a way to say all functions in mysql API
@DavidH with mysql_* i mean any function which starts with "mysql_"
Is it different from mysqli the mysqli_* ?
@DavidH ???
13:10
Wait let me put it like this
mysqli is the new "MySQL Improved" API, which is replacing mysql API together with PDO
Most mysqli functions do not work on Wordpress because it's using mysqli_* , what exactly is the difference?
@AustinBurk actually its public page but now it fixed after login so that time white box didn't appear see this link mysportsjam.com/index.php
@user2848901 Whoa that looks a lot better
@DavidH wut?
13:11
@DavidH wait... i think you are confusing some concepts here...
I think I am :P
if you're using mysqli_* and mysqli function don't work, then how you can use mysqli_* command.
@DavidH Wordpress is just a "framework"... it has some wrappers for database functions
mysqli_* functions are a part of mysqli API..
framework in a veeeery loose sense ;)
13:12
@seong That's what I didn't understand, thank you.
@DavidH the wordpress wrapper uses either mysql_* or mysqli_* functions
@AustinBurk if u register u can check innr pages
@DavidH at least the newer wordpress versions...
@seong mysql_* unfortunately
Ah, I see!
Perhaps there should be a bit of a preview of what's inside

+1 for Facebook login integration, I'm usually more partial to using my Facebook to login to sites
13:15
@seong It highly confuses me how i'd translate this into WP:
if ( $row = $result->fetch_assoc() ) { }
@DavidH but i thought you were working with the WP wrapper...
@DavidH That turns a MySQL associative array into a normal array. Why the if, though? What's it doing?
@AustinBurk client need website like social networking thanks
@seong I am but I have this mysqli site turning into WP remember
@DavidH Perhaps the WordPress forums might be able to give you some help
13:16
@AustinBurk Didn't include what's in it to avoid confusion not really relevant either
@AustinBurk Heh I've had more help here than the amount of responses u get on the forums
Alrighty then

Hm
I'm way more thankful for stackoverflow in it's entirety than the WP forums..
@DavidH codex.wordpress.org/Class_Reference/wpdb this is the wpdb wrapper documentation
I've read through it but, some of the things I have in mysqli for example they don't really click into my head as to what I'm supposed to look for on WP/the codex.
@DavidH what you probably want to do is something like $result = $wpdb->get_results($query, ARRAY_A);
`if ($result !== null) {
foreach ($result as $row) {
}
}`
13:24
@seong Yea my only issue is to echo everything out
In one word
What you'd need to do with that method is to do $row->Name $row->adress for example
@DavidH For each row, print out the address?
@DavidH then use get_results($query, OBJECT)
Echoing it out of course, but i'm looking for one word or actually a way to do $row[$something]
@AustinBurk Hey wait a second can't I just make an IF as long as i'm in the foreach that seong showed?
while ($result = $wpdb->get_results($query, ARRAY_A)) {
echo $result["something"];
}
And 'something' is the column for the row you're currently on
^^ going to be an interesting convo
13:27
I need to collect all columns that'd be the issue
Just like fetch_assoc would fetch everything into the variable that was written before it
Want to see what I'm trying rebuild?
From mysqli to wp's way?
Morning again
user895378
morning
night
      if ( $row = $result->fetch_assoc() ) {

        for ($i = 1; $i < $numfields; $i++){

          $field_array  = $result->fetch_field_direct($i);

          $field_name = $field_array->name;

          if($row[$field_name] == '-1'){

          some stuff here
            }
       }
    }

Good afternoon
That'd be mysqli @AustinBurk
This is what I have in WP
for ($i = 1; $i < $num_cols + 1; $i++){
   	//echo "i=$i<br/>";
   	$id_values   = 0;
   	$field_array = $i;
   	//echo "field_array=$field_array<br/>";
   	$field_name  = $field_array.$propName ;


   	if($num_cols[$field_name] == '-1'){
some stuff here
        }
    }
}
I still don't understand what the issue is. I thought you were just trying to transition to MySQLi functions from the old MySQL ones, but I don't know now..

What are you trying to solve?
13:32
I have to say, I'm getting pretty tired by the level of insults that are being thrown around at non-regulars in this room. It's one thing to joke among friends, it's another thing to flat out insult someone you've never talked to before. And this "pact" is causing the problem more than solving it. Try being polite and respectful. It's not hard.
@AustinBurk I'm "translating" the Mysqli that is working on the normal site into what WP uses
@ircmaxell Wait, what?
@webarto What exactly did I do on the "don't" list I honestly don't see
do I really need to cite examples?
one is happening right above you
13:36
@ircmaxell My thoughts weren't changed since we've introduced "the pact" so - if someone respects others and knows what means to be polite, then he don't need any pact. But if he isn't - then no pact will help. Conclusion: this pact is near senseless
@DavidH Are you trying to integrate something into your WordPress installation, but want to make it work with the WordPress database functions (for consistency's sake, perhaps?)
@ircmaxell Did I say/do something wrong?
g' morning
morning, @CarrieKendall
@ircmaxell I'm not seeing it. Am I part of it? :/
13:36
@DavidH not at all
@AustinBurk Basically yea and i'm doing the last thing of everything I had to do! I'm very close to finishing
@ircmaxell Oh good, if I do please do tell I really don't mean to.
@AlmaDo my opinion exactly
@AlmaDo Respect something for no reason? Pffft. FEAR
@webarto I mean in neutral sense.
user895378
I haven't ever read the chatroom pact myself.
13:38
Yes, but we can't teach everyone how to behave and/or be polite. There are loose rules, follow them, or GTFO.
user895378
But I do appreciate the use of universal greeting time.
I added that, so <3 :P
@webarto we can't. and even if we'll do this - nothing will change
Still better than nothing and repeating same things 100 times, this way we just link it.
Read from here down, and tell me you don't see a problem: chat.stackoverflow.com/transcript/message/15640194#15640194
13:39
you are still repeating yourself, just using a link rather than an explanation
@DavidH You've pasted wall of text and said afternoon even tho @ircmaxell said good morning.
We must civilise the world! -British King
@webarto it's the only useful thing in that pact (i.e. post reference link instead of making explanation at 100 time). But still it's not helping the situation
Come on guys, cheer the f* up
@webarto dude, he posted that as a continuation of his question from 3 lines before I said good morning
13:40
@webarto I realized before you linked the rules that I shouldn't have and couldn't delete it but flag it. About the good afternoon, it's afternoon here I don't really see the issue in saying that.
Don't ping me I don't care.
kthxbai
@ircmaxell Saying that one should stop spamming link to some his website means being impolite?
this is the crap I'm talking about. This room used to be much more friendly and condusive to new people... Now it's an attack on almost everyone, for no real reason...
@Leri it's not what was said, it's how it was said
You are obviously not paying much attention.
13:43
@ircmaxell Ah, my accidental comment; I wasn't finished with that and accidentally sent it. I just thought that it was slightly odd that someone who says they wrote the PHP book that's on that site has 1 rep on SE, and that their style of writing in chat differed from the style on his linked site. That's all. But I accidentally sent the comment before finishing.
Most of "new ones" how come here are "debug this for me" because they're banned from asking questions on main site (probably for a reason).
@ircmaxell I don't think you remember when teresko was here often :-P
I help people who can help themselves.
@ircmaxell yes. But it's double-edged sword too. Being too tolerant may cause such things as attacking by walls of text and disrespect from the newcomers..
13:43
@Jimbo I'm talking before him
Yes, I am an asshole sometimes, but I don't mean harm.
You're not obliged to help others though.
@webarto that's fine, then just don't help those you don't want to. You don't need to insult them
please help
1
Q: Wordpress - How to Delete Old Post Revisions Except One Month Ago?

Hassan MagdyThe Process of Remove and delete old revision of posts, pages and related meta content completely then optimize Database will reduce size and optimization to speed up the site. There is a Plugin called Better Delete Revision https://wordpress.org/plugins/better-delete-revision/ Really it's wo...

13:44
Fuck it.
screw it
I mean some even try to apologize and will not do it again most likely but you're still supposed to be open to apologies and such.
@DavidH nothing related to you personally :)
No I know I mean in general though, not pointing towards you as well!
13:45
ok. I'm off for now, see you
@AlmaDo you can say something about it, but there's a difference between being polite and saying "we discourage that", and calling someone an asshole for doing it
@ircmaxell 2 messages before my f* it, is a prime example.
@DavidH I like helping people. I do screw up sometimes though. Everyone makes mistakes, but we should learn from them, right?
@ircmaxell I'll never insult someone even if he deserves. It's my principle
@webarto you don't need to reply to it. That's the way things have always been handled that people don't want to handle...
13:46
@AustinBurk I couldn't agree more :)
@AustinBurk if you're talking about your "copied book" comment, I don't see anything wrong with that. You asked a valid quesiton, in a valid way. No problems there
By the way, why is there only a certain amount of time to edit/delete your posts here?
@DavidH Some apologize and keep doing the same.
@DavidH I think it's so you can't change histo....nevermind, ircmaxwell addressed it.
@ircmaxell Sure, I don't mind, I'm not trying to play a cop, but if you explain/link someone to basic set of rules, maybe you can prevent undesired behavior. But again, if someone behaves bad that just shows the person they are.
13:47
That is true Leri.
13
Q: Can we have more than 2 minutes to edit comments in chat?

JimIs it possible to increase or remove the edit time limit on comments in chat? I think that 120 seconds is a bit of a short period in order to correct any typos or errors. Consider this: Many of the chat rooms, including the Chat Feedback room are left for several hours or days before people r...

2
@webarto the way I'll say it is with a meta post: meta.stackoverflow.com/a/15660
Hehe alright that makes sense. @ircmaxell Thank you!
Should just allow people longer to remove and PMs for warning in red when removed (if necessary)
@ircmaxell I don't like lmgtfy; but when it's an obviously googleable question I just do this: google.com/search?q=example+here
user895378
@ircmaxell I know we briefly talked about looking at an integrated event loop as part of PHP 6 ... have you given that any serious thought?
user895378
13:51
Because TBH the potential for async non-blocking support in 6 is the only feature I would get excited about.
user895378
But I seriously doubt if the idea would get much traction on internals
@AustinBurk it's not what you do that's the problem. It's how you do it. Which is why I linked to the very specific answer
@rdlowrey I have to a limited extent. As in how the scheduler would work, how syncronization would work, etc
I don't usually include snarky remarks with it, I just post it and leave it
Sometimes people are just searching for the wrong thing
user895378
I just don't understand how it isn't even mentioned on internals. You have things like golang, node, of course. Also the new Python 3.4 introduced an async module but PHP is still not even considering things like this.
user895378
A bigger looming concern to me is PHP's continued relevance in a world with http2
13:53
@rdlowrey let's not forget hack's async, which isn't even async
:0

"HTTP 2"?
user895378
hack doesn't even enter my mind as a valid option at this point
oh bbl
user895378
But h2's support for many multiplexed request/response streams over the same TCP connection will make really high-performance http applications much more prevalent.
@rdlowrey no argument there, just pointing out it has an "async" structure, which really is just eih...
user895378
13:55
A continued reliance on process-per-request means that PHP on the server side cannot take any advantage of h2's biggest benefits.
@rdlowrey if PHP continues to target the bottom 80%, that won't be a problem
user895378
@ircmaxell lol, true
user895378
I'm torn on this topic.
user895378
Because obviously PHP's bread is buttered with the bottom 80%
Well, let's try talking this out
13:56
@ircmaxell Valid, but I don't think it's a rule, not everyone is the same, in the end, if regulars are good, then the bad ones will be noticed... and will throw rotten tomatoes at 'em :) Pardon me.
user895378
But it would be nice to have support for the other 20% ... at least the capability to do high end concurrent things.
Proposal: Implement "go style" on-call async support. Which under the hood may be executed via thread-pool or event loop (to us, we don't care)
@webarto I was just pointing out that even if the message is good, it can be said in a way that makes it bad... Just my $0.02
So, if we do that, on-call async support, we have a few problems.
1: How to provide information flow between "routines"
Go solved that with channels, which serve as both information carriers and syncronizers
we could easily do that, which would give us the added benefit of being able to support multi-process workers as well (by fork()ing and making the channel a socket-pair)
user895378
I'm not familiar with how it works internally in Go, but that sounds like it's basically just two-way communication over streams.
@rdlowrey it's an abstraction of that concept, yes
hmpf. can someone please make all the Iterator taking constructors work with IteratorAggregate please?
13:59
2. How to prevent threads modifying objects

« first day (1265 days earlier)      last day (3908 days later) »