Re: [PHP] String format problem
In fact, this is a poor example since the difference gets larger with longer string and more arguments. When you use dots, the interpreter has to actually concatenate the string, looking for memory to do so and freeing it up afterwards. This takes time. With commas, each argument is sent to the output stream as soon as it is found, no further processing is needed in between. I have been wondering about this topic for a few months now, so thanks for this fascinating explanation. Is this the only difference between using . and , as concatenation operators Then the single vs. double quotes: echo 'uno ' , ' dos ' , ' tres ': 0.94 echo uno , dos , tres : 6.76 Notice that when variables are involved, the difference in between echoing with arguments separated with commas and separated with dots is more than 9 times faster for the commas.Using double quotes with variable expansion is almost 4 times slower than the commas, but is still faster than concatenating them externaly with dots. Using heredoc-style strings is not so bad compared to double quotes. Never heard of heredoc before. What is it for? I have read http://uk.php.net/types.string and can only imagine that it is for laying out complex or long strings more clearly So, if you are sending out the rule would be: Use echo, not print. Separate arguments with commas. Now, if you are not using echo, for example, concatenating to a variable, the best is to use variable expansion inside double quoted or heredoc strings. Concatenating with dots is more than twice as slow. Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array merge problem
i have the array with the following structure : Array ( [19] = 20.00 [25] = 20.00 [7] = 30.00 [17] = 30.00 ) when i merge a field to it using array_merge it returns that : Array ( [0] = 20.00 [1] = 20.00 [2] = 30.00 [3] = 30.00 [4] = 200.00 ) how can i merge the field without losing the original keys ? can anyone help me with that plz thanks in advance -- Ahmed Abdel-Aliem Web Developer www.SafariStudio.net +20101108551 registered Linux user number 382789 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID based on position?
Auugh!! Why would you want to do this? You're flying in the face of relational database theory and practice. Position of a record in the table is, or should be irrelevant. Agreed - position is a notional concept. The data is stored physically in some sort of order, but what order that is is the database's business, not yours. It could be subject to change when upgrading, and it is very likely to differ on different platforms or RDBMSs. You should also be aware that unless you use an order by clause in your select statement, you don't have a guarantee that all RDBMSs will return the records in the same row. I don't know exactly what you want to do, perhaps you can provide more details? What if you have twenty thousand records, or two hundred, and the 45th record in the table is deleted? Fetching an ID from anything beyond that record, based on the order of insertion (position), is instantly broken. Please rethink what you want to do, and if you are not familiar with relational databases read some of the excellent tutorials available on the 'Net about them and their design. It's pretty straightforward, common sense stuff -- but you can back yourself into an awkward corner. Regards - Miles At 07:54 PM 8/31/2005, Gustav Wiberg wrote: Hi there! Is there any function in PHP that gives an ID from a MySQL-db based on which position the record has in the table? Let's say, there's a table like this: 1. Record1 ID 33 2. Record2 ID 76 3. Record3 ID 100 If I know position 2, I want to get ID 76. Is the only way to loop through the recordset? /G @varupiraten.se -- 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] fread and fgets (network streams)
On the php.net you can read the following about fread: fread() reads up to length bytes from the file pointer referenced by handle. Reading stops when length bytes have been read, EOF (end of file) is reached, or (for network streams) when a packet becomes available, whichever comes first. Is this true with fgets also? The when a packet becomes available part that is. I´m guessing for network streams means when the handler is not a local file but a remote file, right? Why i´m i asking this? Well because i have a script wich now uses fread to get a remote file and would like to change this to fgets but i´m afraid i will bump into truble if i do since the part about waiting for a packed to become available sounds pretty important when dealing with remote files, right? Thanks! - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] array merge problem
manual snippets If you want to completely preserve the arrays and just want to append them to each other, use the + operator. ?php $array1 = array(); $array2 = array(1 = data); $result = $array1 + $array2; ? The numeric key will be preserved and thus the association remains. Array ( [1] = data ) /manual snippets Its actually on the same page as array_merge in array functions. -Original Message- From: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED] Sent: 01 September 2005 09:43 To: php-general@lists.php.net Subject: [PHP] array merge problem * This e-mail has been received by the Revenue Internet e-mail service. * i have the array with the following structure : Array ( [19] = 20.00 [25] = 20.00 [7] = 30.00 [17] = 30.00 ) when i merge a field to it using array_merge it returns that : Array ( [0] = 20.00 [1] = 20.00 [2] = 30.00 [3] = 30.00 [4] = 200.00 ) how can i merge the field without losing the original keys ? can anyone help me with that plz thanks in advance -- Ahmed Abdel-Aliem Web Developer www.SafariStudio.net +20101108551 registered Linux user number 382789 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Saturdays and Sundays
Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] String format problem
On 31 August 2005 16:56, [EMAIL PROTECTED] wrote: $varname = '$firstname $lastname told me to find the file in folder C:\newtext\'; echo $varname; Yields.. $firstname $lastname told me to find the file in folder C:\newtext\ Actually, that'll give you an error as well, since \' is also an escape sequence (to get a single quote into a single-quoted string!). Currently, \' and \\ are the only escape sequences recognized in a single-quoted string, although this may change with the advent of native Unicode in PHP 6. Bottom line: always double your backslashes, even in single-quoted strings, to be completely safe and future-proof. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help: Get the value of pi up to 200+ digits?
Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help: Get the value of pi up to 200+ digits?
Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Get the value of pi up to 200+ digits?
Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? I am fairly sure that you have to use BCMath for this: http://www.php.net/manual/en/ref.bc.php Give it a go and see what happens! :) Regards, Torgny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Get the value of pi up to 200+ digits?
but my server configure don't have bcmath enabled, is there any other way to do so? Torgny Bjers [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? I am fairly sure that you have to use BCMath for this: http://www.php.net/manual/en/ref.bc.php Give it a go and see what happens! :) Regards, Torgny -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Get the value of pi up to 200+ digits?
Wong HoWang schrieb: but my server configure don't have bcmath enabled, is there any other way to do so? Since the internal routines of PHP have limited precision, you these options: - Find a way to activate bcmath (not likely to happen on a shared hosting account) - Find an external program that you can install and use (if you have shared hosting an ssh, you can probably install a command line version of bcmath) - find a web service (http://de.php.net/soap) that solves the problem (perhaps kind of overkill) - DIY (do it yourself). Implement an arbitrary precision PI algorithm in PHP (or perhaps somebody has already done this). AllOLLi It's just sex, it's totally harmless. [Gabrielle on DH109] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Computers name?
Gustav Wiberg schrieb: Hi there! Is it possible to get (retrieve) the computername of the client? I just want the name for comparing... In PHP all you get from the client is in the predefines variables: http://de.php.net/manual/en/language.variables.predefined.php Perhaps these are of any help: http://de.php.net/manual/en/reserved.variables.php#reserved.variables.server If you cannnot find what you need in these (hint: print_r($GLOBALS);), your last resort might be JavaScript which runs in a sandbox, too, so don't bet on it. AllOlli Byers: What proof do you have? Bond: I got this! Byers: You're on the phone, Jimmy! [Lone Gunmen 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Computers name?
Gustav Wiberg schrieb: Hi there! Is it possible to get (retrieve) the computername of the client? I just want the name for comparing... In PHP all you get from the client is in the predefines variables: http://de.php.net/manual/en/language.variables.predefined.php Perhaps these are of any help: http://de.php.net/manual/en/reserved.variables.php#reserved.variables.server If you cannnot find what you need in these (hint: print_r($GLOBALS);), your last resort might be JavaScript which runs in a sandbox, too, so don't bet on it. AllOlli Byers: What proof do you have? Bond: I got this! Byers: You're on the phone, Jimmy! [Lone Gunmen 09] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String format problem
Wow! Fantastic rundown Satyam! Thanks for posting such a complete analysis. I had no idea that you could use commas instead of periods to join multiple strings much less do it without concatinating, that's very interesting. I don't think I've ever seen that used in any sample code before. I'm wondering if it's common enough that it'll stay around or if it'll become deprecated at some point (or is it new to PHP5? I havn't upgraded yet). I'd hate to start using it then have to go back and fix all my code when it gets cut. (Any thoughts/info anyone?) I feel somewhat vindicated now at my use of echo blah $something blah versus print 'blah ' . $something . ' blah', which is the standard used in the code I inherited. hah Anyway, thanks again Satyam for the rundown. It's greatly appreciated. -TG = = = Original message = = = [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] To elaborate on Philip's response (which is correct)... [] I've read never use double quotes unless you have to because it could potentially speed up PHP a little because it won't be trying to interpret every string. I once did some trials with thousand repetitions of segments of code with different alternatives, so let me go through all of them since I have the numbers anyway. The original was in Spanish so I'll just give the results. The question started with using echo or print and, as the manual says, echo is, indeed, faster: echo uno $f tres : 3.04 print uno $f tres : 3.70 The numbers after the colons are the execution times of one against the other for a lot of repetitions, anyhow, they should be read as relative to one another. Next, most people don't know that echo accepts multiple arguments separated by commas. Separating the arguments with commas is faster. echo 'uno ' . ' dos ' . ' tres ': 1.32 echo 'uno ' , ' dos ' , ' tres ': 0.94 In fact, this is a poor example since the difference gets larger with longer string and more arguments. When you use dots, the interpreter has to actually concatenate the string, looking for memory to do so and freeing it up afterwards. This takes time. With commas, each argument is sent to the output stream as soon as it is found, no further processing is needed in between. Then the single vs. double quotes: echo 'uno ' , ' dos ' , ' tres ': 0.94 echo uno , dos , tres : 6.76 Once again, these are relative times but it means using double quotes is 7 times slower than single quotes Several different alternatives with variables involved: echo 'uno ' . $f . ' tres ': 7.38 echo 'uno ' , $f , ' tres ': 0.80 echo uno $f tres : 3.04 echo EOT uno $f tres EOT: 3.29 Notice that when variables are involved, the difference in between echoing with arguments separated with commas and separated with dots is more than 9 times faster for the commas.Using double quotes with variable expansion is almost 4 times slower than the commas, but is still faster than concatenating them externaly with dots. Using heredoc-style strings is not so bad compared to double quotes. So, if you are sending out the rule would be: Use echo, not print. Separate arguments with commas. Now, if you are not using echo, for example, concatenating to a variable, the best is to use variable expansion inside double quoted or heredoc strings. Concatenating with dots is more than twice as slow. Satyam ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Saturdays and Sundays
Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. Hi Shaun, Not sure if there's a graceful PHP solution (there probably is, but can't think of one, myself, right at this moment) but it sounds like what you might need is a calendar table in your database. This is a common approach to solving a number of date-related issues, of the type you're asking about. A typical structure might be Recid (int autoincrement) Date (datetime) Year (int) Month (int) Day (int) Day_name (varchar) Month_name (varchar) Etc.. A record for today's date would then look like: 1, '2005-09-01', 2005, 9, 1, 'Thursday', 'September' There are a number of other fields you could add, depending on your needs (financial_quarter, for example, if your site is a business application, week_num and so on) You would then write a routine that would populate the table with appropriate values for any given time period (10 years into the future, for example) and thus would be able to very simply perform operations like: SELECT COUNT(*) FROM date_info WHERE year=2005 and month=9 and (day_name='Saturday' or day_name='Sunday') Again, there may be a better solution in PHP, but any date-intensive application would probably benefit from the above approach. In particular, it becomes very useful when you use the recid value for the date from your calendar table in application data tables instead of the actual date, allowing you to perform very flexible queries where you might be interested in sales results for all the Thursdays in every September for the last 5 years, etc. Regards, Murray --- Lost in thought... http://www.planetthoughtful.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Get the value of pi up to 200+ digits?
http://us3.php.net/manual/en/ini.core.php#ini.precision precision sets the number of significant digits, *NOT* the number of digits displayed after the decimal point. If you want to get pi out to 16 decimal places you need a precision of *17* because the beginning 3 is a significant digit. Your code does exactly this, displaying pi with 15 decimal places. Jordan On Sep 1, 2005, at 8:06 AM, Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- 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
Re: [PHP] Help: Get the value of pi up to 200+ digits?
Dear Jordan, I know what you mean. But you may try this one and you will know: ?php ini_set('precision',200); echo pi(); ? the result is the same as 16!!! So that's why I ask this question! I am not stupid like that! Please help, thx! Jordan Miller [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] http://us3.php.net/manual/en/ini.core.php#ini.precision precision sets the number of significant digits, *NOT* the number of digits displayed after the decimal point. If you want to get pi out to 16 decimal places you need a precision of *17* because the beginning 3 is a significant digit. Your code does exactly this, displaying pi with 15 decimal places. Jordan On Sep 1, 2005, at 8:06 AM, Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! -- 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] Re: Saturdays and Sundays
the answer is simply yes! You can have a simple for looping to do so. ?php // for example, 02/2005 $year = 2005; $month = 02; for ($i = 1; $i = 31 ; $i++) { if (checkdate($month,$i,$year)) { if (date(w,mktime(0,0,0,$month,$i,$year)) == '0') // it is Sunday echo $i . '/' . $month . '/' . $year . \n; if (date(w,mktime(0,0,0,$month,$i,$year)) == '6') // it is Saturday echo $i . '/' . $month . '/' . $year . \n; } } /** Sample output: 5/2/2005 6/2/2005 12/2/2005 13/2/2005 19/2/2005 20/2/2005 26/2/2005 27/2/2005 **/ ? hope this help! Shaun [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Saturdays and Sundays
since only the total number of saturdays/sundays is what he wants to know, you can use some clever math. Basically, the amount of saturdays in a year is: floor(365 (+1 if it's a leap year) (-days from january first to first saturday) / 7); and sundays = saturdays (-1 if the modulo from the top one is 0) I can't quickly come up with a way to find out what day in the first month would be a saturday... but if you know that, then this should work for you Wong HoWang wrote: the answer is simply yes! You can have a simple for looping to do so. ?php // for example, 02/2005 $year = 2005; $month = 02; for ($i = 1; $i = 31 ; $i++) { if (checkdate($month,$i,$year)) { if (date(w,mktime(0,0,0,$month,$i,$year)) == '0') // it is Sunday echo $i . '/' . $month . '/' . $year . \n; if (date(w,mktime(0,0,0,$month,$i,$year)) == '6') // it is Saturday echo $i . '/' . $month . '/' . $year . \n; } } /** Sample output: 5/2/2005 6/2/2005 12/2/2005 13/2/2005 19/2/2005 20/2/2005 26/2/2005 27/2/2005 **/ ? hope this help! Shaun [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Saturdays and Sundays
Is it possible to get the number of saturdays and sundays for a given month / year? This seems to work... ?php $month = 9; $year = 2005; $day = 1; $ts = mktime(0, 0, 0, $month, $day, $year); $week_day = date(w, $ts); // 0 (for Sunday) through 6 (for Saturday) if ( $week_day 0 $week_day 6 ) { $day += 6 - $week_day; // $day = first saturday } $ts = mktime(0, 0, 0, $month, $day, $year); $tmp_month = date(n, $ts); // 1 - 12 while ( $month == $tmp_month ) { $num_satsuns += 2; $day += 7; $ts = mktime(0, 0, 0, $month, $day, $year); $tmp_month = date(n, $ts); // 1 - 12 } print(Number of Sat/Suns: $num_satsuns\n); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array merge problem
could this help If you want to completely preserve the arrays and just want to append them to each other, use the + operator: ?php $array1 = array(); $array2 = array(1 = data); $result = $array1 + $array2; ? http://www.php.net/manual/en/function.array-merge.php Ahmed Abdel-Aliem wrote: i have the array with the following structure : Array ( [19] = 20.00 [25] = 20.00 [7] = 30.00 [17] = 30.00 ) when i merge a field to it using array_merge it returns that : Array ( [0] = 20.00 [1] = 20.00 [2] = 30.00 [3] = 30.00 [4] = 200.00 ) how can i merge the field without losing the original keys ? can anyone help me with that plz thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Saturdays and Sundays
Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. Here's another way to do it. Each function will return either 4 or 5. If you need both Saturdays and Sundays, just call both functions: ? function get_saturdays($month, $year) { $sat = 4; // time stamp of noon on the first day of the month $first_day = mktime(12, 0, 0, $month, 1, $year); switch ($month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (date(w, $first_day) 3) { $sat++; } break; case 2: if ((date(L, $first_day) == 1) (date(w, $first_day) 5)) { $sat++; } break; case 4: case 6: case 9: case 11: if (date(w, $first_day) 4) { $sat++; } break; } return($sat); } function get_sundays($month, $year) { $sun = 4; // time stamp of noon on the last day of the month $last_day = mktime(12, 0, 0, $month, date(t, $first_day), $year); switch ($month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (date(w, $last_day) 3) { $sat++; } break; case 2: if ((date(L, $last_day) == 1) (date(w, $last_day) 1)) { $sat++; } break; case 4: case 6: case 9: case 11: if (date(w, $last_day) 2) { $sat++; } break; } return($sun); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Saturdays and Sundays
Sorry, I made a mistake. See below: Brian P. O'Donnell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. Here's another way to do it. Each function will return either 4 or 5. If you need both Saturdays and Sundays, just call both functions: ? function get_saturdays($month, $year) { $sat = 4; // time stamp of noon on the first day of the month $first_day = mktime(12, 0, 0, $month, 1, $year); switch ($month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (date(w, $first_day) 3) { $sat++; } break; case 2: if ((date(L, $first_day) == 1) (date(w, $first_day) 5)) { $sat++; } break; case 4: case 6: case 9: case 11: if (date(w, $first_day) 4) { $sat++; } break; } return($sat); } function get_sundays($month, $year) { $sun = 4; // time stamp of noon on the last day of the month The following line referenced a variable in the other function. DUH! It should be: $last_day = mktime(12, 0, 0, $month, date(t, mktime(12, 0, 0, $month, 1, $year)), $year); switch ($month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (date(w, $last_day) 3) { $sat++; } break; case 2: if ((date(L, $last_day) == 1) (date(w, $last_day) 1)) { $sat++; } break; case 4: case 6: case 9: case 11: if (date(w, $last_day) 2) { $sat++; } break; } return($sun); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CookieMonster
Hi Simple question I guess.. How do I set a cookie so it will never expire? (I don't want it to expire) /G @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CookieMonster
Simple question I guess.. How do I set a cookie so it will never expire? (I don't want it to expire) You can't really... I could delete it and that would be the same as expiring it... Best you can do is set it to expire 100 years in the future or some such... see the manual for SetCookie() for more info... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OpenSSL CSR Resource from String
Hello, Is there anyway to create a CSR resource from the string result generated with openssl_csr_export? -- /*--- Best regards, Jared D. Hurn ([EMAIL PROTECTED]) Contract Developer ---*/
Re: [PHP] CookieMonster
You can.. Dont include the expire argument.. or set it to 0. Jason On 9/1/05, Philip Hallstrom [EMAIL PROTECTED] wrote: Simple question I guess.. How do I set a cookie so it will never expire? (I don't want it to expire) You can't really... I could delete it and that would be the same as expiring it... Best you can do is set it to expire 100 years in the future or some such... see the manual for SetCookie() for more info... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CookieMonster
Jason Davidson wrote: You can.. Dont include the expire argument.. or set it to 0. Jason On 9/1/05, Philip Hallstrom [EMAIL PROTECTED] wrote: Simple question I guess.. How do I set a cookie so it will never expire? (I don't want it to expire) You can't really... I could delete it and that would be the same as expiring it... Best you can do is set it to expire 100 years in the future or some such... see the manual for SetCookie() for more info... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you do that then the cookie will expire as soon as the browser session has been closed - I dont think that is what the OP wanted. As per the previous post, all you can really do is set it for some date far in the future. Mikey -- The revolution will not be sent as an email attachment. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CookieMonster
You can.. Dont include the expire argument.. or set it to 0. You sure? The manual says (last sentence): expire The time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch. In other words, you'll most likely set this with the time() function plus the number of seconds before you want it to expire. Or you might use mktime(). time()+60*60*24*30 will set the cookie to expire in 30 days. If not set, the cookie will expire at the end of the session (when the browser closes). Jason On 9/1/05, Philip Hallstrom [EMAIL PROTECTED] wrote: Simple question I guess.. How do I set a cookie so it will never expire? (I don't want it to expire) You can't really... I could delete it and that would be the same as expiring it... Best you can do is set it to expire 100 years in the future or some such... see the manual for SetCookie() for more info... -philip -- 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
Re: [PHP] CookieMonster
Jason Davidson wrote: You can.. Dont include the expire argument.. or set it to 0. No. Do this, and the cookie will expire when you close the browser window. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CookieMonster
You are right, ignore my post. Jason On 9/1/05, John Nichel [EMAIL PROTECTED] wrote: Jason Davidson wrote: You can.. Dont include the expire argument.. or set it to 0. No. Do this, and the cookie will expire when you close the browser window. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Computers name?
Your best hope is to do a reverse lookup on the IP address. On 9/1/05, Oliver Grätz [EMAIL PROTECTED] wrote: Gustav Wiberg schrieb: Hi there! Is it possible to get (retrieve) the computername of the client? I just want the name for comparing... In PHP all you get from the client is in the predefines variables: http://de.php.net/manual/en/language.variables.predefined.php Perhaps these are of any help: http://de.php.net/manual/en/reserved.variables.php#reserved.variables.server If you cannnot find what you need in these (hint: print_r($GLOBALS);), your last resort might be JavaScript which runs in a sandbox, too, so don't bet on it. AllOlli Byers: What proof do you have? Bond: I got this! Byers: You're on the phone, Jimmy! [Lone Gunmen 09] -- 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
Re: [PHP] Help: Get the value of pi up to 200+ digits?
Hi - The 'precision' ini value refers, I believe, only to float numbers, not BC_math numbers (which are stored as strings). I believe the bcmath.scale parameter is the one you need. It can be set via ini_set or bcscale() - http://php.he.net/manual/en/function.bcscale.php Perhaps you could tell us *why* you need pi to 200 digits. If it's just for display, I'd simply define it as a string somewhere in your program: define('PI_LOONNNG', '3.1415927...8468'); However, I would guess that doing math using the BC functions at that precision would be extremely slow. Going to a dedicated math package like MATLAB or Mathematica or something might be more appropriate. steve At 08:57 AM 9/1/2005, Wong HoWang wrote: Dear Jordan, I know what you mean. But you may try this one and you will know: ?php ini_set('precision',200); echo pi(); ? the result is the same as 16!!! So that's why I ask this question! I am not stupid like that! Please help, thx! Jordan Miller [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] http://us3.php.net/manual/en/ini.core.php#ini.precision precision sets the number of significant digits, *NOT* the number of digits displayed after the decimal point. If you want to get pi out to 16 decimal places you need a precision of *17* because the beginning 3 is a significant digit. Your code does exactly this, displaying pi with 15 decimal places. Jordan On Sep 1, 2005, at 8:06 AM, Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! ++ | Steve Edberg [EMAIL PROTECTED] | | Database/Programming/SysAdmin(530)754-9127 | | UC Davis Genome Center http://pgfsun.ucdavis.edu/ | +-- Gort, Klaatu barada nikto! --+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] conditional statement inside while loop?
I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the while loop. Is there another way to do this? Something like this maybe?: pseoudcode while($row=mysql_fetch_array($result){ switch($row['city']){ case 'bejing': $bgcolor='#FF'; break; case 'tokyo': $bgcolor='#00FF00'; break; {...} }//switch }//while /pseoudcode JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] conditional statement inside while loop?
At 03:52 PM 9/1/2005, z a p a n wrote: Hello everyone, I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the while loop. Is there another way to do this? Thanks in advance, Zach That should work, just try a simple if() at first. If it is not working, back up, simplify, just do simple echo to tell you where you are. Better yet, this sounds like an excellent spot to use switch ... case ... break. If you have an editor that can match braces take advantage of that feature. You may not be exactly where you think you are. So, no answer, but hopefully the suggestions are helpful. Cheers - Miles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Port 443
Hey, Using an API for an Ecomemrce app. Wondering how I can ensure I have access to port 443 and that it's open? Thanks! A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session cookies
Hi, Is there a way, using PHP, to determine if session cookies are enabled (or disabled) in the user's browser privacy settings? Thanks, Don
[PHP] conditional statement inside while loop?
Hello everyone, I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the while loop. Is there another way to do this? Thanks in advance, Zach -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help: Get the value of pi up to 200+ digits? -- oops
Oops...I didn't see the earlier message that BC functions were not enabled on your server. So, I'd have to concur with Oliver Grätz's suggestions, and add some of my own: - can you change hosts? - are you allowed to install software in your own directory? You may be able to compile install your own version of PHP and call it via CGI. steve, again. Hi - The 'precision' ini value refers, I believe, only to float numbers, not BC_math numbers (which are stored as strings). I believe the bcmath.scale parameter is the one you need. It can be set via ini_set or bcscale() - http://php.he.net/manual/en/function.bcscale.php Perhaps you could tell us *why* you need pi to 200 digits. If it's just for display, I'd simply define it as a string somewhere in your program: define('PI_LOONNNG', '3.1415927...8468'); However, I would guess that doing math using the BC functions at that precision would be extremely slow. Going to a dedicated math package like MATLAB or Mathematica or something might be more appropriate. steve At 08:57 AM 9/1/2005, Wong HoWang wrote: Dear Jordan, I know what you mean. But you may try this one and you will know: ?php ini_set('precision',200); echo pi(); ? the result is the same as 16!!! So that's why I ask this question! I am not stupid like that! Please help, thx! Jordan Miller [EMAIL PROTECTED] wrote:[EMAIL PROTECTED] http://us3.php.net/manual/en/ini.core.php#ini.precision precision sets the number of significant digits, *NOT* the number of digits displayed after the decimal point. If you want to get pi out to 16 decimal places you need a precision of *17* because the beginning 3 is a significant digit. Your code does exactly this, displaying pi with 15 decimal places. Jordan On Sep 1, 2005, at 8:06 AM, Wong HoWang wrote: Dear all, I'm trying to do like this but failed: ?php ini_set('precision',16); echo pi(); ? How can I get more digits after . ? Can anyone help? Thx! ++ | Steve Edberg [EMAIL PROTECTED] | | Database/Programming/SysAdmin(530)754-9127 | | UC Davis Genome Center http://pgfsun.ucdavis.edu/ | +-- Gort, Klaatu barada nikto! --+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CookieMonster
You can.. Dont include the expire argument.. or set it to 0. Jason Sorry for clogging your inbox, Jason, I didn't CC: the list the first time. if you don't set the expire argument (it's optional), the cookie expires at the end of the browser session. I think the best you can do is set the cookie to expire sometime well beyond the expected life of the application. Google sets their cookie expiration for 30 years. -- Thomas Dodson Programmer, Bioinformatics S-327 Ag. Science North Department of Entomology University of Kentucky Lexington, KY 40546-0091 Phone: (859) 257-3169 Fax: (859) 323-1120 Cell: (859) 420-1696 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Port 443
Using an API for an Ecomemrce app. Wondering how I can ensure I have access to port 443 and that it's open? use fsockopen() to open a socket connection to the host on port 443. You should at least connect... if it fails to connect, it's not open... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session cookies
Is there a way, using PHP, to determine if session cookies are enabled (or disabled) in the user's browser privacy settings? Set a cookie using setcookie(). Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. On that page, see if the cookie value is set. If it is, they have cookies enabled. If it's not, they don't. -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Saturdays and Sundays
Here is an another approach.. if you glance at a calendar, youll notice that the only times there are 5 sats in a month, is when the 1st of 30 day month falls on a fri or sat.. or in a 31 day month, a thur, fri, or say.. So, you could simply test the weekday the first of the month has, and the number of days in the month.. and the num of sats in the month is either 4.. or 5. :) Jason On 9/1/05, Brian P. O'Donnell [EMAIL PROTECTED] wrote: Sorry, I made a mistake. See below: Brian P. O'Donnell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. Here's another way to do it. Each function will return either 4 or 5. If you need both Saturdays and Sundays, just call both functions: ? function get_saturdays($month, $year) { $sat = 4; // time stamp of noon on the first day of the month $first_day = mktime(12, 0, 0, $month, 1, $year); switch ($month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (date(w, $first_day) 3) { $sat++; } break; case 2: if ((date(L, $first_day) == 1) (date(w, $first_day) 5)) { $sat++; } break; case 4: case 6: case 9: case 11: if (date(w, $first_day) 4) { $sat++; } break; } return($sat); } function get_sundays($month, $year) { $sun = 4; // time stamp of noon on the last day of the month The following line referenced a variable in the other function. DUH! It should be: $last_day = mktime(12, 0, 0, $month, date(t, mktime(12, 0, 0, $month, 1, $year)), $year); switch ($month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (date(w, $last_day) 3) { $sat++; } break; case 2: if ((date(L, $last_day) == 1) (date(w, $last_day) 1)) { $sat++; } break; case 4: case 6: case 9: case 11: if (date(w, $last_day) 2) { $sat++; } break; } return($sun); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session cookies
Jasper Bryant-Greene wrote: Philip Hallstrom wrote: Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. Why not header(Location...)? Just out of interest -- it's always worked for me, and it's a much better way to redirect users for many reasons[1] (like not breaking the back button). [1] http://www.w3.org/QA/Tips/reback Because if you just re-direct to a new location then the cookie that you have also set in the headers will not reach the client. Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session cookies
Philip Hallstrom wrote: Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. Why not header(Location...)? Just out of interest -- it's always worked for me, and it's a much better way to redirect users for many reasons[1] (like not breaking the back button). [1] http://www.w3.org/QA/Tips/reback For some reason (and maybe it's no longer true) I've had problems setting a cookie and then doing a header(Location...). Seems some browsers wouldn't pick up the cookie. Now... when this happened (could have been as early as 98) I don't recall, but it's always stuck with me and I usually end up spitting back a little javascript to send the user wherever it is I want them to go... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session cookies
Philip Hallstrom wrote: Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. Why not header(Location...)? Just out of interest -- it's always worked for me, and it's a much better way to redirect users for many reasons[1] (like not breaking the back button). [1] http://www.w3.org/QA/Tips/reback -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session cookies
Mikey wrote: Jasper Bryant-Greene wrote: Philip Hallstrom wrote: Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. Why not header(Location...)? Just out of interest -- it's always worked for me, and it's a much better way to redirect users for many reasons[1] (like not breaking the back button). [1] http://www.w3.org/QA/Tips/reback Because if you just re-direct to a new location then the cookie that you have also set in the headers will not reach the client. That is not true. The output to the client will look like this: HTTP/1.1 302 Found Set-Cookie: name=value;domain=whatever Location: http://my.domain.com/my.php [...] Therefore the cookie does reach the client, and unless the client is buggy it will set the cookie. In my experience most modern browsers have no problem with this, but if someone else has more experience with this than me then please correct me. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session cookies
Hi there! Try using ob_start() and then set sessions, and then user HEADER... http://se.php.net/manual/sv/function.ob-start.php /G @varupiraten.se - Original Message - From: Philip Hallstrom [EMAIL PROTECTED] To: Jasper Bryant-Greene [EMAIL PROTECTED] Cc: php list php-general@lists.php.net Sent: Thursday, September 01, 2005 10:43 PM Subject: Re: [PHP] session cookies Philip Hallstrom wrote: Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. Why not header(Location...)? Just out of interest -- it's always worked for me, and it's a much better way to redirect users for many reasons[1] (like not breaking the back button). [1] http://www.w3.org/QA/Tips/reback For some reason (and maybe it's no longer true) I've had problems setting a cookie and then doing a header(Location...). Seems some browsers wouldn't pick up the cookie. Now... when this happened (could have been as early as 98) I don't recall, but it's always stuck with me and I usually end up spitting back a little javascript to send the user wherever it is I want them to go... -philip -- 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] Impossible???
Hi again! Is this impossible to do in PHP? Dim objNet On Error Resume Next 'In case we fail to create object then display our custom error Set objNet = CreateObject(WScript.NetWork) If Err.Number 0 Then'If error occured then display notice MsgBox Don't be Shy. vbCRLF _ Do not press No If your browser warns you. Document.Location = UserInfo.html 'Place the Name of the document. 'It will display again End if Dim strInfo strInfo = User Name is objNet.UserName vbCRLF _ Computer Name is objNet.ComputerName vbCRLF _ Domain Name is objNet.UserDomain MsgBox strInfo Set objNet = Nothing'Destroy the Object to free the Memory /G @varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: htpasswd-style password generation w/PHP
http://www.thewebmasters.net/php/class.Htpasswd.phps Google htpasswd php, first hit. Don't people use search engines any more? AllOLLi Mal: How drunk was I last night? Jayne: I don't know. I passed out. [firefly 06] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: htpasswd-style password generation w/PHP
http://www.thewebmasters.net/php/class.Htpasswd.phps Google htpasswd php, first hit. Don't people use search engines any more? AllOLLi Mal: How drunk was I last night? Jayne: I don't know. I passed out. [firefly 06] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: (Yet another) I'm blind ... post
On a totally unrelated note: My god, is that ugly code! If I see this right there's only a single piece of real PHP in it: putting the variable in the action field. For the rest: Leave PHP an use pure HTML. Or use a decent form toolkit. like PEAR's HTML_Quickform. There's no point in tons of print-commands just putting out hardcoded strings. AllOlli -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String format problem
Please keep in mind you are speaking about microseconds of performance improvements. Optimising on this level is complete and utter nonsense. Using output buffering may give your application a much higher performance boost. And then you can still use a cache (opcode cache, page cache, ...) which greatly enhances the performance. AllOlli References: - Buffering: http://php.net/ob_start - Caching for starters: http://derickrethans.nl/files/perf-hungary.pdf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session cookies
Philip Hallstrom wrote: Is there a way, using PHP, to determine if session cookies are enabled (or disabled) in the user's browser privacy settings? Set a cookie using setcookie(). Then use an HTML meta refresh (or javascript, just not Header(Location...) to redirect them to another page. Why not? I much prefer real headers to the http-equiv stuff in meta tags. After all, that is just a way to let you mimic real headers. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session cookies
Jasper Bryant-Greene wrote: That is not true. The output to the client will look like this: HTTP/1.1 302 Found Set-Cookie: name=value;domain=whatever Location: http://my.domain.com/my.php [...] Very nice explanation. :-) It is a common misconception that header('Location: ...') redirects the client as soon as that statement is executed. The Location header is only special in the sense that PHP also modifies the response status code (to 302). Aside from that, it's just a regular header, and the browser can't possible take any action on it before it receives the HTTP response (which isn't sent until your PHP script completes). This is similar to how a browser can't predict when you're going to set a cookie. :-) Just to counter my own explanation (what the heck), I do recall older versions of IE mishandling (surprise) an HTTP response such as what Jasper illustrated. They would request the new URL but fail to set the cookie as requested. It was a browser bug, and I think this bug is the source of all the confusion. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session cookies
Chris Shiflett wrote: Jasper Bryant-Greene wrote: That is not true. The output to the client will look like this: HTTP/1.1 302 Found Set-Cookie: name=value;domain=whatever Location: http://my.domain.com/my.php [...] Very nice explanation. :-) It is a common misconception that header('Location: ...') redirects the client as soon as that statement is executed. The Location header is only special in the sense that PHP also modifies the response status code (to 302). Aside from that, it's just a regular header, and the browser can't possible take any action on it before it receives the HTTP response (which isn't sent until your PHP script completes). That's a bit misleading. The HTTP response headers are sent a soon as you output something from your script (calling header() or setcookie() doesn't count as output, so you can set all the headers and cookies you want). It doesn't wait for the end of the request unless you are buffering everything. And the browsers tend to redirect right away once they get this header. Whether or not your script runs to completion once the browser is gone is controlled by your 'ignore_user_abort' setting. See chapter 40 - Connection Handling in the manual for a full explanation of that. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] conditional statement inside while loop?
Hello everyone, I'm using a while loop to display a list of people contained in my database. I'd like to assign different font colors to each depending on which city they're from, but I can't seem to get an if/elseif/else statement to work inside the while loop. Is there another way to do this? Hi Zach, There should be no reason why you can't use if/elseif/else within your while loop. The fact that you're experiencing problems strongly suggests that you have a combination of conditionals in your if/elseif/else that is effectively ignoring the data being returned from your recordset. It may be something as simple as using = in your if statement instead of == (ie, so the conditional is always true, because you're using the assignment = operator instead of the evaluative == operator), or a combination of conditions, each of which are accurate but which when placed together cause problems. To get an idea where your problem is occurring, try going from simple to complex. Start with something like the following pseudo-code: while ($row = get_data_from_your_recordset){ if (strlen($row['a_recordset_field']) 0){ echo Data found: . $row['a_recordset_field'] . br /; } else { echo Data not foundbr /; } } The assumption being made above is that you will be using a field from your recordset that contains data that is ordinarily longer than 0 bytes. Doing the above will demonstrate that at the very least you are returning a valid recordset and that conditional statements work within while loops. If even this fails, then check the SQL that is being used to populate the recordset, and make sure that you are using the same field names in your PHP code as is being returned from the table by the recordset. Once the above is working, add back in your actual conditional(s), one by one. You're looking for the point where 'working' code becomes 'broken' code. Most of the time when you debug in this way it becomes obvious why the code isn't behaving the way you expect it to. If there's still any confusion at that point, at least you will be in a better position to supply actual code to the list, so we can work out the real problem. Much warmth, Murray --- Lost in thought... http://www.planetthoughtful.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Impossible???
Yes, check out the great documentation at http://www.php.net/docs.php It's available in several languages. Great place to learn the wounderful world of php. - Original Message - From: Gustav Wiberg [EMAIL PROTECTED] Newsgroups: php.general To: PHP General php-general@lists.php.net Sent: Thursday, September 01, 2005 11:20 PM Subject: Impossible??? Hi again! Is this impossible to do in PHP? Dim objNet On Error Resume Next 'In case we fail to create object then display our custom error Set objNet = CreateObject(WScript.NetWork) If Err.Number 0 Then'If error occured then display notice MsgBox Don't be Shy. vbCRLF _ Do not press No If your browser warns you. Document.Location = UserInfo.html 'Place the Name of the document. 'It will display again End if Dim strInfo strInfo = User Name is objNet.UserName vbCRLF _ Computer Name is objNet.ComputerName vbCRLF _ Domain Name is objNet.UserDomain MsgBox strInfo Set objNet = Nothing'Destroy the Object to free the Memory /G @varupiraten.se - FREE E-MAIL IN 1 MINUTE! - [EMAIL PROTECTED] - http://www.pc.nu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Allowing access to only one host/referer
Hi there, i was wondering how I could allow access to a script from another server/host only ? Its prob a silly question but i guess get their host ip ? The thing with that is one server which is a webpage has a javascript popup to load the script on the other server, and i believe that in this scenario it doesnt send referer info. Let me know. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Viewing Binary format.
Hi currently i have a problem with viewing chinese characters that is passed to me in binary format.. for english it just show as it is.. but for chinese how do you convert it to a readable format? currently im just seeing chinese characters passed to me like this u(N#142;Q\\0(\\0C\\0H\\0I\\0N\\0A\\0C\\0N\\0C\\0)[½^u(b7\\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 \\0 Regards, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Allowing access to only one host/referer
Dan Rossi wrote: Hi there, i was wondering how I could allow access to a script from another server/host only ? Its prob a silly question but i guess get their host ip ? The thing with that is one server which is a webpage has a javascript popup to load the script on the other server, and i believe that in this scenario it doesnt send referer info. Let me know. If you're on Apache and have .htaccess files enabled, put this in: Order Deny,Allow Deny from all Allow from [allowed_ip] Obviously replace [allowed_ip] with the IP address. You can also do partial IPs, whole networks, and other cool stuff. See: http://httpd.apache.org/docs/2.0/mod/mod_access.html#allow -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5s -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php