[PHP] Searching and getting values out of array maps
Hi all, I'm kind of new with PHP. I work alot with another language called Lasso, reminds kind of PHP but not the same. I trying to search after a desired value within an array map (think you call it like that in PHP) and to get the value out as well. Is this possible in any way? Like to show you how it works in Lasso while I'm talking about. Could look like this: (find: 'blue'); ?> The result you get is #ff. Can you do something like this with PHP. Would help me alot if anyone could help me out a bit. Thanks in advance // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array_push in array maps
Need solve another case regarding array maps. Is it possible to insert more values like with array_push in arrays as bellow? $colors = array( 'red' => '#ff', 'green' => 'X00ff00', 'blue' => '#ff' ); Tanks in advance // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array_push in array maps
There's allways mutch to learn. :-) I'm very happy for all help I can get. I ran into another problem when trying to insert a value. I had no problem with: $test['something'] = '2500'; But when I want to have a value from a special column i a row the followint doesn't work: $test[$row[2]] = $row[5]; Or: $test[$row(2)] = $row[5]; Do I need to do some kind of concatenating? Thanks again // Jonas Den 06-05-03 15.46, skrev "Jochem Maas" <[EMAIL PROTECTED]>: > Jonas Rosling wrote: >> Need solve another case regarding array maps. Is it possible to insert more > > Jonas - in php we just call these things arrays (no 'map') - the array > datatype in php is a mash up (and we love it :-) of the 'oldschool' > numerically > indexed array and what is commonly known as a hash (or arraymap) - you can mix > numeric and associative indexes freely (that might seem odd and/or bad when > coming > from another language but it really is fantastic once you get your head round > it). > >> values like with array_push in arrays as bellow? >> >> $colors = array( >> 'red' => '#ff', >> 'green' => 'X00ff00', >> 'blue' => '#ff' >>); >> > > sure: > > $colors['grey'] = '#dedede'; > > the position of the 'inserted' (actually appended) is often not > important - if it is there are plenty of functions that allow you to > manipulate > arrays in more a complex fashion e.g. array_splice(). and all sorts of sorting > functions are also available e.g. asort(). > > check out the vast number of array related function and introductory texts > here: > > http://php.net/array > http://php.net/manual/language.types.array.php > >> Tanks in advance // Jonas >> > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting the array element
Hi again all, Here my next PHP newbie question. When I'm building an array as bellow. Is there any way I can get the left element out of the array? $salesperson = array(); while($row=mysql_fetch_array($result)) { $salesperson[$row[1]] = '0'; } If I write: echo $salesperson[$row[3]]; I get the value. I think you know what I mean?! Thanks // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Removing key and value
How's the best way to remove a key and it's value from an array? Like in the code bellow where I would like to remove AK and it's value. $salesperson = array( 'AK' => '1000', 'AT' => '1500', 'BT' => '2000' ); // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Echo a value from an arrays position
Is there any way to call for an element value in an array by the position? Like position 2 in the array and not the key name. // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo a value from an arrays position
Seem like your missunderstanding me. I'm not using an orignal array. I'm using an "map-array". $array = ('element' = 'value'); // Jonas Den 06-05-04 14.29, skrev "Jay Blanchard" <[EMAIL PROTECTED]>: > [snip] > Is there any way to call for an element value in an array by the > position? > Like position 2 in the array and not the key name. > [/snip] > > I hate to say this, but you really need to RTFM http://www.php.net/array > > To get a value from position 2 in an array you use $arrayName[1] (all > array elements start numbering at 0, unless you do something to the > array to change it). > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo a value from an arrays position
Nothing. // Jonas Den 06-05-04 14.40, skrev "Jay Blanchard" <[EMAIL PROTECTED]>: > [snip] > $colors = > array('white'=>'#ff','black'=>'#00','blue'=>'#ff'); > [/snip] > > What happens when you echo $colors[1]? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Looking up, deleting and inserting array values
Hi, I'm trying to do something that I know works when you build an array like a "map" with elements and values. One of the problems with this is that I only get out the values from the array from the last row. And the other problem is it looks like I can't delete desired values within the array. Is anyone able to tell me if it's really possible? And if it is, how? A snip of my code follows bellow: ($$row[3] contains single values that apear in the rows and are decleared higher up on the page) while($row=mysql_fetch_array($result)) { // If var based named as value in $row[3] if ($$row[3]) { // Splits keys and values foreach($$row[3] AS $key => $value) { // If $value is the same as $row[2] if ($value == $row[2]) { // Sum old value within the array with the new value $new_value = $value+$row[2]; // Delete the old value from the array unset($$row[3][$key]); // Insert the new value array_push($$row[3], $new_value); } } } } Thanks in advance // Jonas (Yes, I try to read the manual - but it's not allways good enough for me) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions - session_start()
Hi, I've been building a site with PHP 5 on my develop machine. I've been woring alot with session handling. For example I've been using session_start() now and then depending on where the user/vistor are or are doing. But now I've moved the site to a host server with PHP 4.3.8 and now I keep getting error messages all the time where I use session_start(). The error message looks like this: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/html/index.php:9) in /var/www/html/index.php on line 82 But I found out that if I put the tag in the absolute top of every page it seems to work. But then I need to do alot of changes on all the pages. Does anyone know if there's any workaround for this? Thanks in advance // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions - session_start()
Den 06-05-15 15.56, skrev "nicolas figaro" <[EMAIL PROTECTED]>: > Jonas Rosling a écrit : >> Hi, >> I've been building a site with PHP 5 on my develop machine. I've been woring >> alot with session handling. For example I've been using session_start() now >> and then depending on where the user/vistor are or are doing. >> But now I've moved the site to a host server with PHP 4.3.8 and now I keep >> getting error messages all the time where I use session_start(). The error >> message looks like this: >> >> Warning: session_start(): Cannot send session cookie - headers already sent >> by (output started at /var/www/html/index.php:9) in /var/www/html/index.php >> on line 82 >> >> But I found out that if I put the tag in the absolute top of every page it >> seems to work. But then I need to do alot of changes on all the pages. >> >> Does anyone know if there's any workaround for this? >> >> Thanks in advance // Jonas >> >> > check in your code if there is a print or echo somewhere. > *http://www.php.net/manual/en/function.session-start.php : > Note: * If you are using cookie-based sessions, you must call > *session_start()* before anything is outputted to the browser. > > N F Will take a look at the echos. It'll be some rewriting though. Thanks // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions - session_start()
Den 06-05-15 16.00, skrev "Thomas Munz" <[EMAIL PROTECTED]>: > put ob_start(); on the first line of your page > > on Monday 15 May 2006 15:53, Jonas Rosling wrote: >> Hi, >> I've been building a site with PHP 5 on my develop machine. I've been >> woring alot with session handling. For example I've been using >> session_start() now and then depending on where the user/vistor are or are >> doing. >> But now I've moved the site to a host server with PHP 4.3.8 and now I keep >> getting error messages all the time where I use session_start(). The error >> message looks like this: >> >> Warning: session_start(): Cannot send session cookie - headers already sent >> by (output started at /var/www/html/index.php:9) in /var/www/html/index.php >> on line 82 >> >> But I found out that if I put the tag in the absolute top of every page it >> seems to work. But then I need to do alot of changes on all the pages. >> >> Does anyone know if there's any workaround for this? >> >> Thanks in advance // Jonas ob_start(); doesn't change anything in my case. But thanks anyway. // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Converting characters
Hi, the PHP newbie is here again asking questions. Is there anyway in PHP to convert none international characters so the are displayed correct? In my case I have lots of data in the database with å,ä and ö. Thanks // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array name out of field value with data
Not so sure if I've tried to work this out before in this list. I'm trying to make an array name by a field/row value and assigning values to it. But I'm having some problems getting it to work. Is it possible to do this? And if, what am I doing wrong? Or is there any other way to do it? while($row=mysql_fetch_array($result)) { // Checking if variable/array is not declared if (!$$row[0]) { // Declaring an empty array by the value of sales person code $$row[0] = array(); // Current sales person code $code = $row[0]; // Putting the product name as a key and the price as a value in the array eval("\$code[\$row[1]] = \"$row[2]\";"); } } Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] Array name out of field value with data
-Ursprungligt meddelande- Från: nicolas figaro [mailto:[EMAIL PROTECTED] Skickat: den 22 maj 2006 11:50 Till: PHP List Ämne: Re: [PHP] Array name out of field value with data Jonas Rosling a écrit : > Not so sure if I've tried to work this out before in this list. > I'm trying to make an array name by a field/row value and assigning values > to it. But I'm having some problems getting it to work. > Is it possible to do this? And if, what am I doing wrong? Or is there any > other way to do it? > > while($row=mysql_fetch_array($result)) { > > // Checking if variable/array is not declared > if (!$$row[0]) { > > what do you want to check with the code above ? I don't think $$row[0] will give you anything good. as you're inside your while loop, $row should be declared, but the content of $row[0] depends on your request. you can check if $row[0] is set using "count $row"; but if you have an empty value in the first column, this will give you an empty string as result. try a print_r($row); after your "while". > // Declaring an empty array by the value of sales person code > $$row[0] = array(); > > I still don't understand why you're using $$row above. > // Current sales person code > $code = $row[0]; > > // Putting the product name as a key and the price as a value > in the array > eval("\$code[\$row[1]] = \"$row[2]\";"); > do you really want to erase the content of $code you just set above with the eval statement ? $my_array = array(); $my_array[$1] = $2; > } > > } > > Thanks > > Could you please describe a bit more what you'd like to do/set, so we can give you a better help ? N F -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The thing is that I want to name an array by the value in $row[0], sales person code. Once the array is declared it should not be declared again. The field never contains an empty value. After that I want to push in $row[1] as a key with $row[2] as a value, all related to the array name/sales person code. So if an array is declared that is equal as the value in the first field it should input a key and value. For example the array "AT" can contain 10 "collections" of data. Array ( [Product 1] => 1500 [Product 2] => 3000 [Product 3] => 500 ) etc, Hope I have made it a bit more easier to understand now. // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Group date with category
Anyone know any good why to group date in a recordset in any good way? As if you categorize it in columns. Like: Category 1 Row1 -> DataData Row2 -> DataData Row3 -> DataData Category 2 Row1 -> DataDate Row2 -> DataData Row3 -> DataData etc. Thanks in advance (as allways) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HELP - Clean and simple
I don't know if I'm explaining things in a difficult way or not. But I'm gonna try to explaine what I want very clean and simple. 1. I wan't to check if an array is decleard or not, refering to a value in a row/field ($row[0]) 2. If it's not decleard I declear it and assign it's name by the value from a row/field ($row[0]) - Further down I shell fill it with values like $arrayname[$row[2]] = $row[1] (arrayname based on $row[0]) 3. Else if it's decleard fill it with values like above. Hope someone understands me. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] HELP - Clean and simple
-Ursprungligt meddelande- Från: chris smith [mailto:[EMAIL PROTECTED] Skickat: den 22 maj 2006 15:49 Till: Jonas Rosling Kopia: PHP List Ämne: Re: [PHP] HELP - Clean and simple On 5/22/06, Jonas Rosling <[EMAIL PROTECTED]> wrote: > I don't know if I'm explaining things in a difficult way or not. But I'm > gonna try to explaine what I want very clean and simple. > > 1. I wan't to check if an array is decleard or not, refering to a value in a > row/field ($row[0]) > 2. If it's not decleard I declear it and assign it's name by the value from > a row/field ($row[0]) > - Further down I shell fill it with values like $arrayname[$row[2]] = > $row[1] (arrayname based on $row[0]) > 3. Else if it's decleard fill it with values like above. > > Hope someone understands me. And what code do you have so far? We're not going to write it for you. :-) Sorry! I've been digging with this for a while now so I don't think I have the best code left. But this is what I have for the moment: while($row=mysql_fetch_array($result)) { if (!$$row[0]) { $$row[0] = array(); $$row[0][$row[2]] = $row[1]; } else { $$row[0][$row[2]] = $row[1]; } } I've been trying with eval() a bit as well without any good result. // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] HELP - Clean and simple
-Ursprungligt meddelande- Från: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Rabin Vincent Skickat: den 22 maj 2006 16:26 Till: Jonas Rosling Kopia: PHP List Ämne: Re: [PHP] HELP - Clean and simple On 5/22/06, Jonas Rosling <[EMAIL PROTECTED]> wrote: > :-) Sorry! I've been digging with this for a while now so I don't think I > have the best code left. But this is what I have for the moment: > > while($row=mysql_fetch_array($result)) { > > if (!$$row[0]) { > > $$row[0] = array(); > > $$row[0][$row[2]] = $row[1]; > > } > > else { > > $$row[0][$row[2]] = $row[1]; > > } > > } > > I've been trying with eval() a bit as well without any good result. The above code will work properly if you surround the dynamic variable names by curly brackets: ${$row[0]}[$row[2]] = $row[1]; Rabin Thank you Rabin very much!!! It was just { } that was missing. Not so easy to know what to do to get some things to work when you're rather new at it. // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting an advanced foreach to work
I got the code as follows bellow. I'm having some problems to get it to work. Maybe some of you are able to help me a bit. First of all I got an array (salespersons) containing names of dynamic array names. For example it can contain Johan, Mark, Jenny, Bill etc. By calling for the possision in the array based on $count I'll get the name, and that's the name of another array. The problem is in the foreach with ( { } ). $count = 0; // Loopa så länge räknaren är mindre än storleken av arrayn $salespersons while ($count < count($salespersons)) { foreach (${$($salespersons[$count])} AS $key => $value) { echo htmlentities($key).' - '.$value; $count++; } } Anyone? Thaks // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] Getting an advanced foreach to work SOLVED
-Ursprungligt meddelande- Från: Jonas Rosling [mailto:[EMAIL PROTECTED] Skickat: den 23 maj 2006 10:06 Till: PHP List Ämne: [PHP] Getting an advanced foreach to work Should look like this: foreach (${$salespersons[$count]} AS $key => $value) { -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] Getting an advanced foreach to work
-Ursprungligt meddelande- Från: Chris [mailto:[EMAIL PROTECTED] Skickat: den 23 maj 2006 10:24 Till: Jonas Rosling Kopia: PHP List Ämne: Re: [PHP] Getting an advanced foreach to work > From a performance point of view you're much better off doing: > $sales_count = count($salespersons); > while($count < $sales_count) { > > The only reason to leave the count in the while statement is if you are > adding/removing to that array within the loop, otherwise chuck it in a > temp variable and use that instead. Thansk alot for the tip. // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] One works, but the other doesn't
I find this problem very strange. I've got two parts of code (allmost the same) in different TD's with vars and arrays (with same name) but it's only the top code that gives result. I've allso tryied to rename the vars and TD's in the bottom without any luck. The only vars/arrays that I haven't mind changing name on yet are some dynamic, like: ${$row[0]} = array(); ${$row[0]}[$row[1]] = $row[2]; But I think this could be the main cause, but I'm not really sure. If I delete the top code the bottom works. Any idéas any one? Thanks // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] One works, but the other doesn't
-Ursprungligt meddelande- Från: chris smith [mailto:[EMAIL PROTECTED] Skickat: den 23 maj 2006 13:38 Till: Jonas Rosling Kopia: PHP List Ämne: Re: [PHP] One works, but the other doesn't On 5/23/06, Jonas Rosling <[EMAIL PROTECTED]> wrote: > I find this problem very strange. I've got two parts of code (allmost the > same) in different TD's with vars and arrays (with same name) but it's only > the top code that gives result. I've allso tryied to rename the vars and > TD's in the bottom without any luck. The only vars/arrays that I haven't > mind changing name on yet are some dynamic, like: > > ${$row[0]} = array(); > > ${$row[0]}[$row[1]] = $row[2]; > > But I think this could be the main cause, but I'm not really sure. If I > delete the top code the bottom works. Any idéas any one? Without seeing the whole code involved, my guess is you're resetting the array with every loop. Guesses don't help but that's all we can do without seeing any actual code. Okej, all the code follows bellow. Remember that part 1 allways works. And they work all seperatly. '.htmlentities('Nyförsäljning per produkt: ').''; // Loopa så länge räknaren är mindre än storleken av arrayn $salespersons while ($count < $sales_count) { echo ''.htmlentities($salespersons[$count]).''; foreach (${$salespersons[$count]} AS $key => $value) { if ($key == '') { echo 'Okänd - '.$value.''; } else { echo htmlentities($key).' - '.$value.''; } } // Öka värdet på räknaren med 1 $count++; } // PART 2 // SELECT-sats som tar fram alla rader för nyförsäljning grupperat per produkt och säljare $sql = "SELECT c.salesperson_code, sl.description, SUM(sl.unit_price) AS totalt, COUNT(sl.description) AS antal FROM Sales_line AS sl JOIN Customer AS c WHERE sl.sell_to_customer_no = c.no AND (sl.status LIKE '4%' OR sl.status LIKE '5%' OR sl.status LIKE '6%') AND ( LEFT( sl.shipment_date, 2 ) = '$year' AND MID( sl.shipment_date, 4, 2 ) = '$month' ) AND RIGHT( sl.shipment_date, 2 ) = '$day' AND sl.quantity_invoiced = 1 GROUP BY sl.description, c.salesperson_code ORDER BY c.salesperson_code, sl.description"; // Utför SQL-satsen $result=mysql_query("$sql"); // Skapar en tom array för aktuella säljare $salespersons_g = array(); // Loppar igenom raderna while($row=mysql_fetch_array($result)) { // Kollar om arrayn för säljaren är deklarerad if (!${$row[0]}) { // Skapar array för säljaren ${$row[0]} = array(); // Lägger in värdena i arrayn - produkt och summering antal produkter ${$row[0]}[$row[1]] = $row[2]; // Lägger in säljaren i arrayn för aktuella sälljare array_push($salespersons_g, $row[0]); } // Om arrayn reda är deklarerad else { // Lägger in värdena i arrayn - produkt och summering antal produkter ${$row[0]}[$row[1]] = $row[2]; } } // Räknare $count_g = 0; // Storlek på arrayn innhållande säljare $sales_count_g = count($salespersons_g); echo ''.htmlentities('Godkänd nyförsäljning per produkt: ').''; // Loopa så länge räknaren är mindre än storleken av arrayn $salespersons while ($count_g < $sales_count_g) { echo ''.htmlentities($salespersons_g[$count_g]).''; foreach (${$salespersons_g[$count_g]} AS $key => $value) { if ($key == '') { echo 'Okänd - '.$value.''; } else { echo htmlentities($key).' - '.$value.''; } } // Öka värdet på räknaren med 1 $count_g++; } // Stänger databasen mysql_close ($link); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] One works, but the other doesn't
-Ursprungligt meddelande- Från: chris smith [mailto:[EMAIL PROTECTED] Skickat: den 23 maj 2006 14:13 Till: Jonas Rosling Kopia: PHP List Ämne: Re: [PHP] One works, but the other doesn't On 5/23/06, Jonas Rosling <[EMAIL PROTECTED]> wrote: > -Ursprungligt meddelande- > Från: chris smith [mailto:[EMAIL PROTECTED] > Skickat: den 23 maj 2006 13:38 > Till: Jonas Rosling > Kopia: PHP List > Ämne: Re: [PHP] One works, but the other doesn't > > > On 5/23/06, Jonas Rosling <[EMAIL PROTECTED]> wrote: > > I find this problem very strange. I've got two parts of code (allmost the > > same) in different TD's with vars and arrays (with same name) but it's > only > > the top code that gives result. I've allso tryied to rename the vars and > > TD's in the bottom without any luck. The only vars/arrays that I haven't > > mind changing name on yet are some dynamic, like: > > > > ${$row[0]} = array(); > > > > ${$row[0]}[$row[1]] = $row[2]; > > > > But I think this could be the main cause, but I'm not really sure. If I > > delete the top code the bottom works. Any idéas any one? > > Without seeing the whole code involved, my guess is you're resetting > the array with every loop. > > Guesses don't help but that's all we can do without seeing any actual code. > > Okej, all the code follows bellow. Remember that part 1 allways works. And > they work all seperatly. Man you do things the hard way. Why use all those variable variables? $my_data = array(); // Loppar igenom raderna while($row=mysql_fetch_assoc($result)) { $code = $row['salesperson_code']; if (!isset($my_data[$code])) { $my_data[$code] = array( 'description' => $row['description'], 'total' => $row['totalt'], 'antal' => $row['antal'] ); } else { $my_data[$code]['description'] = $row['description']; } } - Well, I'm kind of a newbie at this. So you think this will solve my problem? // Jonas -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: SV: [PHP] One works, but the other doesn't
-Ursprungligt meddelande- Från: Barry [mailto:[EMAIL PROTECTED] Skickat: den 23 maj 2006 14:24 Till: php-general@lists.php.net Ämne: Re: SV: [PHP] One works, but the other doesn't > - > Well, I'm kind of a newbie at this. So you think this will solve my problem? Why don't you test it? -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Okej, now I've tested it. I just changed the while part for the rows with the code I got from Chris. But just doing that doesn't make the same result as my code. Do I need to put in $my_data in the foreach part as well? // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Converting text strings [out of topic a bit]
Hi all, when my documents are using iso-8859-1 (Latin 1) as char set I have some problems with displaying my JS dialogs correct with none international characters (å, ä and ö). Allthough this hasen't got anything to do with PHP, does anyone have any good idéas on how to solve this? Normaly I use UTF-8 as char set, but in this case I need to use iso-8859-1 (Latin 1). Thanks // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] More about converting text strings
While I'm using UTF-8 as char set in my documents JavaScript messages works correct with none international characters. But not the PHP code with session_start(). I get the following error message: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/html/index3.php:1) in /var/www/html/index3.php on line 2 But if I set the char set to Latin 1 the error message doesn't show. But then the none internationl characters in the JavaScript messages doesn't show as they should. Thought I should explain my self a little bit more. // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] Converting text strings [out of topic a bit]
-Ursprungligt meddelande- Från: tedd [mailto:[EMAIL PROTECTED] Skickat: den 30 maj 2006 15:10 Till: Jonas Rosling; PHP List Ämne: Re: [PHP] Converting text strings [out of topic a bit] At 10:17 AM +0200 5/30/06, Jonas Rosling wrote: >Hi all, >when my documents are using iso-8859-1 (Latin 1) as char set I have some >problems with displaying my JS dialogs correct with none international >characters (å, ä and ö). Allthough this hasen't got anything to do with PHP, >does anyone have any good idéas on how to solve this? > >Normaly I use UTF-8 as char set, but in this case I need to use iso-8859-1 >(Latin 1). > >Thanks // Jonas Jonas: The iso-8859-1 char-set does include the characters you mention, so using either utf-8 or iso-8859-1 should work, but that isn't the problem with displaying the characters in html. As to how to solve the problem, I would look into using Unicode characters, such as à (HEX 00E5) OR look into using html characters such as à which both are å. Some references: http://www.w3.org/MarkUp/html3/latin1.html http://www.htmlhelp.com/reference/charset/ http://www.natural-innovations.com/wa/doc-charset.html I used both in displaying: http://www.xn--ovg.com/a2.php This example does not speak for all browsers -- I shall remove/replace soon. As for a look-up table for displaying these types of characters, I remember someone writing one for this list a few months ago -- you might look there. If you find it, please provide to me privately. Thanks. hth's tedd -- Thanks Tedd, but that doesn't seem to work in the JS code. // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] If value is odd or not
Hi all, is there any easy why to check if a value is odd or not? Thanks // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
SV: [PHP] If value is odd or not
-Ursprungligt meddelande- Fran: Eric Mol [mailto:[EMAIL PROTECTED] Skickat: den 2 juni 2006 15:34 Till: 'Jonas Rosling'; 'PHP List' Amne: RE: [PHP] If value is odd or not If ($var/2==round($var/2)){ // not odd }else{ // odd } Greetings, Eric Thanks (all)! -Oorspronkelijk bericht- Van: Jonas Rosling [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 2 juni 2006 15:32 Aan: PHP List Onderwerp: [PHP] If value is odd or not Hi all, is there any easy why to check if a value is odd or not? Thanks // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] substring with numric values
Is there any easy way to "trim" or pick out the none decimal values in a numric value? Like: 1,333 = 1 5,667 = 5 12,145 = 12 15,997 = 15 Thanks // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Skip first 4 array values
Is there any way you can skip for example the first 4 array values/posisions in an array no matter how many values it contains? Thanks // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Processing HTML in mail form
I've done the following code bellow for an e-mail form. But it handles the HTML tags as text. Is there anyway to get the HTML tags processed to form the mail? '. 'L-name: '.$lastname.''. 'Birth: '.$date_of_birth.''. 'Address: '.$post_address.''. 'Zip: '.$zip_code.''. 'City: '.$city.''. 'Phone: '.$phone.''. 'Mail: '.$mail.''. 'Desc: '.$description.''. 'Hair: '.$hairdresser.''. 'Make: '.$makeup; mail('[EMAIL PROTECTED]',$subject,$text,"From: $forname $lastname <$mail>"); ?> The mail looks like this when recived: F-namn: JL-namn: RBirth: 12Address: 34Zip: 56City: 78Phone: 90Mail: [EMAIL PROTECTED]Desc: NHair: hairMake: makeup Thanks in advance // Jonas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php