RE: [PHP] Re: Anyone Up?
You're wrong here, my friend. You can have any value you like. value="@£$ASDFSDF ASDP fosifu @}{$#%/&@ " would work. Niklas -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: 1. helmikuuta 2002 10:48 To: Luke Welling Cc: Php-General Subject: Re: [PHP] Re: Anyone Up? I think you'll need something like this: VALUE=\'Your Name1\' / /single quote marks I believe (and I certainly could be wrong). otherwise it'll truncate at 'Your' of course, if this is what you want... Hugh - Original Message - From: "Luke Welling" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 31, 2002 11:50 PM Subject: [PHP] Re: Anyone Up? > > "Jtjohnston" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Luke is that 6:47 pm tomorrow? :) You lost an entire day! Enough Oz > > Jokes. Here is my predicament in Canada :-) > > > > $varname = "Check".$i; > > > > $varname = "Check1" but I want $varname = "Your Name1" to "Your > > Name12". > > > > One more try? :) > > > > > TYPE="checkbox" NAME="Check2" VALUE="Your Name2"> > TYPE="checkbox" NAME="Check3" VALUE="Your Name3"> etc. > > > > for ($i = 1; $i <= $NMax; $i++) > > { > > #$varname = "$Check".$i; > > $varname = "Check".$i > > #echo $varname; > > if ($varname) > > echo "$varname = $i"; > > } > > In that case it is easy, I did not know that the ids were just 1 to > 12, I thought they could be anything spat out by the database. > > How about something like this: > > for ($i = 1; $i <= $NMax; $i++) > { > $varname = "Check".$i > if (isset($$varname) > echo $$varname.""; > } > > Luke Welling. > -- > PHP and MySQL Web Development > by Luke Welling and Laura Thomson > http://www.amazon.com/exec/obidos/ASIN/0672317842 > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] To > contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Anyone Up?
eval() is your solution. for ($i = 1; $i <= $NMax; $i++) { $variable = "\$Check$i"; eval("\$string = \"$variable\";"); echo $string.""; } Niklas -Original Message- From: jtjohnston [mailto:[EMAIL PROTECTED]] Sent: 1. helmikuuta 2002 9:16 To: [EMAIL PROTECTED] Subject: [PHP] Anyone Up? Anyone Awake? Up? I'm using 12 checkboxes dynamically generated by mysql. Each has an id as primary index so I do this: id."\" VALUE=\"".$mydata->yourname."\"> When I submit, I want to echo to see if anyone clicked on them. But I can't get my variable right to find $check1 through $check12. How do I express in a for loop. $Check.$i does not work of course! for ($i = 1; $i <= $NMax; $i++) { echo $Check.$i""; } :) Help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] using eregi
You could do it like this: "; }; ?> Niklas -Original Message- From: John Gurley [mailto:[EMAIL PROTECTED]] Sent: 31. tammikuuta 2002 15:32 To: [EMAIL PROTECTED] Subject: [PHP] using eregi Hello, Just wondering if there is a way to print out parts of a text file (i.e from line x to line y) using php, the way it is being done now is using eregi and comparing strings, but it would be alot better if I could specify which lines to print. Thanks a million. _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] question reg trim-strlen
Then why don't you just trim() it before comparing? $var = trim($var); Niklas -Original Message- From: B. Verbeek [mailto:[EMAIL PROTECTED]] Sent: 31. tammikuuta 2002 13:33 To: [EMAIL PROTECTED] Subject: RE: [PHP] question reg trim-strlen I want to trim it then check and the new var must stay trimmed! -Oorspronkelijk bericht- Van: Niklas Lampén [mailto:[EMAIL PROTECTED]] Verzonden: donderdag 31 januari 2002 11:55 Aan: Php-General Onderwerp: RE: [PHP] question reg trim-strlen I think it won't work. If you don't want to trim the actual variable, but check if the trimmed variable is longer than 50 chars, here you go: if (strlen(trim($cust_adres)) > 50) { } Niklas -Original Message- From: B. Verbeek [mailto:[EMAIL PROTECTED]] Sent: 31. tammikuuta 2002 12:48 To: Php-General (E-mail) Subject: [PHP] question reg trim-strlen Does this work? >>if(strlen($cust_adres = trim($cust_adres)) > 50){ /*code here*/ } I mean that the new $cust_adres is trimmed when nessecary? regards Bart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] question reg trim-strlen
I think it won't work. If you don't want to trim the actual variable, but check if the trimmed variable is longer than 50 chars, here you go: if (strlen(trim($cust_adres)) > 50) { } Niklas -Original Message- From: B. Verbeek [mailto:[EMAIL PROTECTED]] Sent: 31. tammikuuta 2002 12:48 To: Php-General (E-mail) Subject: [PHP] question reg trim-strlen Does this work? >>if(strlen($cust_adres = trim($cust_adres)) > 50){ /*code here*/ } I mean that the new $cust_adres is trimmed when nessecary? regards Bart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] mysql
If I understood you correct, you want to know the amount of the rows in your table. Here you go (Assuming ID is the field you use to ident your rows): "...count(ID) AS CountValue..." then treat CountValue as any field in a table. Niklas -Original Message- From: Mason Batley [mailto:[EMAIL PROTECTED]] Sent: 31. tammikuuta 2002 8:31 To: [EMAIL PROTECTED] Subject: [PHP] mysql bleh, its not working I'll take another approach, If I use a count(*) query, it will return 1 record with a value, possibly 0. what command can I use to grab it from $result ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Writing to text file from Radio Buttons
fwrite()? Niklas -Original Message- From: Harphajan Singh [mailto:[EMAIL PROTECTED]] Sent: 22. tammikuuta 2002 9:51 To: [EMAIL PROTECTED] Subject: [PHP] Writing to text file from Radio Buttons Greeting dudes ! I`m a fresh user of PHP and need some technical assistance from you folks. I`m creating a survey form(using radio buttons) and it looks like this :- Q1) How do you register for the hostel ? By Phone By E-Mail Walk-In to office Q2)Do the authorities respond to your complaint immediately? Yes No I would like to store each entry into a text file and view them later.Hence, I would know the unique 'VALUE' for a particular 'NAME'(for both the Q`s) So, the output in my textfile should look something like I`m trying to open a file and then write to it for instance :- $fp = fopen("$DOCUMENT_ROOT/.../software/survey.txt", "w"); BUT, I don`t really know how to store the unique values for those radio buttons into my file. Please help , dudes ! __ Do You Yahoo!? Send FREE video emails in Yahoo! Mail! http://promo.yahoo.com/videomail/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Getting the last record in a mysql table FINALLY!!
Well, ofcourse you have to have the table + field names right. ;) Niklas -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: 18. tammikuuta 2002 9:38 To: [EMAIL PROTECTED] Cc: Php-General Subject: Re: [PHP] Getting the last record in a mysql table FINALLY!! Niklas, I needed to change the statement slightly, but it did put me on the right track. Thanks again, Hugh $result=mysql_query("SELECT id FROM my_table ORDER BY id DESC, id limit 1"); $id=mysql_result($result,0); - Original Message ----- From: Niklas Lampén <[EMAIL PROTECTED]> To: Php-General <[EMAIL PROTECTED]> Sent: Thursday, January 17, 2002 10:29 PM Subject: RE: [PHP] Getting the last record in a mysql table > If you have ID that is a incrementing number, you could just query > like > this: > 'SELECT ID FROM MY_TABLE ORDER BY ID DESC, LIMIT 1' > > And there you have just one result, the last (biggest) ID number. > > > Niklas > > > -Original Message- > From: hugh danaher [mailto:[EMAIL PROTECTED]] > Sent: 18. tammikuuta 2002 7:37 > To: Php-General > Subject: [PHP] Getting the last record in a mysql table > > > Help! > I thought this would be easy but it ain't. What I want is the id > number of the last record in a table. I've tried a number of > variations to the following but am getting no where! Any help will be > greatly appreciated. Hugh > > > $results=mysql_query(" SELECT last_insert_id() FROM MY_TABLE "); > $row=mysql_fetch_assoc($results); while > ($row=mysql_fetch_row($results)) > { > print ""; > foreach($row as $field) >{ >if ($field=="") > { > $field=" "; > } >print "".$field.""; >} > print ""; > } > print ""; > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] To > contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Getting the last record in a mysql table
You're welcome. Heh, why to make too hard. :) Niklas -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: 18. tammikuuta 2002 8:40 To: [EMAIL PROTECTED] Subject: Re: [PHP] Getting the last record in a mysql table Niklas, Now that sounds like a solution! Thanks, Hugh - Original Message - From: Niklas Lampén <[EMAIL PROTECTED]> To: Php-General <[EMAIL PROTECTED]> Sent: Thursday, January 17, 2002 10:29 PM Subject: RE: [PHP] Getting the last record in a mysql table > If you have ID that is a incrementing number, you could just query > like > this: > 'SELECT ID FROM MY_TABLE ORDER BY ID DESC, LIMIT 1' > > And there you have just one result, the last (biggest) ID number. > > > Niklas > > > -Original Message- > From: hugh danaher [mailto:[EMAIL PROTECTED]] > Sent: 18. tammikuuta 2002 7:37 > To: Php-General > Subject: [PHP] Getting the last record in a mysql table > > > Help! > I thought this would be easy but it ain't. What I want is the id > number of the last record in a table. I've tried a number of > variations to the following but am getting no where! Any help will be > greatly appreciated. Hugh > > > $results=mysql_query(" SELECT last_insert_id() FROM MY_TABLE "); > $row=mysql_fetch_assoc($results); while > ($row=mysql_fetch_row($results)) > { > print ""; > foreach($row as $field) >{ >if ($field=="") > { > $field=" "; > } >print "".$field.""; >} > print ""; > } > print ""; > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] To > contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Getting the last record in a mysql table
If you have ID that is a incrementing number, you could just query like this: 'SELECT ID FROM MY_TABLE ORDER BY ID DESC, LIMIT 1' And there you have just one result, the last (biggest) ID number. Niklas -Original Message- From: hugh danaher [mailto:[EMAIL PROTECTED]] Sent: 18. tammikuuta 2002 7:37 To: Php-General Subject: [PHP] Getting the last record in a mysql table Help! I thought this would be easy but it ain't. What I want is the id number of the last record in a table. I've tried a number of variations to the following but am getting no where! Any help will be greatly appreciated. Hugh $results=mysql_query(" SELECT last_insert_id() FROM MY_TABLE "); $row=mysql_fetch_assoc($results); while ($row=mysql_fetch_row($results)) { print ""; foreach($row as $field) { if ($field=="") { $field=" "; } print "".$field.""; } print ""; } print ""; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Display a mesagge and redirect (newbie)
Well, there could be a problem with connection due to the ISP. Maybe this is not relevant with this case, but good to know for future use. I.e. if you have a picture on a page which will take more than 5 seconds to download (maybe due to a problem with connection), will redirect you after 5 seconds even if page is not loaded completely but the javascript code will wait 'till the page is loaded. Everyone will see the whole page. And you can allways add an extra link for those who do not want to wait (or have javascript disabled). Niklas -Original Message- From: Intruder [mailto:[EMAIL PROTECTED]] Sent: 17. tammikuuta 2002 16:20 To: Php-General Subject: RE: [PHP] Display a mesagge and redirect (newbie) >> No good, since starts counting when page is first opened, so >> clients with slow connection might not never see the message. I'd >> rather use what do you mean "slow connection" ??? 10 bytes/second ??? I don't think that someone has such speed and to load your code slow-connected person will have to wait more than 5 seconds and even more longer than to load just blank page with my META :)) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Display a mesagge and redirect (newbie)
No good, since starts counting when page is first opened, so clients with slow connection might not never see the message. I'd rather use which will execute right after the page is completely loaded and move to the next page after 5 seconds. Niklas -Original Message- From: Intruder [mailto:[EMAIL PROTECTED]] Sent: 17. tammikuuta 2002 15:52 To: Php-General Subject: RE: [PHP] Display a mesagge and redirect (newbie) >> a) run a mysql query >> b) display a simpe message >> c) delay few seconds >> d)auto redirect to a page some message goes here !!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Display a mesagge and redirect (newbie)
I recommend you to use javascript for this one. That way you can make sure that client sees the message exactly for time you've decided (like 3 seconds). So: a) Just do It b) Just do It c) JavaScript for this one, launched _after_ page has loaded completely (use -tag for that) d) Times up. location.href will take you where you want. Niklas -Original Message- From: Simos Varelakis [mailto:[EMAIL PROTECTED]] Sent: 17. tammikuuta 2002 14:37 To: [EMAIL PROTECTED] Subject: [PHP] Display a mesagge and redirect (newbie) Hi to everyone I want to do the following and i dont know if its possible with php code a) run a mysql query b) display a simpe message c) delay few seconds d)auto redirect to a page can I do this with php i know how to do a) and b) and I can't do c) and d) note that if i try d) with function header ("location URL'") got an error for headers already send :-( Thanks in advance for your help and time Best regards simos -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] ereg
You should use preg_match_all() for this. Something like this should do (didn't try it thou): preg_match_all("|(.*)\">|U", $lineofhtml, $output, PREG_PATTERN_ORDER); Niklas -Original Message- From: Kunal Jhunjhunwala [mailto:[EMAIL PROTECTED]] Sent: 11. tammikuuta 2002 5:56 To: php-list Subject: [PHP] ereg This is my code : ereg("(.*)", $lineofhtml, $output); The problem is that, with (.*) it matches everthing from the first to the last ... hence it appears its all in one array... what I need to do is tell it to stop at the first and I can't figure out how to do that... any ideas? Regards, Kunal Jhunjhunwala -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] global/local var in a function
This is because it creates a new "thread", atleast I think it so. Use global variables to prevent this from happening: i = 0; function change_check_all(tree_item) { a = document.all[tree_item + "_check"]; b = document.all[tree_item + "_count"]; // changed the line below for(i = $GLOBALS[i];imailto:[EMAIL PROTECTED]] Sent: 10. tammikuuta 2002 13:44 To: [EMAIL PROTECTED] Subject: [PHP] global/local var in a function Hi, I have a little problem with a function. It calls him self and the var i is lost! after the call! can anybody help me? (it's javascript) function change_check_all(tree_item) { a = document.all[tree_item + "_check"]; b = document.all[tree_item + "_count"]; for(i=0;ihttp://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] foreach statement
You're welcome. :) Niklas P.S. I know... ;) -Original Message- From: Chris Grigor [mailto:[EMAIL PROTECTED]] Sent: 9. tammikuuta 2002 10:23 To: '[EMAIL PROTECTED]'; Php-General Subject: RE: [PHP] foreach statement Thanks!! its working !!! ***BIG SMILE Niklas you genious -Original Message----- From: Niklas Lampén [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 09, 2002 10:15 AM To: Php-General Subject: RE: [PHP] foreach statement Foreach works in PHP just like I told. foreach($emails as $this_is_one_address) is the correct form where $emails is an array and $this_is_one_address gets one element from $emails. This is similar to this (technically): for ($i = 0; $i < count($emails); ++$i) { $this_is_one_address = $emails[$i]; // Do anything you want with $this_is_one_address }; I suggest that you use the for-loop if $emails array is big. Takes less memory. Niklas -Original Message- From: Chris Grigor [mailto:[EMAIL PROTECTED]] Sent: 9. tammikuuta 2002 9:44 To: '[EMAIL PROTECTED]'; Php-General Subject: RE: [PHP] foreach statement Hey Niklas yea thats what I want, just one thing foreach($emails as $this_is_one_address) { would it be foreach($emails) { or am I missing something in there ? ? mailto:[EMAIL PROTECTED]] Sent: 9. tammikuuta 2002 8:59 To: 'Php-General-List (E-mail)' Subject: [PHP] foreach statement Okay lets see who has there thinking caps on today (cos I really dont) I have a list of email addresses stored in a text file. I am able to run the script and get all the mail addresses in the list mailed but thats all in one mail. I want to be able to open the file, chop each line and send individual messages to each address.. okay who is confused as Im not giving you much description here, well okay heres what the script looks like #!/usr/bin/php -q Im just thinking(trying to at least) I need some sort of foreach statement like in perl, right? so that it would say foreach($recipient) { send mail } anyone that could maybe guide me? Thanks in advance C-Ya Chris Grigor -- Client Services Call Center: 0860 100 154 Fax: +27 11 340 7345 E-Mail: [EMAIL PROTECTED] -- M-WEB Business Solutions Making it happen. Go shopping @ http://shopping.mweb.co.za Get your business online @ http://business.mweb.com "We all know Linux is great...it does infinite loops in 5 seconds." - Linus Torvalds -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] foreach statement
Foreach works in PHP just like I told. foreach($emails as $this_is_one_address) is the correct form where $emails is an array and $this_is_one_address gets one element from $emails. This is similar to this (technically): for ($i = 0; $i < count($emails); ++$i) { $this_is_one_address = $emails[$i]; // Do anything you want with $this_is_one_address }; I suggest that you use the for-loop if $emails array is big. Takes less memory. Niklas -Original Message- From: Chris Grigor [mailto:[EMAIL PROTECTED]] Sent: 9. tammikuuta 2002 9:44 To: '[EMAIL PROTECTED]'; Php-General Subject: RE: [PHP] foreach statement Hey Niklas yea thats what I want, just one thing foreach($emails as $this_is_one_address) { would it be foreach($emails) { or am I missing something in there ? ? mailto:[EMAIL PROTECTED]] Sent: 9. tammikuuta 2002 8:59 To: 'Php-General-List (E-mail)' Subject: [PHP] foreach statement Okay lets see who has there thinking caps on today (cos I really dont) I have a list of email addresses stored in a text file. I am able to run the script and get all the mail addresses in the list mailed but thats all in one mail. I want to be able to open the file, chop each line and send individual messages to each address.. okay who is confused as Im not giving you much description here, well okay heres what the script looks like #!/usr/bin/php -q Im just thinking(trying to at least) I need some sort of foreach statement like in perl, right? so that it would say foreach($recipient) { send mail } anyone that could maybe guide me? Thanks in advance C-Ya Chris Grigor -- Client Services Call Center: 0860 100 154 Fax: +27 11 340 7345 E-Mail: [EMAIL PROTECTED] -- M-WEB Business Solutions Making it happen. Go shopping @ http://shopping.mweb.co.za Get your business online @ http://business.mweb.com "We all know Linux is great...it does infinite loops in 5 seconds." - Linus Torvalds -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] foreach statement
I think this is what you want to do: mailto:[EMAIL PROTECTED]] Sent: 9. tammikuuta 2002 8:59 To: 'Php-General-List (E-mail)' Subject: [PHP] foreach statement Okay lets see who has there thinking caps on today (cos I really dont) I have a list of email addresses stored in a text file. I am able to run the script and get all the mail addresses in the list mailed but thats all in one mail. I want to be able to open the file, chop each line and send individual messages to each address.. okay who is confused as Im not giving you much description here, well okay heres what the script looks like #!/usr/bin/php -q Im just thinking(trying to at least) I need some sort of foreach statement like in perl, right? so that it would say foreach($recipient) { send mail } anyone that could maybe guide me? Thanks in advance C-Ya Chris Grigor -- Client Services Call Center: 0860 100 154 Fax: +27 11 340 7345 E-Mail: [EMAIL PROTECTED] -- M-WEB Business Solutions Making it happen. Go shopping @ http://shopping.mweb.co.za Get your business online @ http://business.mweb.com "We all know Linux is great...it does infinite loops in 5 seconds." - Linus Torvalds -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] php newbie
Yep, but you can't do much without testing your scripts. Niklas -Original Message- From: Martin Schichl [mailto:[EMAIL PROTECTED]] Sent: 2. tammikuuta 2002 13:37 To: [EMAIL PROTECTED]; Php-General Subject: RE: [PHP] php newbie To design, you just need a text editor (or html editor) Martin At 13:24 02.01.02 +0200, Niklas Lampén wrote: >To test your PHP scripts you do need a server with PHP. It's very easy >to setup one on to you local machine + there is many completely free >ones. > > >Niklas > > > >-Original Message- >From: Fady Fouad Shehata [mailto:[EMAIL PROTECTED]] >Sent: 31. joulukuuta 2001 4:34 >To: [EMAIL PROTECTED] >Subject: [PHP] php newbie > > >hi i am new in php ,i just wanted to ask before i begin learning php >,well can i design php on my personal computer or i need a server to >design php ,and the second question is do i need a specific program to >design php or i can use my html editor for that > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] To >contact the list administrators, e-mail: [EMAIL PROTECTED] > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > - Dipl.-Ing. Martin Schichl SC&C Software, Communication & Consulting GmbH & Co KEG Grottenhofstr. 3, A-8053 Graz Tel. +43/(0)316/265-205, Fax +43/(0)316/265-234 [EMAIL PROTECTED], http://scc.co.at -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] php newbie
To test your PHP scripts you do need a server with PHP. It's very easy to setup one on to you local machine + there is many completely free ones. Niklas -Original Message- From: Fady Fouad Shehata [mailto:[EMAIL PROTECTED]] Sent: 31. joulukuuta 2001 4:34 To: [EMAIL PROTECTED] Subject: [PHP] php newbie hi i am new in php ,i just wanted to ask before i begin learning php ,well can i design php on my personal computer or i need a server to design php ,and the second question is do i need a specific program to design php or i can use my html editor for that -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] php in free()
Your code runs more than 30 seconds. Try using set_time_limit(n) function. Niklas -Original Message- From: Rick [mailto:[EMAIL PROTECTED]] Sent: 18. joulukuuta 2001 2:46 To: [EMAIL PROTECTED] Subject: [PHP] php in free() I'm running a script that times out durring a certian action. Fatal error: Maximum execution time of 30 seconds exceeded in /usr/local/web/htdocs/mail/functions.php on line 1200 The error logs say: php in free(): warning: recursive call. The offending lines of code, and here's what really gets me, is a simple while(): while(!feof($socket)){ $data .= fgets($socket, 1024); } Which is just reading data from an SMTP socket. I haven't been able to find any information about this php in free() error. Any ideas? Thanks! dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Very non-PHP (this is Java)
This time VERY non-php, but I trust you guys! ;) Are Java applets stored automatically to cache? Can I prevent it somehow? Niklas
RE: [PHP] mySQL problem
"SELECT UCASE(Company) AS Company" works great, thanks! Niklas -Original Message- From: Dimitris Kossikidis [mailto:[EMAIL PROTECTED]] Sent: 2. marraskuuta 2001 11:11 To: 'Niklas Lamp¨¦n' Cc: PHP General Subject: RE: [PHP] mySQL problem Try this $Query = "SELECT UCASE(Company) as company, Icons, ID, LogoD FROM feComps"; List ( $company, $icons, etc ) = mysql_fetch_row( ); > -Original Message- > From: Niklas Lamp¦Én [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 02, 2001 10:22 AM > To: Php-General > Subject: [PHP] mySQL problem > > > I'm having a wierd problem with mySQL query. > > $Query = "SELECT UCASE(Company), Icons, ID, LogoD FROM feComps"; > > returns right amount of rows, but field Company is empty. > > $Query = "SELECT Company, Icons, ID, LogoD FROM feComps."; > > works fine. > > > First query works great when I run it in shell. What could cause this? > > > Niklas > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] mySQL problem
I'm having a wierd problem with mySQL query. $Query = "SELECT UCASE(Company), Icons, ID, LogoD FROM feComps"; returns right amount of rows, but field Company is empty. $Query = "SELECT Company, Icons, ID, LogoD FROM feComps."; works fine. First query works great when I run it in shell. What could cause this? Niklas
RE: [PHP] year 2002 strtotime problem
Great. :) I've got PHP 4.0.6 on linux. You? I think you should break the dates manually, it would be the most sure way to do it. Niklas -Original Message- From: John Clarke [mailto:[EMAIL PROTECTED]] Sent: 2. marraskuuta 2001 9:11 To: [EMAIL PROTECTED] Subject: Re: [PHP] year 2002 strtotime problem Even more funny... I cut and pasted your code and I got; Wed Dec 12 2001 Sat Mar 1 2003 2001-12-12 2001-03-01 What version of Php and OS are you using?? John "Niklas lampén" <[EMAIL PROTECTED]> wrote in message 000301c16369$6817a320$ba93c5c3@Niklas">news:000301c16369$6817a320$ba93c5c3@Niklas... > Funny, I quickly tried this: > > $date1 = "12/12/2001"; > $date2 = "15/01/2002"; > > $date1 = date("D M j Y", strtotime($date1)); > $date2 = date("D M j Y", strtotime($date2)); > > print $date1.""; > print $date2.""; > > print date("Y-m-d", strtotime($date1)).""; > print date("Y-m-d", strtotime($date2)).""; > ?> > > And the result was this: > " > Wed Dec 12 2001 > Sat Mar 1 2003 > 2001-12-12 > 2003-03-01 > " > > > Niklas > > > -Original Message- > From: John Clarke [mailto:[EMAIL PROTECTED]] > Sent: 2. marraskuuta 2001 8:17 > To: [EMAIL PROTECTED] > Subject: [PHP] year 2002 strtotime problem > > > I have this problem with Php 4.0.5 on both Win ME and Linus boxes, > where my year 2002 dates are converted back to 2001 when formating > with 'strtotime'. > > First I post the following variables from an html page to a php page > > $date1='12/12/2001' > $date2='15/01/2002' > > I then use date("D M j Y", strtotime($date1); and date("D M j Y", > strtotime($date2)); to store them in an array for screen display. > > As the users have the abilty to selected different dates I need to > check that 1 is before the other. To do this I have a script > timediff() that I pass the two dates to in the above format. > > All works fine until the year 2002 is selected. This is part of the > timediff() code with dispay statements and the result. > > function timediff($date1,$date2) { > >echo 'date1= '."$date1".' ';// displays 'Wed > December 12 > 2001' ... correct >echo 'date2= '."$date2".' '; // displays 'Tue > January 15 > 2002' ...correct, all fine so far > > $dd1=date("Ymd", strtotime($date1)); > $dd2=date("Ymd", strtotime($date2)); > >echo 'date1= '.$dd1.'';// displays '20011212' > ... > correct >echo 'date2= '.$dd2.' '; // displays '20010115 > ...WRONG > } > > It seem that by applying strtotime a 2nd time might cause this > problem, as the first application was fine. > > I have tested all possible combinations of strtotime but the year > 2002 always goes back to 2001 Have also tried just 'strtotime($date1)' > but same problem again. > > Any help or comments would be greatly appreciated as I thought I had > finished a booking program any now find this!! > > Thanks in anticipation > > > John Clarke > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] To > contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] year 2002 strtotime problem
Funny, I quickly tried this: "; print $date2.""; print date("Y-m-d", strtotime($date1)).""; print date("Y-m-d", strtotime($date2)).""; ?> And the result was this: " Wed Dec 12 2001 Sat Mar 1 2003 2001-12-12 2003-03-01 " Niklas -Original Message- From: John Clarke [mailto:[EMAIL PROTECTED]] Sent: 2. marraskuuta 2001 8:17 To: [EMAIL PROTECTED] Subject: [PHP] year 2002 strtotime problem I have this problem with Php 4.0.5 on both Win ME and Linus boxes, where my year 2002 dates are converted back to 2001 when formating with 'strtotime'. First I post the following variables from an html page to a php page $date1='12/12/2001' $date2='15/01/2002' I then use date("D M j Y", strtotime($date1); and date("D M j Y", strtotime($date2)); to store them in an array for screen display. As the users have the abilty to selected different dates I need to check that 1 is before the other. To do this I have a script timediff() that I pass the two dates to in the above format. All works fine until the year 2002 is selected. This is part of the timediff() code with dispay statements and the result. function timediff($date1,$date2) { echo 'date1= '."$date1".' ';// displays 'Wed December 12 2001' ... correct echo 'date2= '."$date2".' '; // displays 'Tue January 15 2002' ...correct, all fine so far $dd1=date("Ymd", strtotime($date1)); $dd2=date("Ymd", strtotime($date2)); echo 'date1= '.$dd1.'';// displays '20011212' ... correct echo 'date2= '.$dd2.' '; // displays '20010115 ...WRONG } It seem that by applying strtotime a 2nd time might cause this problem, as the first application was fine. I have tested all possible combinations of strtotime but the year 2002 always goes back to 2001 Have also tried just 'strtotime($date1)' but same problem again. Any help or comments would be greatly appreciated as I thought I had finished a booking program any now find this!! Thanks in anticipation John Clarke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] problem with a while loop
What happens there is this: $email = "1. row"; $email = "2. row"; $email = "3. row"; echo $email; You really need to put echo $email inside the loop or use '.=' to set up values to $email. Niklas -Original Message- From: Richard Kurth [mailto:[EMAIL PROTECTED]] Sent: 26. lokakuuta 2001 10:11 To: php Subject: [PHP] problem with a while loop I am trying to get the data out of the while loop if I echo $email inside the } it gives me all of the data but if I echo it out side of the loop it only gives me one record even though I know there is more. How can I get this to work $query = "SELECT * FROM members Where Company LIKE '%$search1%'"; $result=mysql_db_query($dbName,$query); while ($row = mysql_fetch_array($result)) { $email= $row["lname"] . " " . "<" . $row["E_mail_1"] . ">" . ";"; } echo $email; -- Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Using A Query Results Multiple Times
mysql_data_seek(); Niklas -Original Message- From: Adam Douglas [mailto:[EMAIL PROTECTED]] Sent: 23. lokakuuta 2001 21:48 To: PHP-DB (mailing list) (E-mail); PHP-General (mailing list) (E-mail) Subject: [PHP-DB] Using A Query Results Multiple Times I have an instance where I have to query my MySQL database and then use the multiple row results to create multiple pull down menus on a web page. My problem is how can I take the results of the query and use them more the once to create pull down menus? I've always used a while look to fetch each row of the results and have it create the pull down menu as it goes through each row. But doing it this way only stores one row of results in a variable. Is there a way I can grab all the results from a query that would go into an array so I could use it multiple times? I've looking briefly for a function to MySQL that would allow me to do this but haven't found anything unless I misunderstand mysql_fetch_array function. At first I thought I could loop through my while loop and have it put the results from the query of each row in to a multidimensional array. But then how would I add to the array after the initial row? BTW, I'm using PHP 3.0.16 so I can't use the added array functions that PHP 4 has. I do plan on upgrading soon. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] mail() question
Well, not sure if this is a solution for you but I've done it with something like this: If ($Page == "Form") { // Form itself with hidden field Page=Mailer } else if($Page == "Mailer") { // Send the mail header("Location: youraddress?Page=Form"); }; Hope this helps. Niklas -Original Message- From: Jeff Kryvicky @ Collider [mailto:[EMAIL PROTECTED]] Sent: 24. lokakuuta 2001 0:33 To: [EMAIL PROTECTED] Subject: [PHP] mail() question Hi all, I've got a question that I'm sure can be answered, but I'm a little stuck right now... I've set up yelvington's excellent annotate script, and it works beautifully. My next step was to try to add an auto email function to notify me when someone has posted a comment, and send me the entire question list. (I'll be using this for client feedback) Everything works extremely peachy, EXCEPT the mail gets posted on every page update, not just on the button press. So the question is... is there a way to create this feature that only occurs when the submit button is pressed? Below is the code in it's entirety, with this code: being placed in the html document. Thanks a million in advance. (btw, if you do choose to answer this, cc me as well, as I'm on digest.) Jeff /***/ ", $message); $date = date("l, F j Y, h:i a"); $message = "$name -- $date $message "; $fp = fopen (basename($PHP_SELF) . ".comment", "a"); fwrite ($fp, $message); fclose ($fp); } @readfile(basename(($PHP_SELF . ".comment"))); // function to open a file and place the file into //a buffer for further processing function open_template($template_file) { $i; $output; $temp = file($template_file); for ($i=0; $i", chr(10), $buffer); //replace html breaks with returns $buffer = str_replace("", chr(10), $buffer); //strip all other html tags $buffer = strip_tags($buffer); //email away... mail("[EMAIL PROTECTED]", "Auto Form Reply", $buffer); ?> Your name: Your comment: -- ___ Jeff Kryvicky Collider, Inc. [motion graphics for the masses] 133 W 19th St 5th Floor NYC 10011 Tel 646 336 9398 Fax 646 349 4159 Email [EMAIL PROTECTED] Site http://www.collidernyc.com ___ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Update Query - Urgent
How about some code to see? Niklas -Original Message- From: Srinivasan Ranganathan [mailto:[EMAIL PROTECTED]] Sent: 23. lokakuuta 2001 15:22 To: [EMAIL PROTECTED] Subject: [PHP] Update Query - Urgent Hi I have a php script generate a sql update statement. when i query the database, the update dosent happen. but when i echo the sql string and copy and paste it in my mysql client window, the update happens like it should! what am i missing/doing wrong here? Thanks in advance Srinivasan Ranganthan *NEW* Connect to Yahoo! Messenger through your mobile phone *NEW* Visit http://in.mobile.yahoo.com/smsmgr_signin.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Funny thing with variables
F... read it and got it! ;) I had no idea what to look for.. Niklas P.S. Thanks -Original Message- From: Tomy Wagner [mailto:[EMAIL PROTECTED]] Sent: 22. lokakuuta 2001 15:16 To: Niklas Lampén; Php-General Subject: Re: [PHP] Funny thing with variables rtfm :o http://www.php.net/manual/en/language.operators.bitwise.php Wagner Tomy Web Developer Editus Luxembourg S.A. - Original Message - From: "Niklas Lampén" <[EMAIL PROTECTED]> To: "Php-General" <[EMAIL PROTECTED]> Sent: Monday, October 22, 2001 1:59 PM Subject: [PHP] Funny thing with variables > What causes this: > > I have a page getting variable $BackLink with string "http://www.domain.com/my_page.php4. > I accidentaly wrote and what I got out was > "—‹‹ÅÐЈˆˆÑ™– ‘“ž‘›š‡‹ŒÑœ’Й™š šŽŠšŒ‹ ™‘‹Ñ—Ë". What causes this? What does that ~ sign do before a variable? > > > Niklas Lampén > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Funny thing with variables
What causes this: I have a page getting variable $BackLink with string "http://www.domain.com/my_page.php4";. I accidentaly wrote and what I got out was "—‹‹ÅÐЈˆˆÑ™–‘“ž‘›š‡‹ŒÑœ’Й™š šŽŠšŒ‹ ™‘‹Ñ—Ë". What causes this? What does that ~ sign do before a variable? Niklas Lampén
RE: [PHP] Parsing a CSV file
That won't do if the list is 'R001,23,"2,5"'. I'd break that to parts with preg_match_all(). Niklas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 3. lokakuuta 2001 15:08 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Parsing a CSV file sure. explode (',', $yourdata) is what you are looking for. use file () to read in the file and use foreach () to iterate over the lines. D. Alvarez Arribas <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Quickie
If nothing is beeing sent to output on the page then use header() else you need to use javascript. Niklas -Original Message- From: Daniel Alsén [mailto:[EMAIL PROTECTED]] Sent: 21. syyskuuta 2001 15:51 To: php Subject: [PHP] Quickie How do i send the user on to another page at the end of the execution of a script? # Daniel Alsén| www.mindbash.com # # [EMAIL PROTECTED] | +46 704 86 14 92 # # ICQ: 63006462 | # -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Speeding up program
How big difference does it make in speed in these: or So actually I'm asking how much more/less it takes time to do the comparing against mysql_num_rows() insted of comparing against a variable. Niklas
RE: [PHP] Can I use Microsoft Access as a database?
Try: $odbcId = odbc_connect("phpodbc.dsn", "admin", ""); Niklas -Original Message- From: A. op de Weegh [mailto:[EMAIL PROTECTED]] Sent: 18. syyskuuta 2001 10:57 To: [EMAIL PROTECTED] Subject: Re: [PHP] Can I use Microsoft Access as a database? Thanks, but since I am unfamiliar using this kind of database connection, I was hoping you could help me out some more. I did the following. In the ODBC Data Source Administrator of Windows 98 I have created a new file DSN. This DSN is configured to use a certain Access 2000 database on one of my harddisks. The DSN is called 'phpodbc.dsn'. Then, in the file odbc.php I do the following: When I access this PHP file with Internet Explorer, I get the following error message: Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\Inetpub\wwwroot\odbc.php on line 3. Any ideas? Thanks, Alex "Niklas lampén" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I think that ODBC is your solution. > > > Niklas > > -Original Message- > From: A. op de Weegh [mailto:[EMAIL PROTECTED]] > Sent: 15. syyskuuta 2001 13:05 > To: [EMAIL PROTECTED] > Subject: [PHP] Can I use Microsoft Access as a database? > > > Hi all, > for testing purposes in a school environment, I would like to use a > Microsoft Access database with PHP. I know how to connect to and use a MySQL > database, but I can't find any functions for accessing Microsoft Access > databases. > > Can anyone help me out here? > > Thankx, > Alex > > -- > PS: Replace the underscore (_) in my e-mail address with a minus sign (-). > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: MySQL query error
:) It just started to work. World's a strange place. Maybe someone was doing something to the server/php/mysql, dunno. Niklas -Original Message- From: _lallous [mailto:[EMAIL PROTECTED]] Sent: 17. syyskuuta 2001 15:03 To: [EMAIL PROTECTED] Subject: [PHP] Re: MySQL query error > mysql_quory($Query); typos i can't also see more errors... "Niklas lampén" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Code: > $Query = "UPDATE feRegUsers SET Constructor='2001-09-17', > Enertec='2001-09-17', Seatec='2001-09-17' WHERE ID LIKE '288'"; > mysql_quory($Query); > print mysql_error(); > ?> > > That results > "You have an error in your SQL syntax near 'Constructor='2001-09-17', > Enertec='2001-09-17', Seatec='2001-09-17'' at line 1". > > What's wrong? I don't see anything that can be wrong! Am I blind once again? > > > Niklas > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] MySQL query error
Code: That results "You have an error in your SQL syntax near 'Constructor='2001-09-17', Enertec='2001-09-17', Seatec='2001-09-17'' at line 1". What's wrong? I don't see anything that can be wrong! Am I blind once again? Niklas
RE: [PHP] Can I use Microsoft Access as a database?
I think that ODBC is your solution. Niklas -Original Message- From: A. op de Weegh [mailto:[EMAIL PROTECTED]] Sent: 15. syyskuuta 2001 13:05 To: [EMAIL PROTECTED] Subject: [PHP] Can I use Microsoft Access as a database? Hi all, for testing purposes in a school environment, I would like to use a Microsoft Access database with PHP. I know how to connect to and use a MySQL database, but I can't find any functions for accessing Microsoft Access databases. Can anyone help me out here? Thankx, Alex -- PS: Replace the underscore (_) in my e-mail address with a minus sign (-). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] another easy cookie question
First of all, before header() or setcookie() can't be any outputing code (like html). And here if you do: mailto:[EMAIL PROTECTED]] Sent: 14. syyskuuta 2001 12:47 To: [EMAIL PROTECTED] Subject: [PHP] another easy cookie question Hi all, This is what I have at the top of my php page (php-4.0.6-winNT). Untitled Document I get the following error. CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: ... and nothing else! Where am I going wrong? I bet it's a simple answer. George P in Edinburgh _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] R: File Uploads
I'd use preg_match(). Something like should do the trick: if ($file != ".htaccess" && $file != "." && $file != ".."&& !preg_match("/(.*)\.php/i", $file)) Niklas -Original Message- From: --- [mailto:[EMAIL PROTECTED]] Sent: 14. syyskuuta 2001 11:09 To: [EMAIL PROTECTED] Subject: [PHP] R: File Uploads you can use strrchr to find the extension, like this: if ($file != ".htaccess" && $file != "." && $file != ".."&& strrchr($file,".") != ".php") Try to see php manual, probably i mispelled it. -- Federico [EMAIL PROTECTED] -- Christopher Cm Allen <[EMAIL PROTECTED]> wrote in message 008d01c13c6c$3a41a640$[EMAIL PROTECTED] Greetings: Looking for a way to say *.php in this code: if ($file != ".htaccess" && $file != "." && $file != ".."&& $file != ANY PHP FILE) I have tried *.php... Any Ideas? Thanks CCMA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] cookies
Heh, sure not related to PHP but one search engine in finland sends a variable "e" with value "mc2". :) Niklas -Original Message- From: Jason Murray [mailto:[EMAIL PROTECTED]] Sent: 14. syyskuuta 2001 8:59 To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: [PHP] cookies > Don't they taste great? > > Okay okay.. Someone at IGN has a sense of humour. They send cookies named "h2" with a value of "o" (water), and "oatmeal" with a value of "yumyum". :) Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: problem with form values
Heh, we seem to have a bit of a problem with communicating with each other.. :) What I ment with the question is that how can I do something to the string before the form sends information to the next page? So can I somehow modify strings after pressing submit but before next page? Something like onSubmit="blah()". Niklas -Original Message- From: James Holloway [mailto:[EMAIL PROTECTED]] Sent: 12. syyskuuta 2001 12:01 To: Niklas Lampén Cc: [EMAIL PROTECTED] Subject: [PHP] Re: problem with form values Sorry, I didn't mean it quite like that. After the user presses submit $string = htmlentities($string); // now, do whatever with the string J - Original Message - From: Niklas Lampén To: James Holloway ; Php-General Sent: Wednesday, September 12, 2001 9:52 AM Subject: RE: problem with form values How to do anything to the strings in php BEFORE the form is sent? Niklas -Original Message- From: James Holloway [mailto:[EMAIL PROTECTED]] Sent: 12. syyskuuta 2001 11:28 To: Niklas lampén Subject: Re: problem with form values Hi Niklas, use htmlentities() or htmlspecialchars() on the string before the form is sent. See the manual for more info. James - Original Message - From: Niklas lampén Newsgroups: php.general To: Php-General Sent: Wednesday, September 12, 2001 8:32 AM Subject: problem with form values If a user enters a quota ( " ) to a form field and sends it, the page trying to process values gets only a backslash ( \ ). No matter if I use GET or POST. How to get the right kind of a value? Niklas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] RE: problem with form values
How to do anything to the strings in php BEFORE the form is sent? Niklas -Original Message- From: James Holloway [mailto:[EMAIL PROTECTED]] Sent: 12. syyskuuta 2001 11:28 To: Niklas lampén Subject: Re: problem with form values Hi Niklas, use htmlentities() or htmlspecialchars() on the string before the form is sent. See the manual for more info. James - Original Message - From: Niklas lampén Newsgroups: php.general To: Php-General Sent: Wednesday, September 12, 2001 8:32 AM Subject: problem with form values If a user enters a quota ( " ) to a form field and sends it, the page trying to process values gets only a backslash ( \ ). No matter if I use GET or POST. How to get the right kind of a value? Niklas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: problem with form values
This is what my form returns with search '"great port"': http://domain/file.php4?Parent=1&Keyword=\ and this with search 'great port' (no quotas): http://domain/file.php4?Parent=1&Keyword=great port&Name=&Province=---&Submit=Search&Type=text I need to get quotas to the keyword-field, so I can create better search engine. How to do that? Niklas -Original Message- From: Adam [mailto:[EMAIL PROTECTED]] Sent: 12. syyskuuta 2001 11:24 To: [EMAIL PROTECTED] Subject: [PHP] Re: problem with form values show us a snippet so we can evaluate the cause -A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] problem with form values
If a user enters a quota ( " ) to a form field and sends it, the page trying to process values gets only a backslash ( \ ). No matter if I use GET or POST. How to get the right kind of a value? Niklas
RE: [PHP] Re: Sessions Getting Broken
session_start(); if (!session_is_registered("Session")) { toStart(2); exit; }; $Session = $GLOBALS[Session]; This is what I do on every page. I don't think it's timeout, since the session might get broken just after 5 minutes. function toStart() is used to move user to the login page with an error code. Niklas -Original Message- From: _lallous [mailto:[EMAIL PROTECTED]] Sent: 11. syyskuuta 2001 14:35 To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Sessions Getting Broken Can't tell like that No more ideasmaybe somecode would help?! "Niklas lampén" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hmm.. How do I know how fast they timeout? And it seems that all of my users > drop at the same time, not sure about it thou. > > session.cache_expire is set to 180. > session.cookie_lifetime is 0. > > Maybe those do tell you something and you tell me more! :) > > > Niklas > > -Original Message- > From: _lallous [mailto:[EMAIL PROTECTED]] > Sent: 11. syyskuuta 2001 13:09 > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Sessions Getting Broken > > > Maybe it's getting timed out? > > "Niklas lampén" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I have a database update system and I regonize users with sessions. > > Sometimes sessions just broke with no sane (for me at least) reason. > > > > Any ideas what may cause this, it's pretty anoying if you have updated 20 > > fields, try to submit the form and then you get kicked out of the > system!?! > > Otherwise my sessions work great. :) > > > > > > > > Niklas > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: Sessions Getting Broken
Hmm.. How do I know how fast they timeout? And it seems that all of my users drop at the same time, not sure about it thou. session.cache_expire is set to 180. session.cookie_lifetime is 0. Maybe those do tell you something and you tell me more! :) Niklas -Original Message- From: _lallous [mailto:[EMAIL PROTECTED]] Sent: 11. syyskuuta 2001 13:09 To: [EMAIL PROTECTED] Subject: [PHP] Re: Sessions Getting Broken Maybe it's getting timed out? "Niklas lampén" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a database update system and I regonize users with sessions. > Sometimes sessions just broke with no sane (for me at least) reason. > > Any ideas what may cause this, it's pretty anoying if you have updated 20 > fields, try to submit the form and then you get kicked out of the system!?! > Otherwise my sessions work great. :) > > > > Niklas > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Sessions Getting Broken
I have a database update system and I regonize users with sessions. Sometimes sessions just broke with no sane (for me at least) reason. Any ideas what may cause this, it's pretty anoying if you have updated 20 fields, try to submit the form and then you get kicked out of the system!?! Otherwise my sessions work great. :) Niklas
[PHP] Sessions getting broken
I have a problem with sessions. My sessions work well except for one thing: they keep getting broken from time to time. I have found no common thing with these brokes so I'm quite lost with this problem. Any ideas? It seems that all of the sessions brake at the same time. (I have a collegue with me in same room and we have lost the session at the very same time couple of times). Niklas
RE: [PHP] extending array
If you wish $shoplist[$pid] have $price in it with $units, you have to make $shoplist a multidimensional array which is simpple: Try that out, it should give you the idea. You can make it even more multidimensional if you need to. Niklas -Original Message- From: Kristofer Thorssell [mailto:[EMAIL PROTECTED]] Sent: 7. syyskuuta 2001 12:55 To: Php-General (E-mail) Subject: [PHP] extending array Hi, I want to extend an existing array. the array is $shoplist[$pid] = $units; and i want to have $ price in it too. How do I do? /Kristofer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Mailing, which is faster
Which is faster (and/or smarter), using function mail() or doing it by popen("/blah/sendmail")? Niklas
RE: [PHP] Another script doesnt work!
If line 22 is '$message = blah!!' it should be '$message = "blah!!";' or then you're missing a ';' from the end of previous line. Niklas -Original Message- From: Kyle Smith [mailto:[EMAIL PROTECTED]] Sent: 4. syyskuuta 2001 23:19 To: [EMAIL PROTECTED] Subject: [PHP] Another script doesnt work! And this time its not because of a dot, someone please help! Parse error: parse error in /web/sites/197/lk6/www.stupeedstudios.f2s.com/dannys/sendform.php on line 22 line 22 is $message = blah!! -lk6- http://www.StupeedStudios.f2s.com Home of the burning lego man! ICQ: 115852509 MSN: [EMAIL PROTECTED] AIM: legokiller666 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Text area's width in NS
This helped me out (at least made my site look nicer :), but is there a way set text area's width like this? Doesn't seem to work with same code. IE however works great. Why the hell there can not be just ONE standard?!? Niklas -Original Message- From: * R&zE: [mailto:[EMAIL PROTECTED]] Sent: 3. syyskuuta 2001 10:42 To: Balaji Ankem Cc: [EMAIL PROTECTED] Subject: Re: [PHP] hi Hey there, This is the solution for setting the width of your select-box (which I think you want to do): ---options here--- The width-attribute sets the width in NS, while the style-attribute sets the width in IE. Don't you just love this kind of compatibility?!?! Anyway... using both attributes makes sure the select-box is shown with the same width in both browsers. -- * R&zE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] If-statement
Is it possible to write this shorter: if ($Var != "No1" && $Var != "No2" && $Var != "No3") { code }; Niklas
RE: [PHP] How do I read the first n lines from a file?
Yes. Then you have to do it a bit differently: $file = file("list.txt"); // $file is now an array of lines in "list.txt" for ($i = count($file); $i > count($file) - 10; $i--) { print "$file[$i]"; }; That should do. Didn't try it thou. That prints the lines in order last, last-1, last-2 Niklas -Original Message- From: Tauntz [mailto:[EMAIL PROTECTED]] Sent: 28. elokuuta 2001 15:00 To: php Subject: Re: [PHP] How do I read the first n lines from a file? hey.. thank you.. but is it possible to read the last lets say 10 lines from a file ? - Original Message - From: "Niklas Lampén" <[EMAIL PROTECTED]> To: "Tauntz" <[EMAIL PROTECTED]>; "Php-General" <[EMAIL PROTECTED]> Sent: Tuesday, August 28, 2001 3:28 PM Subject: RE: [PHP] How do I read the first n lines from a file? > You can do this: > > $i = 0; > $fp = fopen("list.txt", "r"); > while (!feof($fp) && $i < 10) { > $i++; > $Text = fgets($fp, 4096); // Reads first 4096 characters from a row. > print "$Text\n"; > }; > > > Niklas > > -Original Message- > From: Tauntz [mailto:[EMAIL PROTECTED]] > Sent: 28. elokuuta 2001 14:13 > To: [EMAIL PROTECTED] > Subject: [PHP] How do I read the first n lines from a file? > > > hi ! > > I have a simmple question :).. > > Lets say that I have a file called: > list.txt > and I want to take the first 10 lines from it & echo it to the browser ? > > thank you > [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] How do I read the first n lines from a file?
Oops.. Forgot to close the file. Put as last line: fclose($fp); Niklas -Original Message- From: Niklas Lampén [mailto:[EMAIL PROTECTED]] Sent: 28. elokuuta 2001 15:29 To: Tauntz; Php-General Subject: RE: [PHP] How do I read the first n lines from a file? You can do this: $i = 0; $fp = fopen("list.txt", "r"); while (!feof($fp) && $i < 10) { $i++; $Text = fgets($fp, 4096); // Reads first 4096 characters from a row. print "$Text\n"; }; Niklas -Original Message- From: Tauntz [mailto:[EMAIL PROTECTED]] Sent: 28. elokuuta 2001 14:13 To: [EMAIL PROTECTED] Subject: [PHP] How do I read the first n lines from a file? hi ! I have a simmple question :).. Lets say that I have a file called: list.txt and I want to take the first 10 lines from it & echo it to the browser ? thank you [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] How do I read the first n lines from a file?
You can do this: $i = 0; $fp = fopen("list.txt", "r"); while (!feof($fp) && $i < 10) { $i++; $Text = fgets($fp, 4096); // Reads first 4096 characters from a row. print "$Text\n"; }; Niklas -Original Message- From: Tauntz [mailto:[EMAIL PROTECTED]] Sent: 28. elokuuta 2001 14:13 To: [EMAIL PROTECTED] Subject: [PHP] How do I read the first n lines from a file? hi ! I have a simmple question :).. Lets say that I have a file called: list.txt and I want to take the first 10 lines from it & echo it to the browser ? thank you [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] What does PHP stand for?
So PHP stands for "Personal Home Pages Hypertext Preprocessor". What a nice name! :) Niklas -Original Message- From: Jon Farmer [mailto:[EMAIL PROTECTED]] Sent: 28. elokuuta 2001 14:04 To: Niklas Lampén; Php-General Subject: RE: [PHP] What does PHP stand for? Well I guess Rasmus is the guy who knows but as I understand it, it was originally Personal Home Pages and became PHP Hypertext Preprocessor later Regards jon -- Jon Farmer Õ¿Õ¬ Systems Programmer, Entanet www.enta.net Tel +44 (0)1952 428969 Mob +44 (0)7968 524175 PGP Key available, send blank email to [EMAIL PROTECTED] -Original Message----- From: Niklas Lampén [mailto:[EMAIL PROTECTED]] Sent: 28 August 2001 11:38 To: Php-General Subject: [PHP] What does PHP stand for? It just crossed my mind: I don't know what PHP stands for...so anyone? :) Niklas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] What does PHP stand for?
Funny that there is no meanin for the first P. Niklas -Original Message- From: Jon Haworth [mailto:[EMAIL PROTECTED]] Sent: 28. elokuuta 2001 13:57 To: 'Niklas Lampén'; Php-General Subject: RE: [PHP] What does PHP stand for? PHP Hypertext Preprocessor (yes, it's recursive) HTH Jon -Original Message----- From: Niklas Lampén [mailto:[EMAIL PROTECTED]] Sent: 28 August 2001 11:38 To: Php-General Subject: [PHP] What does PHP stand for? It just crossed my mind: I don't know what PHP stands for...so anyone? :) Niklas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] What does PHP stand for?
It just crossed my mind: I don't know what PHP stands for...so anyone? :) Niklas
[PHP] MySQL query length
Can it cause any problems if mySQL query is very long? I have to compare many words to many fields in my DB and I've done it like "Field LIKE '%searchword%' || Field LIKE '%searchword%' || Field LIKE '%searchword%'.". Query is build by a function, so I don't know the exact length but it is VERY long. I also have to compare several words to one field so I've done many of those "Field LIKE '%blah%'" for those too. Is there any smarter way to do this? Niklas Lampén Internet Developer PubliCo Oy Ruoholahdenkatu 8 A FIN-00180 HELSINKI P. +358 - 9 - 6866 2541 F. +358 - 9 - 685 2940 E. [EMAIL PROTECTED] W. www.finlandexports.com
RE: [PHP] Web fetching script
That file doesn't exist. Put it there again so I can take a look at it. And pls notify me when it's there. :) Niklas -Original Message- From: Ben Quinn [mailto:[EMAIL PROTECTED]] Sent: 27. elokuuta 2001 11:41 To: Php-General Cc: Niklas Lampén; [EMAIL PROTECTED] Subject: Re: [PHP] Web fetching script G'day David, Niklas As usual i'm in way over my head so i'm going to be a real pain and ask for more help Niklas, unfortunately the start and stop points change constantly, i'm hoping to get around this by using the substr() function - luckily the format (in tables) stays the same My main objective is for the file to be read once only, by the time i'm finished i'll probably be grabbing 20-30 different areas of text/numbers from a file, and i'm paying for anything over 1gig downloaded from my account each month, so it could end up quite expensive. This is an example of the file i'm grabbing from http://www.arl.noaa.gov/data/ready/usr/897_profile.txt David, i couldn't get what you said to work - any chance of a quick example? :-) - Original Message - From: "David Robley" <[EMAIL PROTECTED]> To: "Ben Quinn" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, August 27, 2001 5:58 PM Subject: Re: [PHP] Web fetching script > On Mon, 27 Aug 2001 17:10, Ben Quinn wrote: > > G'day Guys > > > > Sorry, i should have explained it better. What i want to do is grab 2 > > different lots of text from the same page. Say the page had this text > > > > 10am > > Some text > > 12pm > > Different text > > 2pm > > > > I want to be able to grab from say 10am to 12pm and store it in $texta > > and then grab from 12pm to 2pm and store it in $textb - but with the > > script i've pasted below i can only grab one lot of text at a time! to > > grab 2 lots of text from the same page i have to have 2 scripts and in > > the end i've opened up and closed the page twice! Anyway, any help i > > can get will be much appreciated > > > > This is the script i'm using > > > > > $GrabURL = "url.txt"; > > $GrabStart = "start"; > > $GrabEnd = "stop"; > > > > $file = fopen("$GrabURL", "r"); > > $rf = fread($file, 2); > > $grab = eregi("$GrabStart(.*)$GrabEnd", $rf, $printing); > > > > $printing[1] = str_replace("replacedatestamp", "withnewstamp", > > $printing[1]); > > Here, reset your start and finish criteria and do the eregi again, > assigning the result to $grab2. > > > > fclose($file); > > echo $printing[1]; > > > > ?> > > Unless I'm missing what you're trying to do, of course. > > -- > David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc > CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA > >Manure Occurs. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Web fetching script
You could do this if your $GrabStart and $GrabStop are ALLWAYS the same (Like: ###START### 10pm Blah ###STOP### ###START### 12pm Blahblah ###STOP### ) $file = file("url.txt"); $str = join("\n", $file); // You can use whatever to join the rows $GrabStart = "###START###"; $GrabEnd = "###STOP###"; then use preg_match_all() to match everything between $GrabStart and $GrabStop. Hopefully this helped you out. -Original Message- From: Ben Quinn [mailto:[EMAIL PROTECTED]] Sent: 27. elokuuta 2001 10:41 To: Dave; [EMAIL PROTECTED] Subject: Re: [PHP] Web fetching script G'day Guys Sorry, i should have explained it better. What i want to do is grab 2 different lots of text from the same page. Say the page had this text 10am Some text 12pm Different text 2pm I want to be able to grab from say 10am to 12pm and store it in $texta and then grab from 12pm to 2pm and store it in $textb - but with the script i've pasted below i can only grab one lot of text at a time! to grab 2 lots of text from the same page i have to have 2 scripts and in the end i've opened up and closed the page twice! Anyway, any help i can get will be much appreciated This is the script i'm using - Original Message - From: "Dave" <[EMAIL PROTECTED]> To: "Ben Quinn" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, August 22, 2001 10:57 PM Subject: RE: [PHP] Web fetching script > What response are you expecting, and what response are you getting? > > assuming your regex is working as expected, you are running it twice to receive > the same result into 2 different variables??? why not just copy the variable > after > > additionally, $printing is filled with the matches of your regex(10 of them > according to manual) as such you have to specify which element of $printing you > are wanting to print, or you will get the lovely "array" output > > I don't understand why the grab variables are there unless you need them later. > Without accounting for your regex... > > eregi("$GrabStart(.*)$GrabEnd", $rf, $printing); > echo $printing[1]; > $printingb=$printing; > echo $printingb[1]; > > >I have a web fetching script that fetches text from an external URL and I > >would like to grab two lots of text at the same time - can anyone tell me > >why this isn't working? > > > > > > >$GrabURL = "http://grabfile.html";; > >$GrabStart = "start"; > >$GrabEnd = "stop"; > > > >$file = fopen("$GrabURL", "r"); > > > >$rf = fread($file, 2); > > > >$grab = eregi("$GrabStart(.*)$GrabEnd", $rf, $printing); > > > >echo $printing; > > > >rewind($rf); > > > >$grab2 = eregi("$GrabStart(.*)$GrabEnd", $rf, $printingb); > > > >echo $printingb; > > > >fclose($file); > > > >?> > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Reading files from a directory
I have problem with reading files from directory. This is the code: \n"; }; ?> That is ALL code on a script file. These are the file in directory: . .. array_maker.php4 map.php4 renamer.php4 border_bl.gif border_bm.gif border_br.gif border_ml.gif border_mr.gif border_ul.gif border_um.gif border_ur.gif grid.gif map_config.php4 map_dot.php4 handle.php4 map_dot.gif core md_998634933_071758800998634933.gif md_998634937_060465500998634937.gif md_998634941_025996400998634941.gif If I have more than five of the files named like "md_123456789_12345.gif" page returns Internal Server Error (500). What can cause this? Is there a solution? Niklas
RE: [PHP] Removing files from a directory
Solved it by myself. :) unlink($file); needs to be *exact* address to the file to be unlinked like "/www/dir/map/$file". Just in case if someone else meets this problem! Niklas -Original Message----- From: Niklas Lampén [mailto:[EMAIL PROTECTED]] Sent: 23. elokuuta 2001 15:17 To: Php-General Subject: [PHP] Removing files from a directory I'm trying to remove files from a directory. I have this code to do it: This code is in a included file located at '/map/'. File including this code is located at '/'. Files to be removed are located at '/map/'. $Handle = opendir('map/'); while ($file = readdir($Handle)) { if (substr($file, 0, 3) == "md_") { $split = explode("_", $file); if ((time() - $split[1]) > 300) { unlink($file); }; }; }; What this does is return a Internal Server Error! If add do unlink("map/".$file); it returns file not found. What to do? What is wrong? Niklas Lampén -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Removing files from a directory
I'm trying to remove files from a directory. I have this code to do it: This code is in a included file located at '/map/'. File including this code is located at '/'. Files to be removed are located at '/map/'. $Handle = opendir('map/'); while ($file = readdir($Handle)) { if (substr($file, 0, 3) == "md_") { $split = explode("_", $file); if ((time() - $split[1]) > 300) { unlink($file); }; }; }; What this does is return a Internal Server Error! If add do unlink("map/".$file); it returns file not found. What to do? What is wrong? Niklas Lampén
RE: [PHP] How can I insert the data into the begining of a text file
Use $fp = fopen($file, "r+"); PHP Manual would have told you this. Niklas -Original Message- From: Zenith [mailto:[EMAIL PROTECTED]] Sent: 22. elokuuta 2001 12:39 To: [EMAIL PROTECTED] Subject: [PHP] How can I insert the data into the begining of a text file I orginal have a function like the following... $fp = fopen ( $HTTP_SERVER_VARS['DOCUMENT_ROOT']."/log/debug_message.txt", "a" ); fputs ( $fp, "\nDebug message from : $PHP_SELF\n" ); fputs ( $fp, "\t$message\n\n" ); fclose ( $fp ); But I found that, the result is, all message is append to the end of a file. Can I insert the text into the begining of the file?? I think read all the text from the file first, arrang the string variable, so that the new message can insert, would be a solution. But is it stupid to do so?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] mySQL Query - comparing multiple values with one field
What I need to do is to compare if one field matches a value from a huge list of values. Do I need to query like "SELECT * FROM table WHERE field LIKE '%value1%' || field LIKE '%value2%'" or can I do it something like this "SELECT * FROM table WHERE field LIKE ('%value1%' || '%value2%')"? Niklas Lampén
RE: Re[2]: [PHP] php query for mysql table
This can be solved by building a function to split users entry to pieces so that the query will be like "SELECT * FROM table WHERE Question LIKE '%word1%' || Question LIKE '%word2%' || Question." if only one of the words have to match the Question field. Niklas Lampén -Original Message- From: Morten Winkler Jørgensen [mailto:[EMAIL PROTECTED]] Sent: 20. elokuuta 2001 13:47 To: [EMAIL PROTECTED] Subject: Re[2]: [PHP] php query for mysql table Notice that if a user enters "life anger" in the search field SELECT * FROM table WHERE question LIKE "%life anger%" none of the questions >> [1] How do you deal with anger? >> [2] Ever been full of anger in your life? >> [3] Is life always easy? will match. For that you must split the query by " " and perform a SELECT * FROM table WHERE question LIKE "%life%" OR question LIKE "%anger%" or possibly change the OR with a AND. Kind regards, Morten Winkler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] php query for mysql table
% works as a wildcard in mySQL. Example: "SELECT * FROM table WHERE Question LIKE '%life%'" would return all rows with field Question containing string "life". Niklas -Original Message- From: Wolfgang Schneider [mailto:[EMAIL PROTECTED]] Sent: 20. elokuuta 2001 13:22 To: php-general Subject: [PHP] php query for mysql table Hi I am a newbie to php + mysql and wanted to ask for some help on a particular item which I can't seem to find "the right key" in the documentation. I am trying to set up a simple Q&A system with an entry page where one can select to either have all questions & answers from a mysql database displayed or else search with a text field for only those questions which contain a certain word(s). Can someone tell me how to set in a query when trying to find records in a mysql table that have a certain word or perhaps 2 or 3 words (among others) ...? I know about using SELECT and WHERE in order to find records which match *exactly*, but am looking for something a bit different ... Example: The values of 3 records for the "question" field of the database might be the following: [1] How do you deal with anger? [2] Ever been full of anger in your life? [3] Is life always easy? How can I set a PHP query with SELECT and WHERE to express the following: Which questions contain the word "life"? That is, have someone search the database in the "question" field for records where the word "life" is used as part of the question ... The result then should return the records 2 & 3 above Any help is greatly appreciated. Thanks mucho. God bless you with His grace and peace Wolfgang Looking for Biblical information? COME AND SEE! -- ONLINE Courses: http://classes.bibelcenter.de ... NEW! -- BibelCenter: http://www.bibelcenter.de -- Bookstore: http://www.worthy.net/BibelCenter/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]