Re: [PHP] Re: Simple PHP setting arrays with keys question

2007-07-10 Thread Fredrik Thunberg
Dan skrev: Oh yeah, the problem isn't that I'm using - instead of =. Well that was a problem but I fixed that and it's still not working. - Dan Dan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm having a little problem assigning a value to an array which has a key. It's

Re: [PHP] Re: Simple PHP setting arrays with keys question

2007-07-10 Thread Fredrik Thunberg
Jim Lucas wrote: Fredrik Thunberg wrote: Dan skrev: Oh yeah, the problem isn't that I'm using - instead of =. Well that was a problem but I fixed that and it's still not working. - Dan Dan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm having a little problem assigning

Re: [PHP] A very strange loop!

2007-07-09 Thread Fredrik Thunberg
For exactly the same reason as for( $i = 0; $i 10; $i++) produces 0-9 It loops whule $i is lesser than 'Z' When $i becomes 'Z' it stops and doesn't echo But i guess you're having trouble with (note the '='): for ($i = 'A'; $i = 'Z'; $i++) { echo $i . ' '; } This might produce a wierd

Re: [PHP] A very strange loop!

2007-07-09 Thread Fredrik Thunberg
No, that won't work Either use != 'AA' or for( $i = ord('A'); $i = ord('Z'); $i++) { echo chr( $i ) . ' '; } Jason skrev: Because you need $i= 'Z' to get Z included as well. J At 08:49 09/07/2007, Xell Zhang wrote: Hello all, I met a very strange problem today. Take a look at the codes

Re: [PHP] Re: spliting the elements in array

2007-07-04 Thread Fredrik Thunberg
Stut skrev: sivasakthi wrote: Thanks for your response.. Actually i have the collections of strings like, $not_quite_an_array = 'squid %tu %tl %mt %A test %st.%hs %a %m %tu %th %Hs %Ss test1 %tv %tr %Hs.%Ss %mt'; from that i need to split name of each line.. $names = array(); foreach

Re: [PHP] Date Calculation Help

2007-07-02 Thread Fredrik Thunberg
$q = ceil( month / 4 ); -- /Thunis The ships hung in the sky in much the same way that bricks don't. --The Hitchikers Guide to the Galaxy revDAVE skrev: I have segmented a year into four quarters (3 months each) nowdate = the month of the chosen date (ex: 5-30-07 = month 5) Q: What is the

Re: [PHP] Date Calculation Help

2007-07-02 Thread Fredrik Thunberg
of course ceil( month / 3 ); -- /Thunis Don't panic. --The Hitchikers Guide to the Galaxy Fredrik Thunberg skrev: $q = ceil( month / 4 ); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] shuffle or mt_rand

2007-06-29 Thread Fredrik Thunberg
snip Just did a quick benchmark for 10.000 hands (making a full deck on your code, 23.5 players): Microtime difference: Ryan's code:15.725826978683 Tijnema's code:0.40006709098816 Unique decks out of 1: Ryan's code:1 Tijnema's code:1 When making a full deck my code is 40 times

Re: [PHP] Date

2007-06-20 Thread Fredrik Thunberg
Ron Piggott skrev: How do I break $start_date into 3 variables --- 4 digit year, 2 digit month and 2 digit day? $start_year = ; $start_month = ; $start_day = ; Of course depending on what $start_date looks like, but this should work most of the time: $timestamp = strtotime( $start_date

Re: [PHP] Limit query results

2007-05-04 Thread Fredrik Thunberg
GROUP BY whatever_id_you_want in the SQL Dan Shirah skrev: Good Morning everyone. In the below code I am pulling records from two tables. the records are tied together by a common key in a 3rd table. Everything works correctly down to the $result. // Connect to the database $connection =

Re: [PHP] Selecting a special row from the database

2007-05-04 Thread Fredrik Thunberg
Edward Kay skrev: -Original Message- From: Marcelo Wolfgang [mailto:[EMAIL PROTECTED] Sent: 04 May 2007 14:37 To: php-general@lists.php.net Subject: [PHP] Selecting a special row from the database Hi all, I'm building a news display page for a website, and since the user has 2

Re: [PHP] Split string

2007-05-02 Thread Fredrik Thunberg
Lester Caine skrev: Can someone with a few more working grey cells prompt me with the correct command to split a string. The entered data is names, but I need to split the text up to the first space or comma into one string, and the rest of the string into a second. It's the 'first either

[Fwd: Re: [PHP] a little math]

2007-04-20 Thread Fredrik Thunberg
Don't know your problem but: if $totalTime is total length in seconds $minutes = floor($totalTime / 60); $seconds = $totalTime % 60; /Fredrik Sebe skrev: maybe someone can figure why sometimes i get negative values for seconds.. $job['finished'] and $job['finished'] are both unix

Re: [PHP] UPDATE and redirect

2007-04-11 Thread Fredrik Thunberg
marcelo Wolfgang skrev: Hi all, I'm new to this list and new to php programming so sorry if I do something wrong here :) Ok, now to my problem. I've created a query to update a mysql db, and it isn't working, and it's not throwing me any errors, so I need some help to figure out what's

Re: [PHP] Setting printf results as a variable

2007-02-09 Thread Fredrik Thunberg
Stephen wrote: Hi list, I'm trying to make a script which requires that I perform a printf() formatting on a string, but instead of outputting the result I need to set the result as a variable to write to a file. Can any one advise me on how to do this? or if it's even possible? Kind

Re: [PHP] convert date to reversed date

2007-01-30 Thread Fredrik Thunberg
Reinhart Viane skrev: Is this a good way to convert 01/02/2007 to 20070201 $value='01/02/2007'; list($day, $month, $year) = split('[/.-]', $value); $filename=$year.''.$month.''.$day; It does work but i would like to verify if there are no better, more logical ways to do this. Thanks

Re: [PHP] convert date to reversed date

2007-01-30 Thread Fredrik Thunberg
date(Ymd, strotodate( $value )); Of course I mean: date( Ydm, strtodate( $value )); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Forms and destroying values

2007-01-12 Thread Fredrik Thunberg
It doesn't help to reset any values. The form data is being resent by the browser itself, just if the user presses the submit button again with the same data. What you could do is mabye use a session to see if the particular user has sent form data before. /Fredrik Thunberg Beauford skrev

Re: [PHP] Sort Array not working

2007-01-09 Thread Fredrik Thunberg
Hi sort returns a bool, the sorted array passed by reference. So try: $result = sort( $array ); //Now $array is sorted print_r( $array ); /Fredrik Thunberg Kevin Murphy skrev: I'm having trouble sorting an array. When I do, it empties the array for some reason. Take the following code

Re: [PHP] EZ array problem - What's wrong with my brain?

2006-12-01 Thread Fredrik Thunberg
Try $try = $var[1.2]; If your array looks like the one below then there is no $var[0] and therefore you get NULL /Thunis Brian Dunning skrev: That seems right to me too - but everything I try returns NULL. I set $try=$var[0], and $try ends up being null; print_r($try) gives blank. I even

[PHP] GD - Problem writing text

2006-11-23 Thread Fredrik Thunberg
one. Can this be the problem? Cheers /Fredrik Thunberg [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php