logs archiveIRC Archive / Freenode / #php / 2015 / September / 25 / 1
kenneth24
Bad_Advice_Cat how do I get the value from a PDOStatement::execute and store it into a variable? The documented says it just returns true or false.
So yes if it works and the statement executes properly, thats great, but I want to store that value into a variable./
morfin
i do not undestand
sorabji
kenneth24: PDOStatement::fetch
morfin
if i use default namespace in XML should not i be able just use //sometag?
kenneth24
sorabji ty
MikeSeth
morfin: question makes no sense
morfin
why
i can't query sheetData
MikeSeth
are you asking about xpath?
morfin
yes
         

MikeSeth
namespaces are not relevant unless explicitly used
NoiseEee
you need to register the namespace if you want to use xpath to search with it
morfin
there is no namespace
MikeSeth
which is why your question doesn't make sense
theskillwithin
If I upload a folder via ftp and overwrite another folder, will it delete all the files or just replace the ones that are the same?
NoiseEee
theskillwithin: assuming you are talking strict ftp (why, in ##php??) it will jsut replace.
CavemanSean
Got a quick question for you guys here, I have a dropdown menu that I created (but mimiced code from a page already on the internal page) what should happen is, when you choose the item, the page refreshes, loads the data into a table below the drop down and the value is left in the dropdown menu.... this is not the case, the code can be viewed here http://pastebin.com/nUQVVRed the line is 35
for the menu that I am talking about.
MikeSeth
that is a terrible UX, select boxes shouldn't trigger page reoloads
morfin
getNodePath returned /*/*[5]
but that's something strange
YamakasY
anyone around that has a simple getData test for couchbase ? I needs some simple text where I get the ID from a bucket to test this env but I cannot fin a simple one with password usage for the bucket
morfin
i think i managed to fix that
Bad_Advice_Cat
MikeSeth, sounds trollicious! :D
morfin
had to register namespace and query with "//x:sheetData//row//c[@r='A10']"
or even with just "//x:c[@r='A10']"
Microsoft abomination
sorabji
CavemanSean: try not to mix html with php like that, it's messy and tough to follow
and sweetjesus those globals
morfin
i guess only way to change content of node is create new text node and then $parent->replaceChild?
jac0bz1
I'm trying to learn using namespaces. Is there a way, to init a class, like new Foo; and calling that inside a function without creating a new instance?
TimDix
new Foo by definition gives you a new instance... which is entirely separate from namespaces.
jac0bz1: Perhaps you can explain better what your end goal is?
And what you mean by 'init a class'
sorabji
morfin: that's one way to do it. i believe you can directly set some of the properties as well
morfin
textContent is readonly so i will try
sorabji
         

jac0bz1
I have a lot of functions that In the end will call a class method, before I had a function called "loadClass" that would load the class, then keep it in memory, now with namespaces and autoload, this will not work
morfin
what a
Bad_Advice_Cat
CavemanSean !! HEY!!!
Wanna show you something
morfin
localized version of docs is outdated - http://php.net/manual/ru/class.domnode.php
sorabji
jac0bz1: i'm not following your question
TimDix
jac0bz1: No, I don't beleive that namespaces change anything
sorabji
morfin: that's unfortunate :(
Bad_Advice_Cat
-__-
TimDix
jac0bz1: Sounds like you want to instantiate a Foo object in your constructor, and all your methods use that same instance?
morfin
there is so many crap to do about that worksheets
jac0bz1
yes
hold on, i'll give you an example
TimDix
Yeah, namespacing doesn't change this. $this->foo = new \Whatever\Foo();
$this->foo->bar();
jac0bz1
sorabji
though you should avoid calling 'new' inside a function
TimDix
sorabji: Why/
sorabji
avoid coupling
jac0bz1
as you would imagine, "getfromfoo()" will not return anything
sorabji
there's no way to modify the type of object that function will use without directly editing the funtion
function*
TimDix
sorabji: Fair.
sorabji
jac0bz1: what's the point of those functions?
why not just call $foobar->add_to_array();
jac0bz1
in that example, nothing
TimDix
jac0bz1: Your problem is not with namespacing, it's with class design.
sorabji
can you provide an example that shows why they shouldn't be in the class itself?
TimDix
You hve a class (foobar), and then to global functions which should be class methods.
Note: This is not new to namespacing. Perhaps in the past you were using static methods?
jac0bz1
Perhaps it's not the namespacing, it's the use of autoload that I dont get to work as I used
What i have, is a bunch of "helpers" functions, that calls some class
TimDix
The autoload doesn't really apply in this scenario.
jac0bz1
before, When using $foo =& loadClass(
'myclass');
the loadClass function would keep the classes in memory
so the next time i called it, it would use the one privious loaded
TimDix
Sounds like loadClass was a factory?
sorabji
jac0bz1: any answer to my question?
TimDix
jac0bz1: I think you may want to look into Singleton and Factory design patterns
(Note: There are pro/cons to these design patterns you need to be aware of)
Bad_Advice_Cat
jac0bz1, I do not know how else to make this Obvious to you, other than a picture of what YOU are doing. http://uploadpie.com/Uof1B
See the code similarities?
sorabji
i mean you could pass the instance to those functions...but i still see no reason why they aren't methods on that instance in the first place
jac0bz1
Bad_Advice_Cat: yes i do
Bad_Advice_Cat
$foo =& loadClass <-- Please don't do that. This is PHP-4-ish.
jac0bz1
so then i need to go back to using globals ? like wordpress ?
TimDix
No.
Bad_Advice_Cat
jac0bz1, I wouldn't want to use wordpress in the first place.
Bad influence environment.
jac0bz1
So how would you do it then, if you wanted/needed to have helper functions, calling a class without creating a new instance of that class?
Bad_Advice_Cat
jac0bz1, in case you are curious of what else is on that same web page: https://nikic.github.io/2011/12/27/Dont-be-STUPID-GRASP-SOLID.html
The wonderful ingredients of what makes bad code.
sorabji
jac0bz1: my last was directed at you...
Bad_Advice_Cat
And solution on what to do, instead of using such toxic ingredients.
kenneth24
bad_Advice_Cat when I try to BindParam of a value inside an array I get fatal error non-object. $get_director_id->BindParam(':director_id', $check[3], PDO::PARAM_STR);
Bad_Advice_Cat
kenneth24, var_dump ($get_director_id)
kenneth24
how can I say, the value that resides in the index 3 of $check, bind to said parameter?
okay
morfin
that's i don't like things like Yii
it have static global things Yii::$app
as instance
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 next »