> From: Paul Halliday [paul.halli...@gmail.com]
> Sent: 24 October 2012 18:38
> To: PHP-General
> Subject: [PHP] Array help.
>
> $groupMappings = array('40' =>'A','41' =>'B','1' =>'C');
>
> $ocTest = explode(".", $ip);
> $groupKeys = array_keys($groupMappings);
> $groupTest = arra
On Wed, Oct 24, 2012 at 2:40 PM, Samuel Lopes Grigolato
wrote:
> Could you try changing this:
>
> if($groupTest != FALSE) {
>
> to this:
>
> if($groupTest !== FALSE) {
>
> ?
Hah. Perfect! Thanks.
>
> -Mensagem original-
> De: Paul Halliday [mailto:paul.halli...@gmail.com]
> Enviada em: q
On Jul 30, 2010, at 3:03 PM, Paul Halliday wrote:
>>
>> Paul-
>>
>> Why are those values not defaulted to 0 in the database?
>>
>> Regards,
>>
>> -Josh
>>
>>
>
> They are defaulted, the query is grouping:
>
> select count(status) as count, status from table group by status
On Fri, Jul 30, 2010 at 3:44 PM, Joshua Kehn wrote:
>
> On Jul 30, 2010, at 2:36 PM, Paul Halliday wrote:
>
>> I have a query that may not always return a result for a value, I need
>> to reflect this with a "0". I am trying to overcome this by doing this
>> (the keys are ID's):
>>
>> while ($row
On Jul 30, 2010, at 2:36 PM, Paul Halliday wrote:
> I have a query that may not always return a result for a value, I need
> to reflect this with a "0". I am trying to overcome this by doing this
> (the keys are ID's):
>
> while ($row = mysql_fetch_row($statusQuery)) {
>
>$cat =
> arra
Hey!
Thanks Stut, Tijnema.
I'll test out the ideas you guys contributed to me.. after I finish a working
copy will ask you guys to give it a look over ;)
@Stut: The list is not in alphabetical order.. and 2, I have no idea of the
size of the file (for the regex suggestion) but I am guessing it
Well, you are using the file_get_contents function right now, what about a
loop that reads the file line by line, checks if the user matches, and stops
when found the right user?
it's an all in one loop :)
just like this:
$found = false;
$fp = fopen($file,"r");
while(!feof($fp) && $found == fals
Ryan A wrote:
Will be making two versions, one with a DB and one to work with the file
for the old school folks who dont want to convert their file and use
"new fangled" databases... some people its easier to just not argue or
try to convince...
and however stupid someone's opinion is, they are
Hey Stut,
Thanks for replying.
Will be making two versions, one with a DB and one to work with the file for
the old school folks who dont want to convert their file and use "new fangled"
databases... some people its easier to just not argue or try to convince...
and however stupid someone's opin
Ryan A wrote:
I have a login/password file with these kind of values:
user1:pass1
user2:pass2
cat:dog
love:hate
I have opened the file and put it into an array with this code:
(thanks to richard lynch from this list for idea and code snippets)
$file = file_get_contents('a.htpasswd');
preg_ma
Rob writes:
> Did you bother to initialize $table as an array() or are you another
> lazy slob of a programmer that expects the engine to read your mind
> (cluttered as that may be)?
Bingo.
You seem to have no trouble reading my mind, why can't php? :)
Years of perl programming has promoted a
Hello Fletcher,
Thursday, July 14, 2005, 11:33:36 PM, you wrote:
FM> while ($row = mysqli_fetch_assoc($result))
FM> $table[] = $row;
FM> but that generated this error;
FM> Fatal error: [] operator not supported for strings
The above WILL work providing that (1)
Did you bother to initialize $table as an array() or are you another
lazy slob of a programmer that expects the engine to read your mind
(cluttered as that may be)?
Cheers,
Rob.
On Thu, 2005-07-14 at 18:33, Fletcher Mattox wrote:
> How does one represent a MySQL table as a two dimensional array
>
> I'm running into the problem of not having a server that gives me database
> access or ability to use files to store my data ... Yeah, I know, it
> sucks.
If switching servers isn't an option, just pay for another one somewhere,
and then re-direct or something.
The time you save HAS to be worth
On Mon, 2005-03-14 at 18:07, Phil Neeb wrote:
> Greets,
> I'm running into the problem of not having a server that gives me database
> access or ability to use files to store my data ... Yeah, I know, it sucks.
> Anyway ... My page has a number of profiles about people involved with my
> organiz
[snip]
[2] => Array(
[0] => Array(
[0] => {textlinks 0_15}
[1] => {textlinks 16_30}
)
[1] => Array(
[0] => 0_15
[1] => 16_30
)
)
As you can
>> > imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" =>
>> > "bkgrnd-positive.gif", "3" => "bkgrnd-negative.gif");
>>
>> You got it...
>>
>> imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" =>
>> "bkgrnd-positive.gif",
>> "3" => "bkgrnd-negative.gif");
>> imgNeeded = table['field'];
>> imgName =
> > imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" =>
> > "bkgrnd-positive.gif", "3" => "bkgrnd-negative.gif");
>
> You got it...
>
> imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" => "bkgrnd-positive.gif",
> "3" => "bkgrnd-negative.gif");
> imgNeeded = table['field'];
> imgName = ???
>
Robb Kerr wrote:
> On Fri, 23 Jul 2004 14:21:42 -0700 (PDT), Matthew Sims wrote:
>
>> imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" =>
>> "bkgrnd-positive.gif", "3" => "bkgrnd-negative.gif");
>
> You got it...
>
> imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" =>
> "bkgrnd-positive.gif",
On Fri, 23 Jul 2004 14:21:42 -0700 (PDT), Matthew Sims wrote:
> imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" =>
> "bkgrnd-positive.gif", "3" => "bkgrnd-negative.gif");
You got it...
imgBkgrnd = array("1"=> "bkgrnd-default.gif", "2" => "bkgrnd-positive.gif",
"3" => "bkgrnd-negative.gif");
im
> I've got a field in my database that contains a single numerical character
> ("1" or "2" or "3", etc.). I need to load a different background image in
> one cell of a table depending upon what the number the field contains.
> What's the easy syntax for associating entries in the field ("1" or "2
You can either hard code the associations, with something like a
swtich statement, or i suppose loop thru one array, adding a key value
pair of the numbers => background images. Or, you could create a
table called Backgrounds, give them an id which you store in the
existing field of your db, and u
> I've got a field in my database that contains a single numerical character
> ("1" or "2" or "3", etc.). I need to load a different background image in
> one cell of a table depending upon what the number the field contains.
> What's the easy syntax for associating entries in the field ("1" or "2"
>because in reality I don't have just these 4 fields
> but 43 fields in one table that have to be taken. "Select *..." seems a
much
> easier way to get it
>
you have 43 fields in 1 table? if you are seriously considering offering
hosting packages, then i'm guessing your wanting to be half prof
On Monday 28 July 2003 10:19, Ryan A wrote:
> After asking for help on the list Skate gave me the following code as an
> example:
> **
> $n = 0;
> $result = mysql_query( "SELECT id, title, text, date FROM news ORDER BY
> date DESC" );
> while ($rows = mysql_fetch_array($result)) {
>
> $mysql query1
> result
> array[cityid][cityname]
>
> mysql query2
> result
> array[cityid][cityname]
>
> now what i want to do is kick out any doubles in my array
> and resort them alphebetically by cityname ?!
It's difficult to answer this question without knowing more about the
cont
John, et al --
...and then John Fishworld said...
%
% can someone give me a bit of help / walthrough the following for me !
Let's see if I can help.
% this first bits is okay
% $mysql query1
% result
% array[cityid][cityname]
%
% mysql query2
% result
% array[cityid][cityname]
Are CityIDs un
}
}
- Original Message -
From: "Jack Dempsey" <[EMAIL PROTECTED]>
To: "PHP Lists" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 10:59 PM
Subject: RE: [PHP] Array Help
| you can just kept adding []'s
|
| $va
you can just kept adding []'s
$var["category"]["subcategory"]["Item"] = "url";
-Original Message-
From: Brian V Bonini [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 27, 2001 4:56 PM
To: PHP Lists
Subject: [PHP] Array Help
How can I access the inner most info in this array?
Ie, Ite
PROTECTED]]
Sent: Friday, November 09, 2001 10:06 AM
To: Php-General
Subject: RE: [PHP] Array HELP PLEASE
Or maybe not. :-) Although I got both rows displaying, they're actually two
long to fit comfortably (w/o horizontally scrolling). So... I'd like to
flip the axis of the table, so m
> -Original Message-----
> From: René Fournier [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 08, 2001 3:39 PM
> To: Php-General
> Subject: RE: [PHP] Array HELP PLEASE
>
>
> Oops, guess I posted too soon. Just figured out the problem myself (use a
> do/while...).
read this page a little closer!
http://www.php.net/manual/en/function.mysql-fetch-array.php
the mysql_fetch_array(); does not pull all the results in one big array.
it IS only a single row of data.
try this out, it should do what you are looking to do.
$results = mysql_query("SELECT * FROM mod
Oops, guess I posted too soon. Just figured out the problem myself (use a
do/while...). Thanks anyways.
> -Original Message-
> From: René Fournier [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, November 08, 2001 3:25 PM
> To: Php-General
> Subject: [PHP] Array HELP PLEASE
>
>
> (Before yo
Thanks
Peter
"Jason Stechschulte" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Fri, May 04, 2001 at 01:19:57PM +0100, peter.beal wrote:
> > I'm trying to debug some software that I downloaded from the web.
> > It seems to work fine most of the time howev
On Fri, May 04, 2001 at 01:19:57PM +0100, peter.beal wrote:
> I'm trying to debug some software that I downloaded from the web.
> It seems to work fine most of the time however it occasionally crashed with
> database errors.
> When I look at the code it has a lot of array references that i don't
>
On 15-Mar-01 Chris wrote:
> Hi,
> Is there a way to do an array_pop with php3?
>
>
unset($dirs[sizeof($dirs)-1]); // php4 array_pop();
Regards,
--
Don Read [EMAIL PROTECTED]
-- If you are going to sin, sin against God, not the bureaucracy.
> > > Hi,
> > Is there a way to do an array_pop with php3?
Here's some PHP 3 compatable code that works the same as array_pop:
function _array_pop(&$stack) {
$arrSize = count($stack);
$x = 1;
while(list($key, $val) = each($stack)) {
if($x < count($stack)) {
$tmpArr[] = $
On Thu, 15 Mar 2001 10:56, Chris wrote:
> > Hi,
> Is there a way to do an array_pop with php3?
Off the top of my head:
use count to get the number of elements in the array
grab element(count - 1) as the popped value
Then (maybe)
unset(element[count-1])
may work; if not you might have to play
Addressed to: <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from <[EMAIL PROTECTED]> Fri, 23 Feb 2001 12:20:12 -0500
>
> I've tried and tried and tried ;-)
>
> I have this array;
>
> $bikes = array(
> "Road" => array(
> "Trek" => array(
> "Trek 5200" =>
Thanks. Didn't see that myself.
Thanks for the help
Chris
At 10:28 AM 1/18/01, [EMAIL PROTECTED] wrote:
>Addressed to: CDitty <[EMAIL PROTECTED]>
> [EMAIL PROTECTED]
>
>** Reply to note from CDitty <[EMAIL PROTECTED]> Thu, 18 Jan 2001
>06:58:22 -0600
>
>I see someone else has an
c: <[EMAIL PROTECTED]>
Sent: Thursday, January 18, 2001 10:40 AM
Subject: Re: [PHP] Array help needed
> I wouldn't call it a php standard.
>
> I personally feel that readability is far more important than following
> anything that 'appears' to be standard. I use a fo
I wouldn't call it a php standard.
I personally feel that readability is far more important than following
anything that 'appears' to be standard. I use a format such as this for
everything I name: If one word, lowercase, if more than one word:
$userSelectedDate or displayCalendar(). So basica
Addressed to: CDitty <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from CDitty <[EMAIL PROTECTED]> Thu, 18 Jan 2001 06:58:22 -0600
I see someone else has another suggestion that might be better, using
array_count(). You learn something new every day, which is why I watch
Addressed to: CDitty <[EMAIL PROTECTED]>
[EMAIL PROTECTED]
** Reply to note from CDitty <[EMAIL PROTECTED]> Thu, 18 Jan 2001 05:40:13 -0600
>
> Hello all,
>
> I have 6 numbers that are in an array. I need to know how many times
> each number shows up in that array.
>
> ex Numbe
44 matches
Mail list logo