Page 4 of 5
Re: BetterPHP PHP Library
Posted: Sun May 15, 2011 6:43 pm
by Kamal
jacek wrote:Yes they are mine
They are also the ones in the git if you bothered to look !
I did see the ones in the git, but there are more in the zip i posted
Re: BetterPHP PHP Library
Posted: Sun May 15, 2011 6:45 pm
by jacek
Yeah, they are things I decided were less useful
Re: BetterPHP PHP Library
Posted: Wed May 18, 2011 9:48 pm
by Tino
Alright, so other things have come up, which definitely take priority over this. Sorry guys, you'll have to wait a tad longer
Re: BetterPHP PHP Library
Posted: Wed May 18, 2011 10:12 pm
by jacek
No rush
Go do more interesting things.
Re: BetterPHP PHP Library
Posted: Sun May 22, 2011 10:39 pm
by Dominion
What kind of things are you looking for? My library has a fair few security check functions, but all the more useful functions I use tend to be site specific. Would I be able to add some JS functions?
btw - Js functions != using Jquery
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 8:03 am
by jacek
Anything that would be useful can be added
And I think JavaScript would have to be a different project, mostly because of the name.
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 11:20 am
by bowersbros
well, mine will be continued upon arrival of a mySQL class
No rush tino
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 11:58 am
by jacek
bowersbros wrote:well, mine will be continued upon arrival of a mySQL class
No rush tino
I added a basic one
you should be able to use it to make your thing, and Tino can add some more complicated things to my mysql class if he feels like it
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 12:35 pm
by bowersbros
how would i use the mysql class within? Like.. for the mysql server connection?
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 12:40 pm
by jacek
it would be a global variable so...
class user {
public function get_names(){
global $mysql;
$mysql->query('SELECT `name` FROM `users`');
$mysql->fetch_array($names);
return $names;
}
}
Go with that for now
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 12:51 pm
by bowersbros
Hmm, say if i have two arrays, both setup as single dimensions how can i fuse them together?
So for example, I have these:
$array1 = array('users','table1','table2','table3');
$array2 = array('username','password','blah','blah');
How could i make it so that the $array 1 values were the keys, and the $array2 values were the values?
(This is to be used for the validation thing, to check for unique values in a mysql field(s))
/edit.
Or should i do it where it is one multidimensional arrays so they can check multiple things within 1 array.
Eg.
array('users' => array('username','email))
Like that.
However, i dont know how to do either atm (spend 4 hours solid literature revision, my brain hurts!)
which method is best?
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 1:14 pm
by jacek
bowersbros wrote:How could i make it so that the $array 1 values were the keys, and the $array2 values were the values?
array_combine() will do that for you
bowersbros wrote:Or should i do it where it is one multidimensional arrays so they can check multiple things within 1 array.
Entirely up to you
do it the best way
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 1:20 pm
by bowersbros
jacek wrote:bowersbros wrote:How could i make it so that the $array 1 values were the keys, and the $array2 values were the values?
array_combine() will do that for you
bowersbros wrote:Or should i do it where it is one multidimensional arrays so they can check multiple things within 1 array.
Entirely up to you
do it the best way
there is an is_array() function, is there something that checks for multidimensional array? if so, i could incorporate both
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 1:27 pm
by unemployment
Where will these library files be accessible from? Surely, just posting them in this thread is terribly inefficient.
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 1:30 pm
by bowersbros
unemployment wrote:Where will these library files be accessible from? Surely, just posting them in this thread is terribly inefficient.
read first post
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 1:44 pm
by bowersbros
got it, apparently:
if (count($array) == count($array, COUNT_RECURSIVE)) { echo 'array is not multidimensional'; } else { echo 'array is multidimensional'; }
works
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 1:47 pm
by jacek
Oh I see what you wanted to do now, well you seem to have found a good enough solution
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 1:47 pm
by bowersbros
jacek wrote:Oh I see what you wanted to do now, well you seem to have found a good enough solution
is that the best way? or is there like a hidden function that is obscure yet does this?
if not. they should make one
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 1:53 pm
by jacek
bowersbros wrote:is that the best way? or is there like a hidden function that is obscure yet does this?
I don't know of a way to do that other than what you did.
bowersbros wrote:if not. they should make one
Or we should for the library
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 1:58 pm
by bowersbros
that would require a new functions.inc.php file then
If you want to start it, uplaod it and just include:
function is_multi(array $array){
if(count($array) == count($array, COUNT_RECURSIVE)) return false;
}
Re: BetterPHP PHP Library
Posted: Mon May 23, 2011 2:05 pm
by jacek
^^ done