![]() |
anyone have a function for these
I'm trying to figure out how i can put these tasks into a function so i cant shorten my coding. here is what I've tried
Code:
function fetch($query,$field) { |
php Code:
You will have to edit it though so it works with your core. This is what I use anyways.. |
XD ;) Tanax ^^ when is the advanced programmer under your name coming ^^
i think it's time hihi :) |
The MYSQL_ASSOC constant in PHP is really just an integer that equates to one, a good chunk of that code you've written there could be greatly reduced with the use of a ternary operator. Unless I'm horribly mistaken ( I could be, I haven't tested this ) this should work.
PHP Code:
|
That looks ridiculously easier and better xD!
Though, I'm unsure about this: PHP Code:
PHP Code:
Thanks for the input on my function :-) |
Well on a var_dump of MYSQL_ASSOC it produced an integer of 1, so 0 and not filling it in at all would be the next best assumption ( Yes yes I know... Any kind of input is different from absolutely no input ) so maybe the what you've put up is probably the safer bet.
|
Ye, I've actually already implented this in my class.
Problem is: if I choose assoc as FALSE, then the function will be PHP Code:
Also, the 1 didn't work either. I had to do this: PHP Code:
Any ideas how to solve this? Btw: My code works as long as the assoc is true(which in most of my cases, if not all, is set to true). |
PHP Code:
|
Ahyee, I will try this asap!
|
yeah this could be pretty useful :)
|
| All times are GMT. The time now is 11:35 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0