logs archiveIRC Archive / Freenode / #php / 2015 / October / 10 / 1
koolranch
oh nevermind
sorabji
should generally avoid using fetchAll
koolranch
just the fetch
Bad_Advice_Cat
koolranch, what is it that "turn it into a variable" ?
koolranch
line 12
function gets called and named $get_local
$local->fetch() will this work?
sorabji
i'm really confused as to what your question is
koolranch
Does the function handle the return correctly?
Bad_Advice_Cat
koolranch, what is the source to the get_local_posts() function?
sorabji
while($row = $local->fetch()) {...}
         

koolranch
sorry if I'm confusing yall
Bad_Advice_Cat
(Action) pokes OmOiYuMe.
OmOiYuMe
sorry, was talking over the phone
the thing is, even in mysql_query should work, i dunno why im not reciving the correct value, if i execute the query in pma i get the correct result
Bad_Advice_Cat
OmOiYuMe, oh I wanted to know what is it that you do not know about PDO. -- I was telling you the similarities between the two code. The update will be simple.
NoiseEee
OmOiYuMe: then i guess the values aren't what you think they are in the script
OmOiYuMe
got it
forgot to fetch the array
Bad_Advice_Cat
OmOiYuMe, you should be var_dump()-ing $query2
OmOiYuMe, let's make this 1 improvement to the code.
OmOiYuMe, create a new blank PHP file. Name it test.php
OmOiYuMe
just a second
koolranch
My question is can I use the fetch() even though it's not within the function?
OmOiYuMe
im trying to convert the date from Y-m-d to d/m/Y
koolranch
Or do I put the fetech() in the function?
fetch()*
Bad_Advice_Cat
OmOiYuMe, and exactly 1 second to make that new blank PHP file! :D
koolranch, you can only use fetch() if you have the PDOStatement object.
var_dump() it to see if that is the PDOStatement object.
koolranch, I still want to see the source code of that PHP function on line 12 you were asking about.
koolranch
Bad_Advice_Cat: https://bpaste.net/show/2f013486eb56 this was the code I posted
Only thing I changed was the foreach to while
Bad_Advice_Cat
koolranch, not that code. The source to: get_local_posts()
Oh actually
that is it
this is recursion
koolranch
XD
Bad_Advice_Cat
Wait, nto recursion
koolranch, dammit, format the darn code -___-
popl
it does recurse
koolranch
sorry I copied and pasted from a larger file
Bad_Advice_Cat
koolranch, I see.
koolranch
Do you see what im trying to say though?
         

Bad_Advice_Cat
koolranch, cool. So you are NOT turning anything into a variable. You are just assigning a variable the Return value.
koolranch
yes
Bad_Advice_Cat
koolranch, thought you were talking about objects.
koolranch
but does the fetch() need to be in the function?
or can it be like it is
Bad_Advice_Cat
koolranch, the answer is Yes you can.
larsi
And so I cry sometimes when I'm lying in bed
heyayaya
koolranch
Yes I can?
wut
Bad_Advice_Cat
$get_posts is the PDOStatement object.
koolranch
yes
Bad_Advice_Cat
You returned this object to: $get_local
That is the same "Instance" of the PDOStatement object.
javalover
Bad_Advice_Cat I love you :D
koolranch
so it will act the same
javalover
koolranch same :D
Bad_Advice_Cat
What is next? You may continue using the functionalities of the PDOStatement object. Such as: get_local->fetch(*put your fetch option here);
koolranch
But should I keep it like that or put the actual fetch() in the function itself
Bad_Advice_Cat
That depends.
(Action) wonders if koolranch watches Naruto animes.
koolranch
Depends on?
nope I dont
Bad_Advice_Cat
koolranch, that depends on the intention of your code. The reasoning for why you would return the object in the first place.
koolranch
Outlaw Star is a good anime doe
Bad_Advice_Cat
Damn. I never going to get to use this coool ninja anology -___-
koolranch
samurai champloo
BUT
the intention of this code is to pull posts from a selected range
so handling multiple rows
and then displaying that information to the user
like a forum
Sammitch
(Action) marks down Bad_Advice_Cat as "confirmed narutard".
Sigfrid
Someone here has experience working with the SDK Infusionsoft Api?
sorabji
Sigfrid: you'll want to check whatever documentation/help they provide
Sigfrid
I have a problem with the official SDK when I try to connect to a sandbox ...
sorabji
right, so you'll want to check with them
Bad_Advice_Cat
lol Sammitch.
Sigfrid
thanks...
Bad_Advice_Cat
koolranch, Objects in PHP works like this: http://uploadpie.com/YxqVV Notice the number I placed next to each object.
chizbang
My app is such a mess :( I thought i was doing well
Serves me right!
http://pastebin.com/T0587ncz
sorabji
chizbang: that is a mess
chizbang
Yup... What can I do to improve it?
sorabji
start by passing the FB and PDO dependencies into the constructor rather than building them there
Bad_Advice_Cat
koolranch, oops. I forgot this other object: http://uploadpie.com/OlM8Y
chizbang
Yeah thatd be a good start
sorabji
and don't call session_start in a constructor, that's strange
NoiseEee
lets go blue jays
chizbang
Right
What about database queries...? The way I call it right now, the only way id be able to echo out an error for a query would be to call the $fail function
which I wont be able to do within another function like isOrganisationValid()
Bad_Advice_Cat
(Action) wonders if OmOiYuMe made that new PHP file yet.
chizbang
What do I do in this instance?
sorabji
one thing at a time chizbang
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 next »