« first day (1069 days earlier)      last day (3884 days later) » 

3:00 PM
I was also just barely taught the basics on PDO, so I know just enough to do what I did now
 
@DarkAshelin Seeing the abomination you posted above, you need to improve your php for webdevelopment too :D
 
most of what u guys are saying now is chinese to me D':
 
> If you're concerned about security, you
should be validating the certificate fingerprint and not trusting CAs.
Hmm
 
the stuff I posted above is related to servers / hosts
 
@DarkAshelin The stuff you posted above is an extension of PDO that includes a Singleton
 
3:02 PM
yes
 
No matter for what purpose it is, it's an abomination, nevertheless. (Not trying to specifically hurt you, it's just the way it is :D)
 
"I was also just barely taught the basics on PDO, so I know just enough to do what I did now"
I know, I'm also trying to improve my php skills, but it's not like you go online and google "improve my php skills" xD
also weirdly enough my coding is still tons better than most developers around here
 
@DarkAshelin Nope, you came to the chat at exactly the right phase
 
so it could be worse ._.
 
@DarkAshelin "improve my PHP skills" has some good advices :)
 
3:04 PM
The phase right after you "graduate" from all the crappy tutorials and shit-level developers out there
 
@MadaraUchiha heya~
 
You transcend yourself, and then you can actually learn something from the "grown-ups"
Many developers never reach this level, you should be proud, you're ahead of the curve :D
@Mr.Alien o/
 
yay me :D
 
What's 'this level'? and how do I get there?
 
3:05 PM
level basement developer.
 
@Fabien The level above "crappy", basically, I think you're already there :D
 
It'd be interesting to know the average skill of php web development. I know that's quite a broad spectrum but still...
 
well I know I got a job as php webdeveloper, and I'm better than the last employee
 
I like to separate the php from the web development skills tbh.
 
I also got accepted to the first company I applied to, and the other 2 I applied to were bummed out that they couldn't hire me
so I guess I'm not that bad O.o or is industry that bad?
 
@DarkAshelin Well, maybe I visit Stack Overflow too much, but there are plenty of low-level developers out there.
 
I know SO has some really skilled ppl
 
I dunno @DarkAshelin. I feel like a perpetual noob no matter how much I learn. heh.
 
@ircmaxell what. html into the db? yes!!! ._.
 
Fat rabbits are star worthy :)
 
3:08 PM
irl, I feel as if everyone around me is retarded. in SO, I constantly feel retarded myself
7
 
@ircmaxell Where were you a few days ago, when I had an argument with someone about how it's not OK to store HTML in the database as long as you can help it
 
the level difference is too high
 
lol
 
IRL = PHP Development. SO Chat feels more like programming.
 
3:08 PM
@DarkAshelin Looks like you will have to do without mysql in that case :P
 
so, any suggestions where I should start now?
 
@ircmaxell You familiar with The Coding Love? :)
 
@DarkAshelin Can you repeat the original question? (It's too far back in the transcript :D)
 
@Fabien no, awesome
 
clients need responsive stuff these days at d price of fixed widths :p sigh
 
3:12 PM
@MadaraUchiha I need to connect to 2 databases, one of them being on the same domain, the other on a different domain. I'm using PDO
 
@Mr.Alien Blame mobile industry.
 
since I coded my PDO class as singleton, I made it 2 singletons (lol)
 
@DarkAshelin make two PDO objects?
 
anyways it seems I did get the connection right now, but am getting [1044] Access denied
 
Hey everyone!
 
3:13 PM
When extending a class, have in mind that your new class is a old class.
 
@Mr.Alien I do responsive design too; my price responds to the request :)
7
 
I'm like it works, don't touch it!
 
@Leri seriously, tabs, cell phones, pods... everyone needs fluidity but don't want to pay more
 
Has anyone used wordpress' woocommerce ?
 
So extending Kid extends Person makes sense and Table extends PDO is insulting
 
3:13 PM
@Jack you do responsive :O
 
so just removing the extends PDO is ok?
it won't burst out in flames?
 
another use-case for XMLRecoder :)
0
A: Read specific character from xml file to a php file

hakreThe string of the XML you've got is not properly encoded. The default encoding is UTF-8 however the string you've got is different, most likely Windows-1252. If you want that error to go away, you need to re-encode the string from that (by the missing information in your question:) unknown encod...

 
@DarkAshelin It would, why do you need an extension though?
 
What functionality does PDO lack that you need?
 
3:15 PM
I don't know how this class works 100%, so idk
 
Perhaps you should consider making a wrapper instead of an extension.
@DarkAshelin You didn't write it?
 
I did, 3 years ago v.v
 
On the topic of PDO wrappers. Know any good ones?
 
<?php
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(isset($_POST['text_practice'])){
$name = $_POST['text_practice'];
echo $name;
}else{
echo "No data was passed.";
}
}else{
echo "You must use a POST method to pass data to this page.";
}
?>
 
@Fabien The ones you make.
 
3:16 PM
@MadaraUchiha I kind knew that was coming :P
 
@DarkAshelin Time to abandon it :D
 
This code returns just a blank page insted of saying No data was passed. Why?
 
I wouldn't know how to make it different and still work xD
 
mda? madara achicha?
 
update: I've completely un-forked up my php-src fork =D
@Mr.Alien I think it's cha cha cha!
 
3:18 PM
@MadaraUchiha tbh I'm 98% done with this project, so I rather not make too big changes. but if you got some suggestions I can always use it for the next project
 
@SineLaboreNihil Use the button or CTRL+K when pasting code please.
 
Or 3 x tea if you're Chinese.
 
<?php
if($_SERVER["REQUEST_METHOD"] == "POST"){
if(isset($_POST['text_practice'])){
$name = $_POST['text_practice'];
echo $name;
}else{
echo "No data was passed.";
}
}else{
echo "You must use a POST method to pass data to this page.";
}
?>
 
@DarkAshelin You don't have to use this extension even if it does exist.
@SineLaboreNihil ...
 
lol I didn't know how to do it. It just turned out the same again...
I pressed Ctrl+K and then Ctrl+v. Is that what I'm supposed to do?
 
@Jack Super Powered version of madara uchicha?
 
@SineLaboreNihil Step 1. Paste code. Step 2. Press CTRL+K. Step 3. Send Step 4. Profit.
 
@Fabien I'm only seldom the brown dog, but when I am, nobody answers =(
 
<?php
    if($_SERVER["REQUEST_METHOD"] == "POST"){
        if(isset($_POST['text_practice'])){
            $name = $_POST['text_practice'];
            echo $name;
        }else{
            echo "No data was passed.";
        }
    }else{
        echo "You must use a POST method to pass data to this page.";
    }
?>
 
3:19 PM
@MadaraUchiha so should I just remove the extends PDO or is that a bad idea?
 
@Jack LOL!
 
@MadaraUchiha Thanks. :)
 
@DarkAshelin Don't, like you said, it's a big project, and you're practically done. Don't make such drastic changes.
 
Now, why doesn't this code echo the "no data was passed message" when I send an empty form?
 
alright
 
3:20 PM
It just shows a blank page.
 
@SineLaboreNihil $_POST['text_practice'] is probably set, but empty.
 
Check using empty not isset.
 
empty() is the function?
 
@SineLaboreNihil Check the link :)
 
3:21 PM
@SineLaboreNihil Good joke
 
or if($name != "")
 
I'm a complete beginner. :D
 
@DarkAshelin Just use normal PDO instead of the extended version.
Simple don't use it, even if it's there.
 
good, stay here @SineLaboreNihil so I don't feel like the dumbest person in the room xD
 
3:22 PM
@MadaraUchiha empty('0') == true :)
 
@SineLaboreNihil don't worry, equally noob here ;)
 
@Jack Really? :o
 
someone with 31k rep being a total noob? I dun belieb
 
So empty only checks if the value is falsy?
 
@MadaraUchiha Hands up if you love php's type system :)
 
3:23 PM
if the value is set or not
 
@DarkAshelin But empty('0') is true :D
 
yes, because '0' is a value
there is something there
"" (blank space) can also be a value
 
REPWHORE ^^^
just like me
 
@Mr.Alien You're a good repwhore though
 
3:24 PM
I always use if(isset($_POST["value"]) && $_POST["value"]!= "") to be sure
 
@MadaraUchiha thnx \o/
 
Why do I see Kolink's profile here? :P
 
Use === if you must check for emptyness.
 
or use empty...
 
3:25 PM
empty doesn't always work for me
 
Read up @Starsong
 
=== is faster than ==
 
@Leigh And more accurate.
 
empty checks false, null, 0 or "".
 
@Starsong empty('0') == true
 
3:26 PM
@DarkAshelin That works because values in $_POST are always strings afaik.
 
Thanks a lot Madara Uchiha! :D
 
@MadaraUchiha

http://php.net/manual/en/function.empty.php

" The following things are considered to be empty:

"" (an empty string)
0 (0 as an integer)
0.0 (0 as a float)
"0" (0 as a string)
NULL
FALSE
array() (an empty array)
$var; (a variable declared, but without a value)"
 
<?php
    if($_SERVER["REQUEST_METHOD"] == "POST"){
        if(isset($_POST['txt_practice'])){
            if(empty($_POST['txt_practice'])){
                echo "No data was passed.";
            }else{
                $text=$_POST['txt_practice'];
                echo $text;
            }
        }else{
            echo "The value with expected name was not sent.";
        }
    }else{
        echo "You must use a POST method to pass data to this page.";
    }
?>
 
I caught someone doing sizeof($string) the other day :(
 
That's my new code. :) I'm very proud of it! :D
 
3:27 PM
one of the disgusting thing even happened on so
 
Yes, empty(0) == true
:/
 
@Leigh Isn't that an alias to strlen()? :)
 
PHP's 0 == false is weird as fuck
 
Oh no! An alias to count() lol
 
@Starsong huh?
 
3:28 PM
@ircmaxell It's annoying.
 
@Mr.Alien how did that get so many upvotes?
 
most languages do that
 
@DarkAshelin Thats why I said, disgusting .. :)
 
@Starsong JavaScript: [] == 0 => true
 
Java, for once, gets this one right.
0 is not boolean false and shouldn't be treated as such.
 
3:29 PM
Java ... is strongly typed.
 
@Jack exactly, so sizeof() any string, empty or otherwise, is always 1
 
7
A: Is true == 1? and false == 0? in JavaScript

Madara Uchiha In JavaScript, == is pronounced "Probably Equals". What I mean by that is that JavaScript will automatically convert the Boolean into an integer and then attempt to compare the two sides. For real equality, use the === operator.

 
@Jack what you talkin about willis?
 
@Leigh You made me look at the manual for f*cking count() ... grrr!
@ircmaxell Eh?
 
$ js
js> 0
0
js> 0 == 1
false
js> 0 == false
true
js> []
[]
js> [] == false
true
js> [] == 0
true
 
3:30 PM
same thing happened with magic quote gpc, was using that to show setting in control panel of my cms that whether that is on or off, wasted an hour after I realized that mmm after 4.sumtyn it returned false and not boolean
 
[] == 0 because both are falsy values
 
I have to declare that... I love PHP! :D I'm a complete noob and I'm having so much fun with it! :D
 
@Starsong yes, because it allows you to do for ($i = 10; $i; $i--){}.
 
Ever done document.createElement('video').canPlayType('video/mp4'); in the Chrome console?
 
so uhm, can anyone point me in the right direction? I'm trying to access a database cross-domain, but get [1044] Access denied
 
3:32 PM
@ircmaxell Great, and it also means I have to === check a bunch of returns. :P
 
@ircmaxell Not sure if that was addressed to me ...
 
cross domain?
@Starsong you should be using === anyway
 
@ircmaxell For the convenience of not having to type > 0 in that for loop. :/
 
@DarkAshelin this is how we learn
 
@ircmaxell yes, I have domain1.com and am trying to access a database from domain2.com
@Mr.Alien already was doing that
 
3:33 PM
no, for being able to do if (count($array)) { as well, or if (strlen($str)) {, etc
 
@DarkAshelin Make sure the user has access rights from the IP address, by default mysql only allows a new user to connect from localhost (at least on Debian).
 
@DarkAshelin that makes no difference to a database
 
@Starsong I'm using PDO. where do I set IP address rights?
 
@DarkAshelin On MySQL command line.
 
I don't think I have access to that :X and noone does
 
3:34 PM
Your user will have rights based on origin (this has NOTHING to do with domain, everything to do with IP address).
phpmyadmin?
Whatever you use to admin sql
 
yes I got that
 
@ircmaxell Though if (strlen($str)) { ... } is not the same as if ($str) { ... } :)
Not sure if you were implying that ..
 
@Jack sure it is, if both are strings... Well, discounting "0"
 
@Starsong I can't edit/add users in the phpmyadmin
 
nyways cya, off to work
 
3:36 PM
but I have an existing user which can connect to the database, given it's from the same domain
 
@ircmaxell Yes, the almighty '0' :)
So to test if your string is empty, don't use empty().
 
Well, depends what empty means
$str !== ''
 
@DarkAshelin Sounds like shared hosting, they may not allow you to define broader access rights for mysql users.
 
I can't see what I am doing wrong here
I have these line of code and its not working:

`if ( $secondprice == "" ) {
$secondprice = "";
} else {
$secondprice = "\$$secondprice | ";
}`
 
@Starsong our company owns the hosting, we provide it
but we have no server admin... noone knows how it works
I can't stop facepalming about this fact
@benlevywebdesign use ctrl+K to format multiple lines
 
3:44 PM
if ( $secondprice == "" ) {
$secondprice = "";
} else {
$secondprice = "\$$secondprice | ";
}
 
@benlevywebdesign You assign an empty string to a variable if it's already an empty string?
 
I am trying to only show the second price on a menu if the item has a second price
 
does that make sense
 
@benlevywebdesign yes, but I think you're handling it the wrong way
 
3:48 PM
Ok teach me
if you want to
 
how does your html look (with php inside)?
 
<?php
	require_once("../dbconnect.php");
	$results = mysql_query( " SELECT * FROM simmzysmenu");

	while( $row = mysql_fetch_array( $results ) ) {
		$name            = $row ['name'];
		$description   = $row ['description'];
		$price             = $row ['price'];
		$secondprice  = $row ['secondprice'];
		$category       = $row['category'];
		$id                 = $row['id'];

		if ( $secondprice == "" ) {
			$secondprice = "";
		} else {
			$secondprice = "\$$secondprice | ";
		}

		echo "<div>
			<h1>$name</h1>
 
ok well you'll need to look into something like this:
echo "<div>
	<h1>$name</h1>
	<p>$description<p>";
if($secondprice != ""){
	echo "<p class='price'>$secondprice \$$price<p>";
}
echo "</div>";
and you can remove the if above that
 
ah
I see the difference and wondering why what I have doesn't work
 
if the $secondprice is empty, it will output:
<p class='price'> \$$price<p>
just a blank space, but the <p> and the $price would still be there
 
3:52 PM
yes
but its showing $0.00 and not just a blank space
for the second price
 
ah that means $secondprice isn't "" but 0.00
so change to:
if($secondprice != "" && $secondprice != 0){
	echo "<p class='price'>$secondprice \$$price<p>";
}
or in your method:
if ( $secondprice == "" || $secondprice == 0)
 
I just learned something thanks
 
:3
feels smart
 
interesting… a return in the finally block overwrites the return in try block…
 
so "!" equals not equal ?
 
3:56 PM
`==` is equal
`===` is equal and same type
`!=` is not equal
 
evenin'
 
feq u formatting
 
ah thanks
 
there is also !==
 
3:57 PM
== is equal
=== is equal and same type
!= is not equal
 
== is equal, === is really equal, ==== is hyper equal and ===== is surequal
 
the ironic fact is that I used to have a printer like that, it seriously it always jammed
 
wow cascading deletes are awesome.
I can break so much with 1 click!
 
I know each item has a category and I only want to display it once for each category but that's different code I haven't put in yet
 
Something is very wrong. Everyone is voting yes on the Variadics RFC and the vote count makes it a clear pass given historic trends. Everyone includes the big "no, new features make users confused" curmudgeons. The hell?
 
4:02 PM
@Fabien DELETE FROM facebook WHERE 1
 
@DarkAshelin that code will come later
 
@DaveRandom If I really just could do this… *dreaming*
 
@DaveRandom heh. Nothing like that gut feeling of "WHERE 1" in the unintentional sense.
 
some RBDMS can have limitations for deleting, by default
for example: SQLite
 
style question.... should a table name be singular or plural....
 
4:11 PM
is there a way to renumber a table in php my admin if I deleted a row?
so that is 12345...etc instead of 1235...etc?
non manually
 
@benlevywebdesign why would you want to do that?
 
@Charles Because everyone has had to do something similar to the following before?
function	bindParam($types,
        /** @noinspection PhpUnusedParameterInspection */                        &$var1,
            /** @noinspection PhpUnusedParameterInspection */
                            &$var2 = false, /** @noinspection PhpUnusedParameterInspection */
                            &$var3 = false, /** @noinspection PhpUnusedParameterInspection */
                            &$var4 = false, /** @noinspection PhpUnusedParameterInspection */
                            &$var5 = false, /** @noinspection PhpUnusedParameterInspection */
 
idk I like order and I like consecutive order
it makes it look perfect?
 
@benlevywebdesign Sounds OCD to me. Your auto incrementing index is your rows identity.... that should not change over time
 
4:18 PM
Really fighting the urge to buy GTA V for my xbox :(
 
@Fabien Don't fight it....
 
But I want it for PC. :(
I'm sure it doesn't really encourage violence :) Pow!
 
@Fabien Fighting animation looks a lot better then IV
 
lol yup. checking bank account
 
4:33 PM
how do i even begin to tackle the category of each item to show only once per section ex: Pizza (showing only once)
 
@KendallFrey or anyone else, do you have a link to that SO question gif with "how do I do this thing" or something similar
 
@BenjaminGruenbaum You mean i.stack.imgur.com/62J0l.gif?
 
Not the "use jQuery" one, the other one
 
Oh I know the one, one sec
user image
11
^^ lol
 
@DaveRandom :D
 
4:44 PM
@DaveRandom haha lol
 
@BenjaminGruenbaum i.imgur.com/dOLkgVR.png no onebox
That one?
 
why is github code window restricted to such few pixels (wide) … always need to scroll...
 
It's 100 chars IIRC
 
I'd like to have 100%… then I could see at least something on my 2560 px wide screen
 
Which is generous, considering linus would probably rather you stick to 80
 
4:49 PM
@bwoebi I use softwrap.
 
@DaveRandom Yeah, that, ty
 
@DaveRandom not enough. My terminal is 510 chars wide…^^
@LeviMorrison yes… but only when I'm finished with coding. Readjusting wraps while coding is annoying…
 
haha
WTF Look at My Points
 
"Code from home. If you are a dog" always cracks me up
 
@Danack I was about to say "that's just crazy.", but then I noticed the references and decided instead to say "that's perfectly sane, unfortunately."
 
4:57 PM
got a question
 
@bwoebi ... softwrap means it doesn't wrap the lines; it just appears that it does.
 
I have some menu items that have a 2 prices(ex. cup/bowl) and so I created a column for the second price and I allowed for a null value. Do I have to check null value or can I leave it blank?
 
@LeviMorrison reason: me. … Well; can you in github set some softwrap?
 
@bwoebi I believe so.
 
5:15 PM
I'm brain farting right now
Ok so how do I do an h1 with margin-top:10px; margin-bottom:0px; when followed by a p with margin-top:0px; margin-bottom:5px;
 
you can't
 
Not just with CSS anyway.
 
<p style="margin-top: -10px;">? Or did I miss the boat?
 
yeah
ok maybe this code that I want to clean up/simplify if I can will help:
$current_category = "";
$current_subcat = "";

if ( $current_category != $category ) {
    				echo "<h1 class='category'>$category</h1>";
    				$current_category = $category;
    			}

    		if ( $current_subcat != $subcat ) {
    			echo  "<p class='subcat'>$subcat</p>";
    			$current_subcat = $subcat;
    			}
see how I have two if statements. they can be combined right?
 
<h1 style='" . (( $current_subcat != $subcat ) ? 'margin-top: 10px; margin-bottom: 0px;' : null) . "' class='category'>.....
that might work for you
 
5:24 PM
Sorry my bad - the function was not within the window object. I appreciate the concerns and understand the reasoning; however for the project it does actually make sense to pass the functions in via data attributes. I will in future not use this as a general coding convention - thanks! — Matt Pawley 4 mins ago
Why do I even bother :((
The thing is, that's every jQuery question ever -_-
 
ok lets step back a step...can I combine my two if statements
 
Stop echo'ing HTML. Jump in and out of PHP parsing:
<?php if ($iCanHazTrue): ?>
    <p>Y U NO FALSE?</p>
<?php endif; ?>
^^ @benlevywebdesign
 
I'm just starting to get into php so thanks
 
Well, its easier to learn the right way now, than unlearn the wrong way later.
6
 
thanks
so guide me along
so doing echo isn't that great
 
5:34 PM
@DanLugg Presumably you mean if ($i->canHaz(true)) ?
 
@DaveRandom $u->canHaz(E_IDGAF);
 
@DanLugg IDGAF how I live my life
 
@crypticツ I share your demeanor, and embrace it's impartiality.
 
now I think I've messed it up
 
This is why we can't have nice things :( — Benjamin Gruenbaum 16 secs ago
 
5:48 PM
Ok my simple questions is how do I combine two if statements into one
I tried the above idea that @DanLugg suggested
 
if($cond && $cond2) ;)
or if you want only a min of 1 to be true use || instead of &&
 
@Recode thanks let me go try this
 
you can also use the words 'and' or 'or'
 
ok that worked but it got rid of the first condition on all but the one with both conditions
 
Evening
 
5:57 PM
I'm getting the hang of this
I think
 
Hello @PeeHaa
 
@MattPawley Please do not use eval for this. I just put it there to mention it's possible. Do NOT use eval for this. It will get you nothing but PAIN. It's there for the sake of completeness, not to be used in production code. Do proper separation of concerns instead. Adding arbitrary functions as data attributes in the DOM scares me :S — Benjamin Gruenbaum 44 mins ago
 
People really a use AND instead or &&?
 

« first day (1069 days earlier)      last day (3884 days later) »