[PHP] for loops
Just a query ... has any one else noticed this for($i = a; $i < z; $i++) { print $i; echo "";} will print out a right down to yz but replace the letters with numbers eg for($i = 1; $i < 10; $i++) { print $i; echo "";} and it prints 1 thru to 10 and any one know a reason for this? Cheers Peter "the only dumb question is the one that wasn't asked" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] For ... in ...
Javascript has this very neat control structure that makes it easy to iterate over the properties of an object. It would be nice to see something similiar in PHP. I often use Objects as a way of "packing" data in a more orderly fashion, and sometimes I need to do stuff to all the properties of an object. A good example is when I have an object whose properties are coming from a form, and going back to the very same form if there were errors in the form. I will have to perform addslashes() and stripslashes() on all the properties in the object, and writing this without a loop can be very tedious. André Næss -- 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] for loop problem
I have a problem with a piece of code that uses the mail function in a for loop. It sends out mail to all the users in the database but it has a problem with attaching their specific name into the message. What happens is the first user in the database will get their name in the e-mail (Dear John,). Then the second user in the database will get the last users name and their name in the e-mail (Dear John, Dear Mike) ...and so on and so forth. How do I fix this problem? Your help is appreciated. Here is the code: If ($button != "") { $t = mysql_query("SELECT * from AddExisting"); $number_of_customers = mysql_num_rows($t); for($i=0; $i<$number_of_customers;$i++) { $r = mysql_fetch_array($t); $email = $r["EMAIL_ADDRESS"]; $cusname = $r["Name"]; $to = $email; $subject = "hello"; $message = "Dear $cusname,".$message; $fromaddress = "[EMAIL PROTECTED]"; mail($to, $subject, $message, $fromaddress); }//end of for }//end of if
Re: [PHP] for loops
On Thursday 30 May 2002 11:46, Peter wrote: > Just a query ... has any one else noticed this > > for($i = a; $i < z; $i++) > { > print $i; > echo "";} > > will print out a right down to yz It should only print to 'y' ... > but replace the letters with numbers eg > > for($i = 1; $i < 10; $i++) > { > print $i; > echo "";} > > and it prints 1 thru to 10 ... and should only print to '9' ... > and any one know a reason for this? ... so if it does otherwise for you then you've got a bug in your version of php! -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Many people are desperately looking for some wise advice which will recommend that they do what they want to do. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] for loops
it works for me just the way you have itexcept of course that you are telling it to only print to "y" because you are saying On Thursday 30 May 2002 11:46, Peter wrote: > > Just a query ... has any one else noticed this > > > > for($i = a; $i < z; $i++) > > { > > print $i; > > echo "";} > > > > will print out a right down to yz > >It should only print to 'y' ... > > > but replace the letters with numbers eg > > > > for($i = 1; $i < 10; $i++) > > { > > print $i; > > echo "";} > > > > and it prints 1 thru to 10 > >... and should only print to '9' ... > > > and any one know a reason for this? > >... so if it does otherwise for you then you've got a bug in your version of >php! > >-- >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk >Open Source Software Systems Integrators >* Web Design & Hosting * Internet & Intranet Applications Development * > >/* >Many people are desperately looking for some wise advice which will >recommend that they do what they want to do. >*/ > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php > > >-- >This message has been scanned for viruses and >dangerous content by MailScanner, and is >believed to be clean. >ow3 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] for loop problem?
Hello everyone, I have a pretty big list of codes that need to be put into a mysql db. The numbers range from 100 to 1223109. Here's the PHP I wrote to put these codes into a database: ".mysql_error().""; exit; } } mysql_close($connection); ?> Everytime I run this from a browser, it just keeps looping. It should put about 223109 entries into the "passcodes" table. However, it just keeps looping. I'll end up with 400,000 or so entries before I stop it. I make sure I empty that table before I start running it again. Why is this happening? Thanks everyone, Tyler -- 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] For RegExp Experts.
Does anyone around knows the regular expression that matches all the ocurrences of a word (p.e. "needle") not within PHP code, i.e., outside the tags? By the way, is there a good online tutorial or reference on regular expressions? Thanks a lot. -- 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] For My Information
I see in the posts, that a lot of people are using Apache on NT instead of the built in IIS. Is there a reason? I have PHP up and running with dBase tables converted to MySQL and ODBC connected to Access 2000, on an NT 4 box with IIS 4 and it runs very well. Performance is great. My only problem is automating the conversion to update tables in MySQL. I would like like to convert the Access 2000 tables also but the converters either don't seem to work with Access 2k, or not much at all, or are not such that a timed batch file can be generated using them. I just looked at what I've written and it's a little jumbled. Mega-Sigh. Let me summarize. 1.. Why Apache on NT 4.0? 2.. Is there a good way to automatically convert Access 2000 to MySQL to keep MySQL data up to date? The data needs to be updated several times a week. No I can't just switch everything over and not have to convert again. 3.. A way to do #2 for dBase would be good too, but less critical because the data only gets updated every couple months. Thanks in advance. Dan Malcolm [EMAIL PROTECTED] [EMAIL PROTECTED]
Re: [PHP] For ... in ...
You can use get_class_vars() or get_object_vars() http://www.php.net/manual/en/function.get-object-vars.php http://www.php.net/manual/en/function.get-class-vars.php You also need to use Variable variables (i.e. $$var) to iterate object properties. v1 = ".$bar->$name."\n"); } ?> Regards, -- Yasuo Ohgaki "André Næss" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Javascript has this very neat control structure that makes it easy to iterate over the properties of an object. It would be nice to see something similiar in PHP. I often use Objects as a way of "packing" data in a more orderly fashion, and sometimes I need to do stuff to all the properties of an object. A good example is when I have an object whose properties are coming from a form, and going back to the very same form if there were errors in the form. I will have to perform addslashes() and stripslashes() on all the properties in the object, and writing this without a loop can be very tedious. André Næss -- 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] For ... in ...
I thought more examples might be useful someone. $name = ".$obj->$name."\n"); } while (list($k,$v) = each($obj)) { print("foo->$k = ".$v."\n"); } foreach ($obj as $k => $v) { print("foo->$k = ".$v."\n"); } foreach ($obj as $k => $v) { print("foo->$k = ".$obj->$k."\n"); } ?> Regards, -- Yasuo Ohgaki "André Næss" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Javascript has this very neat control structure that makes it easy to iterate over the properties of an object. It would be nice to see something similiar in PHP. I often use Objects as a way of "packing" data in a more orderly fashion, and sometimes I need to do stuff to all the properties of an object. A good example is when I have an object whose properties are coming from a form, and going back to the very same form if there were errors in the form. I will have to perform addslashes() and stripslashes() on all the properties in the object, and writing this without a loop can be very tedious. André Næss -- 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] PHP for Win
Any easy way to call Win32 API functions yet? -elias -- 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] PHP for NetWare?
Hi there, Is PHP available for NetWare? I've looked high and low and find no reference to such a beast. I prefer PHP on my Linux box, but I need to explore being able to put it on a NetWare server running Netscape Enterprise. TIA for any pointers in the right direction. Tony Gettig Network Administrator Kalamazoo Public Schools -- 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] for and emailmessage
Hi! I have this file and it doesen´t write my tablerows: $message .= "" $message .= "Varunamn"; $i = 0; $ii = count($vn); for ($i=0;$i<$ii;$i++) { $message .= "".$vn[i].""; } $message .= "Sum"; $message .= ""; I am trying to build a htmlmail but how do I write the for script for all tablerows? Thanks in advance for any help. Regards Jan -- 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] for loop changes?
In PHP Version 4.0.3pl1 for ($i='01';$i<=12;$i++) the increment used to produce 01 02 03 ... 09 10 11 12 but in PHP Version 4.0.6 the identical script for ($i='01';$i<=12;$i++) produces: 01 2 3 ... 9 10 11 12 I want the week and month days to have leading zeros - how can I make the new environment replicate the old? thanks Mike -- 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] PHP for 3D scatterplots
is there any code for this available yet? I am looking for a way of plotting gif images of objects in a 3D space... thank you! Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] for loop problem
Try this: If ($button != "") { $t = mysql_query("SELECT * from AddExisting"); $number_of_customers = mysql_num_rows($t); for($i=0; $i<$number_of_customers;$i++) { $r = mysql_fetch_array($t); $email = $r["EMAIL_ADDRESS"]; $cusname = $r["Name"]; $originalMessage = $message $to = $email; $subject = "hello"; $message = "Dear $cusname,".$originalMessage; $fromaddress = "[EMAIL PROTECTED]"; mail($to, $subject, $message, $fromaddress); }//end of for }//end of if * * Cal Evans * Techno-Mage * http://www.calevans.com * - Original Message - From: "Kris Vose" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 20, 2002 2:07 PM Subject: [PHP] for loop problem I have a problem with a piece of code that uses the mail function in a for loop. It sends out mail to all the users in the database but it has a problem with attaching their specific name into the message. What happens is the first user in the database will get their name in the e-mail (Dear John,). Then the second user in the database will get the last users name and their name in the e-mail (Dear John, Dear Mike) ...and so on and so forth. How do I fix this problem? Your help is appreciated. Here is the code: If ($button != "") { $t = mysql_query("SELECT * from AddExisting"); $number_of_customers = mysql_num_rows($t); for($i=0; $i<$number_of_customers;$i++) { $r = mysql_fetch_array($t); $email = $r["EMAIL_ADDRESS"]; $cusname = $r["Name"]; $to = $email; $subject = "hello"; $message = "Dear $cusname,".$message; $fromaddress = "[EMAIL PROTECTED]"; mail($to, $subject, $message, $fromaddress); }//end of for }//end of if -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] for loop problem
Opps, last messages had the definition of $originalMessage in the wrong place. Try this: If ($button != "") { $t = mysql_query("SELECT * from AddExisting"); $number_of_customers = mysql_num_rows($t); $originalMessage = $message; for($i=0; $i<$number_of_customers;$i++) { $r = mysql_fetch_array($t); $email = $r["EMAIL_ADDRESS"]; $cusname = $r["Name"]; $to = $email; $subject = "hello"; $message = "Dear $cusname,".$originalMessage; $fromaddress = "[EMAIL PROTECTED]"; mail($to, $subject, $message, $fromaddress); }//end of for }//end of if * * Cal Evans * Techno-Mage * http://www.calevans.com * - Original Message - From: "Kris Vose" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 20, 2002 2:07 PM Subject: [PHP] for loop problem I have a problem with a piece of code that uses the mail function in a for loop. It sends out mail to all the users in the database but it has a problem with attaching their specific name into the message. What happens is the first user in the database will get their name in the e-mail (Dear John,). Then the second user in the database will get the last users name and their name in the e-mail (Dear John, Dear Mike) ...and so on and so forth. How do I fix this problem? Your help is appreciated. Here is the code: If ($button != "") { $t = mysql_query("SELECT * from AddExisting"); $number_of_customers = mysql_num_rows($t); for($i=0; $i<$number_of_customers;$i++) { $r = mysql_fetch_array($t); $email = $r["EMAIL_ADDRESS"]; $cusname = $r["Name"]; $to = $email; $subject = "hello"; $message = "Dear $cusname,".$message; $fromaddress = "[EMAIL PROTECTED]"; mail($to, $subject, $message, $fromaddress); }//end of for }//end of if -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] for loop problem
On Wed, 20 Mar 2002, Kris Vose wrote: > I have a problem with a piece of code that uses the mail function in a > for loop. It sends out mail to all the users in the database but it has > a problem with attaching their specific name into the message. What > happens is the first user in the database will get their name in the > e-mail (Dear John,). Then the second user in the database will get the > last users name and their name in the e-mail (Dear John, Dear Mike) > ...and so on and so forth. > > If ($button != "") > { > $t = mysql_query("SELECT * from AddExisting"); > $number_of_customers = mysql_num_rows($t); > > for($i=0; $i<$number_of_customers;$i++) > { > $r = mysql_fetch_array($t); > $email = $r["EMAIL_ADDRESS"]; > $cusname = $r["Name"]; > > $to = $email; > $subject = "hello"; > $message = "Dear $cusname,".$message; > $fromaddress = "[EMAIL PROTECTED]"; > > mail($to, $subject, $message, $fromaddress); > }//end of for > }//end of if You don't need a for loop here; you don't actually care specifically how many customers there are, just that you iterate once for each one. And you've put a raw email address in the "extra headers" argument to mail() rather than a properly-formed From: header. Here's the code you want: if (!empty(button)) { $t = mysql_query("SELECT * from AddExisting"); while ($r = mysql_fetch_assoc($t)) { $message = "Dear {$r[name]},\n{$message}"; mail ($r[email_address], 'hello', $message, 'From: [EMAIL PROTECTED]'); } } miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using php for keywords
hi how can i use php to list keywords in search engines ?!? how to index a website keywords via php =) plz mail thx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP >? for current PEAR
I'm trying to install PEAR and having some problems. What's the minimum PHP version for the current PEAR? Cheers, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using PHP for NULLs
I thought this was a MySQL question, or something that could be solved using a creative SQL string, but after looking through the MySQL manual, I don't think I can handle this with the database alone. According to the manual, MySQL always sorts NULL values first - I want them last. I have a last_name field that sometimes contains people's last names, sometimes they choose not to enter their last names. I want those who don't enter a last name to end up last on the list. Right now I have: $result = mysql_query("SELECT * FROM new_miatapix ORDER BY last_name LIMIT $page, 20"); Am I going to have to do two queries here, then store them somehow using an array? It seems like I'm going to have to do one query to get all NULL values for last_name, then do another query to get all NOT NULL values for last_name, but how would I handle that after I get it to PHP? Or can I use some PHP function to sort $result to place all NULL values last? I'd check the PHP manual, but it seems to not be responding well at the moment. Thanks, Jason Soza -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP for AIX.5.1
Hi all, I like to know where i can get the PHP download for the AIX.5.1 Pl, let me know the information. Regards, Jey _ There is always a better job for you at Monsterindia.com. Go now http://monsterindia.rediff.com/jobs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] for loop problem?
try removing the quotes and see if that works eg $value1 = "100"; becomes $value1 = 100; and for($i="$value1"; $i<="$value2"; $i++) { becomes for($i=$value1; $i<=$value2; $i++) { Martin T -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 13, 2001 2:33 PM To: PHP-General Subject: [PHP] for loop problem? Hello everyone, I have a pretty big list of codes that need to be put into a mysql db. The numbers range from 100 to 1223109. Here's the PHP I wrote to put these codes into a database: ".mysql_error().""; exit; } } mysql_close($connection); ?> Everytime I run this from a browser, it just keeps looping. It should put about 223109 entries into the "passcodes" table. However, it just keeps looping. I'll end up with 400,000 or so entries before I stop it. I make sure I empty that table before I start running it again. Why is this happening? Thanks everyone, Tyler -- 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] for loop problem?
My word why all the quotes? ".mysql_error().""; exit; } } mysql_close($connection); ?> That should give you some better results. On Monday 12 November 2001 07:32 pm, you wrote: > Hello everyone, > > I have a pretty big list of codes that need to be put into a mysql db. The > numbers range from 100 to 1223109. Here's the PHP I wrote to put these > codes into a database: > > $connection = mysql_connect("blah","blah","blah"); > $db = mysql_select_db("db_to_use", $connection); > $value1 = "100"; > $value2 = "1223109"; > for($i="$value1"; $i<="$value2"; $i++) { > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > if (mysql_error() != "") { > print "".mysql_error().""; > exit; > } > } > mysql_close($connection); > ?> > > Everytime I run this from a browser, it just keeps looping. It should put > about 223109 entries into the "passcodes" table. However, it just keeps > looping. I'll end up with 400,000 or so entries before I stop it. I make > sure I empty that table before I start running it again. Why is this > happening? > > Thanks everyone, > Tyler -- 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] for loop problem?
To everyone that said it had something to do with the quotes: that has nothing to do with it. When I first wrote this, It didn't have all the quotes. It did the same thing. Then, I thought I may need some quotes somewhere, but that obviously didn't help. Any other suggestions? If I HAVE to, I'll do this in PERL, but would much rather do it in PHP. Thanks everyone, Tyler - Original Message - From: "Evan Nemerson" <[EMAIL PROTECTED]> To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 9:41 PM Subject: Re: [PHP] for loop problem? > My word why all the quotes? > > $connection = mysql_connect("blah","blah","blah"); > $db = mysql_select_db("db_to_use", $connection); > $value1 = 100; > $value2 = 1223109; > for($i=$value1; $i<=$value2; $i++) { > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > if (mysql_error() != "") { > print "".mysql_error().""; > exit; > } > } > mysql_close($connection); > ?> > > That should give you some better results. > > > On Monday 12 November 2001 07:32 pm, you wrote: > > Hello everyone, > > > > I have a pretty big list of codes that need to be put into a mysql db. The > > numbers range from 100 to 1223109. Here's the PHP I wrote to put these > > codes into a database: > > > > > $connection = mysql_connect("blah","blah","blah"); > > $db = mysql_select_db("db_to_use", $connection); > > $value1 = "100"; > > $value2 = "1223109"; > > for($i="$value1"; $i<="$value2"; $i++) { > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > if (mysql_error() != "") { > > print "".mysql_error().""; > > exit; > > } > > } > > mysql_close($connection); > > ?> > > > > Everytime I run this from a browser, it just keeps looping. It should put > > about 223109 entries into the "passcodes" table. However, it just keeps > > looping. I'll end up with 400,000 or so entries before I stop it. I make > > sure I empty that table before I start running it again. Why is this > > happening? > > > > Thanks everyone, > > Tyler > > -- > 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] for loop problem?
hmmm... I just tried : $value1 = 100; $value2 = 1223109; for($i = $value1; $i <= $value2; $i++) { echo "$i\n"; } and it spat out all 223109 numbers (albiet after a VERY long time) can't see how adding mysql code would affect the loop... Martin T -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 13, 2001 2:53 PM To: Evan Nemerson; [EMAIL PROTECTED] Subject: Re: [PHP] for loop problem? To everyone that said it had something to do with the quotes: that has nothing to do with it. When I first wrote this, It didn't have all the quotes. It did the same thing. Then, I thought I may need some quotes somewhere, but that obviously didn't help. Any other suggestions? If I HAVE to, I'll do this in PERL, but would much rather do it in PHP. Thanks everyone, Tyler - Original Message - From: "Evan Nemerson" <[EMAIL PROTECTED]> To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 9:41 PM Subject: Re: [PHP] for loop problem? > My word why all the quotes? > > $connection = mysql_connect("blah","blah","blah"); > $db = mysql_select_db("db_to_use", $connection); > $value1 = 100; > $value2 = 1223109; > for($i=$value1; $i<=$value2; $i++) { > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > if (mysql_error() != "") { > print "".mysql_error().""; > exit; > } > } > mysql_close($connection); > ?> > > That should give you some better results. > > > On Monday 12 November 2001 07:32 pm, you wrote: > > Hello everyone, > > > > I have a pretty big list of codes that need to be put into a mysql db. The > > numbers range from 100 to 1223109. Here's the PHP I wrote to put these > > codes into a database: > > > > > $connection = mysql_connect("blah","blah","blah"); > > $db = mysql_select_db("db_to_use", $connection); > > $value1 = "100"; > > $value2 = "1223109"; > > for($i="$value1"; $i<="$value2"; $i++) { > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > if (mysql_error() != "") { > > print "".mysql_error().""; > > exit; > > } > > } > > mysql_close($connection); > > ?> > > > > Everytime I run this from a browser, it just keeps looping. It should put > > about 223109 entries into the "passcodes" table. However, it just keeps > > looping. I'll end up with 400,000 or so entries before I stop it. I make > > sure I empty that table before I start running it again. Why is this > > happening? > > > > Thanks everyone, > > Tyler > > -- > 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] for loop problem?
I removed all of the quotes that could be affecting it. Still, it loops until I stop it. I let it go all the way up to 350,000 or so. Any other ideas anyone? Thank you! Tyler - Original Message - From: "Martin Towell" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 10:06 PM Subject: RE: [PHP] for loop problem? > hmmm... I just tried : > > $value1 = 100; > $value2 = 1223109; > for($i = $value1; $i <= $value2; $i++) > { > echo "$i\n"; > } > > and it spat out all 223109 numbers (albiet after a VERY long time) > can't see how adding mysql code would affect the loop... > > Martin T > > -Original Message- > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, November 13, 2001 2:53 PM > To: Evan Nemerson; [EMAIL PROTECTED] > Subject: Re: [PHP] for loop problem? > > > To everyone that said it had something to do with the quotes: > that has nothing to do with it. > > When I first wrote this, It didn't have all the quotes. It did the same > thing. Then, I thought I may need some quotes somewhere, but that obviously > didn't help. Any other suggestions? If I HAVE to, I'll do this in PERL, > but would much rather do it in PHP. > > Thanks everyone, > Tyler > > - Original Message - > From: "Evan Nemerson" <[EMAIL PROTECTED]> > To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Monday, November 12, 2001 9:41 PM > Subject: Re: [PHP] for loop problem? > > > > My word why all the quotes? > > > > > $connection = mysql_connect("blah","blah","blah"); > > $db = mysql_select_db("db_to_use", $connection); > > $value1 = 100; > > $value2 = 1223109; > > for($i=$value1; $i<=$value2; $i++) { > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > if (mysql_error() != "") { > > print "".mysql_error().""; > > exit; > > } > > } > > mysql_close($connection); > > ?> > > > > That should give you some better results. > > > > > > On Monday 12 November 2001 07:32 pm, you wrote: > > > Hello everyone, > > > > > > I have a pretty big list of codes that need to be put into a mysql db. > The > > > numbers range from 100 to 1223109. Here's the PHP I wrote to put > these > > > codes into a database: > > > > > > > > $connection = mysql_connect("blah","blah","blah"); > > > $db = mysql_select_db("db_to_use", $connection); > > > $value1 = "100"; > > > $value2 = "1223109"; > > > for($i="$value1"; $i<="$value2"; $i++) { > > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > > if (mysql_error() != "") { > > > print "".mysql_error().""; > > > exit; > > > } > > > } > > > mysql_close($connection); > > > ?> > > > > > > Everytime I run this from a browser, it just keeps looping. It should > put > > > about 223109 entries into the "passcodes" table. However, it just keeps > > > looping. I'll end up with 400,000 or so entries before I stop it. I > make > > > sure I empty that table before I start running it again. Why is this > > > happening? > > > > > > Thanks everyone, > > > Tyler > > > > -- > > 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] for loop problem?
paste the complete code in and myself and others can run your exact copy -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Monday, November 12, 2001 11:22 PM To: Martin Towell; [EMAIL PROTECTED] Subject: Re: [PHP] for loop problem? I removed all of the quotes that could be affecting it. Still, it loops until I stop it. I let it go all the way up to 350,000 or so. Any other ideas anyone? Thank you! Tyler - Original Message - From: "Martin Towell" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 10:06 PM Subject: RE: [PHP] for loop problem? > hmmm... I just tried : > > $value1 = 100; > $value2 = 1223109; > for($i = $value1; $i <= $value2; $i++) > { > echo "$i\n"; > } > > and it spat out all 223109 numbers (albiet after a VERY long time) > can't see how adding mysql code would affect the loop... > > Martin T > > -Original Message- > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, November 13, 2001 2:53 PM > To: Evan Nemerson; [EMAIL PROTECTED] > Subject: Re: [PHP] for loop problem? > > > To everyone that said it had something to do with the quotes: > that has nothing to do with it. > > When I first wrote this, It didn't have all the quotes. It did the same > thing. Then, I thought I may need some quotes somewhere, but that obviously > didn't help. Any other suggestions? If I HAVE to, I'll do this in PERL, > but would much rather do it in PHP. > > Thanks everyone, > Tyler > > - Original Message - > From: "Evan Nemerson" <[EMAIL PROTECTED]> > To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Monday, November 12, 2001 9:41 PM > Subject: Re: [PHP] for loop problem? > > > > My word why all the quotes? > > > > > $connection = mysql_connect("blah","blah","blah"); > > $db = mysql_select_db("db_to_use", $connection); > > $value1 = 100; > > $value2 = 1223109; > > for($i=$value1; $i<=$value2; $i++) { > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > if (mysql_error() != "") { > > print "".mysql_error().""; > > exit; > > } > > } > > mysql_close($connection); > > ?> > > > > That should give you some better results. > > > > > > On Monday 12 November 2001 07:32 pm, you wrote: > > > Hello everyone, > > > > > > I have a pretty big list of codes that need to be put into a mysql db. > The > > > numbers range from 100 to 1223109. Here's the PHP I wrote to put > these > > > codes into a database: > > > > > > > > $connection = mysql_connect("blah","blah","blah"); > > > $db = mysql_select_db("db_to_use", $connection); > > > $value1 = "100"; > > > $value2 = "1223109"; > > > for($i="$value1"; $i<="$value2"; $i++) { > > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > > if (mysql_error() != "") { > > > print "".mysql_error().""; > > > exit; > > > } > > > } > > > mysql_close($connection); > > > ?> > > > > > > Everytime I run this from a browser, it just keeps looping. It should > put > > > about 223109 entries into the "passcodes" table. However, it just keeps > > > looping. I'll end up with 400,000 or so entries before I stop it. I > make > > > sure I empty that table before I start running it again. Why is this > > > happening? > > > > > > Thanks everyone, > > > Tyler > > > > -- > > 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] for loop problem?
Exact code: ".mysql_error().""; exit; } } mysql_close($connection); ?> Tyler - Original Message - From: "Jack Dempsey" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 10:34 PM Subject: RE: [PHP] for loop problem? > paste the complete code in and myself and others can run your exact copy > > -Original Message- > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 12, 2001 11:22 PM > To: Martin Towell; [EMAIL PROTECTED] > Subject: Re: [PHP] for loop problem? > > > I removed all of the quotes that could be affecting it. Still, it loops > until I stop it. I let it go all the way up to 350,000 or so. Any other > ideas anyone? > > Thank you! > Tyler > > - Original Message - > From: "Martin Towell" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, November 12, 2001 10:06 PM > Subject: RE: [PHP] for loop problem? > > > > hmmm... I just tried : > > > > $value1 = 100; > > $value2 = 1223109; > > for($i = $value1; $i <= $value2; $i++) > > { > > echo "$i\n"; > > } > > > > and it spat out all 223109 numbers (albiet after a VERY long time) > > can't see how adding mysql code would affect the loop... > > > > Martin T > > > > -Original Message- > > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, November 13, 2001 2:53 PM > > To: Evan Nemerson; [EMAIL PROTECTED] > > Subject: Re: [PHP] for loop problem? > > > > > > To everyone that said it had something to do with the quotes: > > that has nothing to do with it. > > > > When I first wrote this, It didn't have all the quotes. It did the same > > thing. Then, I thought I may need some quotes somewhere, but that > obviously > > didn't help. Any other suggestions? If I HAVE to, I'll do this in PERL, > > but would much rather do it in PHP. > > > > Thanks everyone, > > Tyler > > > > - Original Message - > > From: "Evan Nemerson" <[EMAIL PROTECTED]> > > To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Monday, November 12, 2001 9:41 PM > > Subject: Re: [PHP] for loop problem? > > > > > > > My word why all the quotes? > > > > > > > > $connection = mysql_connect("blah","blah","blah"); > > > $db = mysql_select_db("db_to_use", $connection); > > > $value1 = 100; > > > $value2 = 1223109; > > > for($i=$value1; $i<=$value2; $i++) { > > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > > if (mysql_error() != "") { > > > print "".mysql_error().""; > > > exit; > > > } > > > } > > > mysql_close($connection); > > > ?> > > > > > > That should give you some better results. > > > > > > > > > On Monday 12 November 2001 07:32 pm, you wrote: > > > > Hello everyone, > > > > > > > > I have a pretty big list of codes that need to be put into a mysql db. > > The > > > > numbers range from 100 to 1223109. Here's the PHP I wrote to put > > these > > > > codes into a database: > > > > > > > > > > > $connection = mysql_connect("blah","blah","blah"); > > > > $db = mysql_select_db("db_to_use", $connection); > > > > $value1 = "100"; > > > > $value2 = "1223109"; > > > > for($i="$value1"; $i<="$value2"; $i++) { > > > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > > > if (mysql_error() != "") { > > > > print "".mysql_error().""; > > > > exit; > > > > } > > > > } > > > > mysql_close($connection); > > > > ?> > > > > > > > > Everytime I run this from a browser, it just keeps looping. It should > > put > > > > about 223109 entries into the "passcodes" table. However, it just > keeps > > > > looping. I'll end up with 400,000 or so entries before I stop it. I > > make > > > > sure I empty that table before I start running it again. Why is this > > > > happening? > > > > > > > > Thanks everyone, > > > > Tyler > > > > > > -- > > > 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] for loop problem?
ran it (without mysql queries) and worked finereal strange. have you tried the loop without the mysql queries? -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Monday, November 12, 2001 11:28 PM To: Jack Dempsey; [EMAIL PROTECTED] Subject: Re: [PHP] for loop problem? Exact code: ".mysql_error().""; exit; } } mysql_close($connection); ?> Tyler - Original Message - From: "Jack Dempsey" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 10:34 PM Subject: RE: [PHP] for loop problem? > paste the complete code in and myself and others can run your exact copy > > -Original Message- > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 12, 2001 11:22 PM > To: Martin Towell; [EMAIL PROTECTED] > Subject: Re: [PHP] for loop problem? > > > I removed all of the quotes that could be affecting it. Still, it loops > until I stop it. I let it go all the way up to 350,000 or so. Any other > ideas anyone? > > Thank you! > Tyler > > - Original Message - > From: "Martin Towell" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, November 12, 2001 10:06 PM > Subject: RE: [PHP] for loop problem? > > > > hmmm... I just tried : > > > > $value1 = 100; > > $value2 = 1223109; > > for($i = $value1; $i <= $value2; $i++) > > { > > echo "$i\n"; > > } > > > > and it spat out all 223109 numbers (albiet after a VERY long time) > > can't see how adding mysql code would affect the loop... > > > > Martin T > > > > -Original Message- > > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, November 13, 2001 2:53 PM > > To: Evan Nemerson; [EMAIL PROTECTED] > > Subject: Re: [PHP] for loop problem? > > > > > > To everyone that said it had something to do with the quotes: > > that has nothing to do with it. > > > > When I first wrote this, It didn't have all the quotes. It did the same > > thing. Then, I thought I may need some quotes somewhere, but that > obviously > > didn't help. Any other suggestions? If I HAVE to, I'll do this in PERL, > > but would much rather do it in PHP. > > > > Thanks everyone, > > Tyler > > > > - Original Message - > > From: "Evan Nemerson" <[EMAIL PROTECTED]> > > To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Monday, November 12, 2001 9:41 PM > > Subject: Re: [PHP] for loop problem? > > > > > > > My word why all the quotes? > > > > > > > > $connection = mysql_connect("blah","blah","blah"); > > > $db = mysql_select_db("db_to_use", $connection); > > > $value1 = 100; > > > $value2 = 1223109; > > > for($i=$value1; $i<=$value2; $i++) { > > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > > if (mysql_error() != "") { > > > print "".mysql_error().""; > > > exit; > > > } > > > } > > > mysql_close($connection); > > > ?> > > > > > > That should give you some better results. > > > > > > > > > On Monday 12 November 2001 07:32 pm, you wrote: > > > > Hello everyone, > > > > > > > > I have a pretty big list of codes that need to be put into a mysql db. > > The > > > > numbers range from 100 to 1223109. Here's the PHP I wrote to put > > these > > > > codes into a database: > > > > > > > > > > > $connection = mysql_connect("blah","blah","blah"); > > > > $db = mysql_select_db("db_to_use", $connection); > > > > $value1 = "100"; > > > > $value2 = "1223109"; > > > > for($i="$value1"; $i<="$value2"; $i++) { > > > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > > > if (mysql_error() != "") { > > > > print "".mysql_error().""; > > > > exit; > > > > } > > > > } > > > > mysql_close($connection); > > > > ?> > > > > > > > > Everytime I run this from a browser, it just keeps looping. It should > > put > > > > about 223109 entries into the "passcodes
Re: [PHP] for loop problem?
I've ran it a few times without the MySQL code in there. Runs just fine that way for me too. After it's run a few times for me (with the MySQL code), I start getting duplicate entries of codes in there. For example, I'll end up with a few 'P100' entries in the 'passcodes' field. Oh well, here I come perl! Thanks, Tyler - Original Message - From: "Jack Dempsey" <[EMAIL PROTECTED]> To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 10:43 PM Subject: RE: [PHP] for loop problem? > ran it (without mysql queries) and worked finereal strange. > have you tried the loop without the mysql queries? > > -Original Message- > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 12, 2001 11:28 PM > To: Jack Dempsey; [EMAIL PROTECTED] > Subject: Re: [PHP] for loop problem? > > > Exact code: > $connection = mysql_connect("host_here","user_here","pass_here"); > $db = mysql_select_db("db_here", $connection); > $value1 = 100; > $value2 = 1223109; > for($i=$value1; $i<=$value2; $i++) { > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > if (mysql_error() != "") { > print "".mysql_error().""; > exit; > } > } > mysql_close($connection); > ?> > > Tyler > > - Original Message - > From: "Jack Dempsey" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, November 12, 2001 10:34 PM > Subject: RE: [PHP] for loop problem? > > > > paste the complete code in and myself and others can run your exact copy > > > > -Original Message- > > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > > Sent: Monday, November 12, 2001 11:22 PM > > To: Martin Towell; [EMAIL PROTECTED] > > Subject: Re: [PHP] for loop problem? > > > > > > I removed all of the quotes that could be affecting it. Still, it loops > > until I stop it. I let it go all the way up to 350,000 or so. Any other > > ideas anyone? > > > > Thank you! > > Tyler > > > > - Original Message - > > From: "Martin Towell" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, November 12, 2001 10:06 PM > > Subject: RE: [PHP] for loop problem? > > > > > > > hmmm... I just tried : > > > > > > $value1 = 1000000; > > > $value2 = 1223109; > > > for($i = $value1; $i <= $value2; $i++) > > > { > > > echo "$i\n"; > > > } > > > > > > and it spat out all 223109 numbers (albiet after a VERY long time) > > > can't see how adding mysql code would affect the loop... > > > > > > Martin T > > > > > > -Original Message- > > > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, November 13, 2001 2:53 PM > > > To: Evan Nemerson; [EMAIL PROTECTED] > > > Subject: Re: [PHP] for loop problem? > > > > > > > > > To everyone that said it had something to do with the quotes: > > > that has nothing to do with it. > > > > > > When I first wrote this, It didn't have all the quotes. It did the same > > > thing. Then, I thought I may need some quotes somewhere, but that > > obviously > > > didn't help. Any other suggestions? If I HAVE to, I'll do this in > PERL, > > > but would much rather do it in PHP. > > > > > > Thanks everyone, > > > Tyler > > > > > > - Original Message - > > > From: "Evan Nemerson" <[EMAIL PROTECTED]> > > > To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > > Sent: Monday, November 12, 2001 9:41 PM > > > Subject: Re: [PHP] for loop problem? > > > > > > > > > > My word why all the quotes? > > > > > > > > > > > $connection = mysql_connect("blah","blah","blah"); > > > > $db = mysql_select_db("db_to_use", $connection); > > > > $value1 = 100; > > > > $value2 = 1223109; > > > > for($i=$value1; $i<=$value2; $i++) { > > > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > > > if (mysql_error() != "") { > > > > print "".mysql_error().""; > > > > exit; > > > >
RE: [PHP] for loop problem?
How about changing the logic lightly? try this: $value1 = 0; $value2 = 223109; for($i=$value1; $i<=$value2; $i++) { $tmp = sprintf("1%06d\n", $i); mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$tmp')"); basically taking away 1,000,000 from the numbers then adding it back on later Martin T -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 13, 2001 3:38 PM To: Jack Dempsey Cc: PHP-General Subject: Re: [PHP] for loop problem? I've ran it a few times without the MySQL code in there. Runs just fine that way for me too. After it's run a few times for me (with the MySQL code), I start getting duplicate entries of codes in there. For example, I'll end up with a few 'P100' entries in the 'passcodes' field. Oh well, here I come perl! Thanks, Tyler - Original Message - From: "Jack Dempsey" <[EMAIL PROTECTED]> To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 10:43 PM Subject: RE: [PHP] for loop problem? > ran it (without mysql queries) and worked finereal strange. > have you tried the loop without the mysql queries? > > -Original Message- > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > Sent: Monday, November 12, 2001 11:28 PM > To: Jack Dempsey; [EMAIL PROTECTED] > Subject: Re: [PHP] for loop problem? > > > Exact code: > $connection = mysql_connect("host_here","user_here","pass_here"); > $db = mysql_select_db("db_here", $connection); > $value1 = 100; > $value2 = 1223109; > for($i=$value1; $i<=$value2; $i++) { > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > if (mysql_error() != "") { > print "".mysql_error().""; > exit; > } > } > mysql_close($connection); > ?> > > Tyler > > - Original Message - > From: "Jack Dempsey" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, November 12, 2001 10:34 PM > Subject: RE: [PHP] for loop problem? > > > > paste the complete code in and myself and others can run your exact copy > > > > -Original Message- > > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > > Sent: Monday, November 12, 2001 11:22 PM > > To: Martin Towell; [EMAIL PROTECTED] > > Subject: Re: [PHP] for loop problem? > > > > > > I removed all of the quotes that could be affecting it. Still, it loops > > until I stop it. I let it go all the way up to 350,000 or so. Any other > > ideas anyone? > > > > Thank you! > > Tyler > > > > - Original Message - > > From: "Martin Towell" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, November 12, 2001 10:06 PM > > Subject: RE: [PHP] for loop problem? > > > > > > > hmmm... I just tried : > > > > > > $value1 = 100; > > > $value2 = 1223109; > > > for($i = $value1; $i <= $value2; $i++) > > > { > > > echo "$i\n"; > > > } > > > > > > and it spat out all 223109 numbers (albiet after a VERY long time) > > > can't see how adding mysql code would affect the loop... > > > > > > Martin T > > > > > > -Original Message- > > > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, November 13, 2001 2:53 PM > > > To: Evan Nemerson; [EMAIL PROTECTED] > > > Subject: Re: [PHP] for loop problem? > > > > > > > > > To everyone that said it had something to do with the quotes: > > > that has nothing to do with it. > > > > > > When I first wrote this, It didn't have all the quotes. It did the same > > > thing. Then, I thought I may need some quotes somewhere, but that > > obviously > > > didn't help. Any other suggestions? If I HAVE to, I'll do this in > PERL, > > > but would much rather do it in PHP. > > > > > > Thanks everyone, > > > Tyler > > > > > > - Original Message - > > > From: "Evan Nemerson" <[EMAIL PROTECTED]> > > > To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > > Sent: Monday, November 12, 2001 9:41 PM > > > Subject: Re: [PHP] for loop problem? > > > > > > > > > > My word why all the quotes? > > > > > > > > > > > $connection = mysql_connect("blah",&
Re: [PHP] for loop problem?
Hi Martin, I just got done doing that, and i got the same thing! :-( Here's something interesting though. There's an id field that's set to AUTO_INCREMENT. I did a "SELECT * FROM passcodes WHERE passcode='P100'" This gave me this: id | passcode --- 1 |P100 82145 |P100 209398 |P100 Shouldn't the ID's be further apart than that? Know what I'm saying? Tyler - Original Message - From: "Martin Towell" <[EMAIL PROTECTED]> To: "'Tyler Longren'" <[EMAIL PROTECTED]>; "Jack Dempsey" <[EMAIL PROTECTED]> Cc: "PHP-General" <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 10:45 PM Subject: RE: [PHP] for loop problem? > How about changing the logic lightly? try this: > > $value1 = 0; > $value2 = 223109; > for($i=$value1; $i<=$value2; $i++) { > $tmp = sprintf("1%06d\n", $i); > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$tmp')"); > > basically taking away 1,000,000 from the numbers then adding it back on > later > > Martin T > > -Original Message- > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, November 13, 2001 3:38 PM > To: Jack Dempsey > Cc: PHP-General > Subject: Re: [PHP] for loop problem? > > > I've ran it a few times without the MySQL code in there. Runs just fine > that way for me too. After it's run a few times for me (with the MySQL > code), I start getting duplicate entries of codes in there. For example, > I'll end up with a few 'P100' entries in the 'passcodes' field. > > Oh well, here I come perl! > > Thanks, > Tyler > > - Original Message - > From: "Jack Dempsey" <[EMAIL PROTECTED]> > To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Monday, November 12, 2001 10:43 PM > Subject: RE: [PHP] for loop problem? > > > > ran it (without mysql queries) and worked finereal strange. > > have you tried the loop without the mysql queries? > > > > -Original Message- > > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > > Sent: Monday, November 12, 2001 11:28 PM > > To: Jack Dempsey; [EMAIL PROTECTED] > > Subject: Re: [PHP] for loop problem? > > > > > > Exact code: > > > $connection = mysql_connect("host_here","user_here","pass_here"); > > $db = mysql_select_db("db_here", $connection); > > $value1 = 100; > > $value2 = 1223109; > > for($i=$value1; $i<=$value2; $i++) { > > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > > if (mysql_error() != "") { > > print "".mysql_error().""; > > exit; > > } > > } > > mysql_close($connection); > > ?> > > > > Tyler > > > > - Original Message - > > From: "Jack Dempsey" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Monday, November 12, 2001 10:34 PM > > Subject: RE: [PHP] for loop problem? > > > > > > > paste the complete code in and myself and others can run your exact copy > > > > > > -Original Message- > > > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > > > Sent: Monday, November 12, 2001 11:22 PM > > > To: Martin Towell; [EMAIL PROTECTED] > > > Subject: Re: [PHP] for loop problem? > > > > > > > > > I removed all of the quotes that could be affecting it. Still, it loops > > > until I stop it. I let it go all the way up to 350,000 or so. Any > other > > > ideas anyone? > > > > > > Thank you! > > > Tyler > > > > > > - Original Message - > > > From: "Martin Towell" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Monday, November 12, 2001 10:06 PM > > > Subject: RE: [PHP] for loop problem? > > > > > > > > > > hmmm... I just tried : > > > > > > > > $value1 = 100; > > > > $value2 = 1223109; > > > > for($i = $value1; $i <= $value2; $i++) > > > > { > > > > echo "$i\n"; > > > > } > > > > > > > > and it spat out all 223109 numbers (albiet after a VERY long time) > > > > can't see how adding mysql code would affect the loop... > > > > > > > > Martin T > > > &
Re: [PHP] for loop problem?
Hi Tyler, This doesn't sound like a problem with PHP, but MySQL. Can you show your CREATE TABLE and MySQL version? John >Hi Martin, > >I just got done doing that, and i got the same thing! :-( > >Here's something interesting though. There's an id field that's set to >AUTO_INCREMENT. I did a "SELECT * FROM passcodes WHERE passcode='P100'" >This gave me this: > >id | passcode >--- >1 |P100 >82145 |P100 >209398 |P100 > >Shouldn't the ID's be further apart than that? Know what I'm saying? > >Tyler > >- Original Message - >From: "Martin Towell" <[EMAIL PROTECTED]> >To: "'Tyler Longren'" <[EMAIL PROTECTED]>; "Jack Dempsey" ><[EMAIL PROTECTED]> >Cc: "PHP-General" <[EMAIL PROTECTED]> >Sent: Monday, November 12, 2001 10:45 PM >Subject: RE: [PHP] for loop problem? > > >> How about changing the logic lightly? try this: >> >> $value1 = 0; >> $value2 = 223109; >> for($i=$value1; $i<=$value2; $i++) { >> $tmp = sprintf("1%06d\n", $i); >> mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$tmp')"); >> >> basically taking away 1,000,000 from the numbers then adding it back on >> later >> >> Martin T >> >> -Original Message- >> From: Tyler Longren [mailto:[EMAIL PROTECTED]] >> Sent: Tuesday, November 13, 2001 3:38 PM >> To: Jack Dempsey >> Cc: PHP-General >> Subject: Re: [PHP] for loop problem? >> >> >> I've ran it a few times without the MySQL code in there. Runs just fine >> that way for me too. After it's run a few times for me (with the MySQL >> code), I start getting duplicate entries of codes in there. For example, >> I'll end up with a few 'P100' entries in the 'passcodes' field. >> >> Oh well, here I come perl! >> >> Thanks, >> Tyler >> >> - Original Message - >> From: "Jack Dempsey" <[EMAIL PROTECTED]> >> To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >> Sent: Monday, November 12, 2001 10:43 PM >> Subject: RE: [PHP] for loop problem? >> >> >> > ran it (without mysql queries) and worked finereal strange. >> > have you tried the loop without the mysql queries? >> > >> > -Original Message- >> > From: Tyler Longren [mailto:[EMAIL PROTECTED]] >> > Sent: Monday, November 12, 2001 11:28 PM >> > To: Jack Dempsey; [EMAIL PROTECTED] >> > Subject: Re: [PHP] for loop problem? >> > >> > >> > Exact code: >> > > > $connection = mysql_connect("host_here","user_here","pass_here"); >> > $db = mysql_select_db("db_here", $connection); >> > $value1 = 100; >> > $value2 = 1223109; >> > for($i=$value1; $i<=$value2; $i++) { >> > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); >> > if (mysql_error() != "") { >> > print "".mysql_error().""; >> > exit; >> > } >> > } >> > mysql_close($connection); >> > ?> >> > >> > Tyler >> > >> > - Original Message - >> > From: "Jack Dempsey" <[EMAIL PROTECTED]> >> > To: <[EMAIL PROTECTED]> >> > Sent: Monday, November 12, 2001 10:34 PM >> > Subject: RE: [PHP] for loop problem? >> > >> > >> > > paste the complete code in and myself and others can run your exact >copy >> > > >> > > -Original Message- >> > > From: Tyler Longren [mailto:[EMAIL PROTECTED]] >> > > Sent: Monday, November 12, 2001 11:22 PM >> > > To: Martin Towell; [EMAIL PROTECTED] >> > > Subject: Re: [PHP] for loop problem? >> > > >> > > >> > > I removed all of the quotes that could be affecting it. Still, it >loops >> > > until I stop it. I let it go all the way up to 350,000 or so. Any >> other >> > > ideas anyone? >> > > >> > > Thank you! >> > > Tyler >> > > >> > > - Original Message - >> > > From: "Martin Towell" <[EMAIL PROTECTED]> >> > > To: <[EMAIL PROTECTED]> >> > > Sent: Monday, November 12, 2001 10:06 PM >>
Re: [PHP] for loop problem?
Hi John, MySQL Version: MySQL 3.23.44-nt SQL: CREATE TABLE passcodes ( id int(11) NOT NULL auto_increment, passcode varchar(255) NOT NULL default '', PRIMARY KEY (id), KEY id (id,passcode) ) TYPE=MyISAM; I'm beginning to think it's a MySQL problem also because this PHP SHOULD work. Tyler - Original Message - From: "John Steele" <[EMAIL PROTECTED]> To: "PHP General List" <[EMAIL PROTECTED]> Sent: Monday, November 12, 2001 3:33 PM Subject: Re: [PHP] for loop problem? > Hi Tyler, > > This doesn't sound like a problem with PHP, but MySQL. Can you show your CREATE TABLE and MySQL version? > > John > > >Hi Martin, > > > >I just got done doing that, and i got the same thing! :-( > > > >Here's something interesting though. There's an id field that's set to > >AUTO_INCREMENT. I did a "SELECT * FROM passcodes WHERE passcode='P100'" > >This gave me this: > > > >id | passcode > >--- > >1 |P100 > >82145 |P100 > >209398 |P100 > > > >Shouldn't the ID's be further apart than that? Know what I'm saying? > > > >Tyler > > > >- Original Message ----- > >From: "Martin Towell" <[EMAIL PROTECTED]> > >To: "'Tyler Longren'" <[EMAIL PROTECTED]>; "Jack Dempsey" > ><[EMAIL PROTECTED]> > >Cc: "PHP-General" <[EMAIL PROTECTED]> > >Sent: Monday, November 12, 2001 10:45 PM > >Subject: RE: [PHP] for loop problem? > > > > > >> How about changing the logic lightly? try this: > >> > >> $value1 = 0; > >> $value2 = 223109; > >> for($i=$value1; $i<=$value2; $i++) { > >> $tmp = sprintf("1%06d\n", $i); > >> mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$tmp')"); > >> > >> basically taking away 1,000,000 from the numbers then adding it back on > >> later > >> > >> Martin T > >> > >> -Original Message- > >> From: Tyler Longren [mailto:[EMAIL PROTECTED]] > >> Sent: Tuesday, November 13, 2001 3:38 PM > >> To: Jack Dempsey > >> Cc: PHP-General > >> Subject: Re: [PHP] for loop problem? > >> > >> > >> I've ran it a few times without the MySQL code in there. Runs just fine > >> that way for me too. After it's run a few times for me (with the MySQL > >> code), I start getting duplicate entries of codes in there. For example, > >> I'll end up with a few 'P100' entries in the 'passcodes' field. > >> > >> Oh well, here I come perl! > >> > >> Thanks, > >> Tyler > >> > >> - Original Message - > >> From: "Jack Dempsey" <[EMAIL PROTECTED]> > >> To: "Tyler Longren" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > >> Sent: Monday, November 12, 2001 10:43 PM > >> Subject: RE: [PHP] for loop problem? > >> > >> > >> > ran it (without mysql queries) and worked finereal strange. > >> > have you tried the loop without the mysql queries? > >> > > >> > -Original Message- > >> > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > >> > Sent: Monday, November 12, 2001 11:28 PM > >> > To: Jack Dempsey; [EMAIL PROTECTED] > >> > Subject: Re: [PHP] for loop problem? > >> > > >> > > >> > Exact code: > >> > >> > $connection = mysql_connect("host_here","user_here","pass_here"); > >> > $db = mysql_select_db("db_here", $connection); > >> > $value1 = 100; > >> > $value2 = 1223109; > >> > for($i=$value1; $i<=$value2; $i++) { > >> > mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$i')"); > >> > if (mysql_error() != "") { > >> > print "".mysql_error().""; > >> > exit; > >> > } > >> > } > >> > mysql_close($connection); > >> > ?> > >> > > >> > Tyler > >> > > >> > - Original Message - > >> > From: "Jack Dempsey" <[EMAIL PROTECTED]> > >> > To: <[EMAIL PROTECTED]> > >> > Sent: Monday, November 12, 2001 10:34 PM > >> >
Re: [PHP] for loop problem?
I just ran your code as you pasted earlier, and set up a mysql database with the table defined below ... and it inserted 223,110 passcodes into the table. PHP 4.0.99-3 (Identifies itself as 4.1.0RC1) MySQL 3.23.43-3 ~Chris /"\ \ / September 11, 2001 X We Are All New Yorkers / \ rm -rf /bin/laden On Mon, 12 Nov 2001, Tyler Longren wrote: > Hi John, > > MySQL Version: MySQL 3.23.44-nt > > SQL: > CREATE TABLE passcodes ( > id int(11) NOT NULL auto_increment, > passcode varchar(255) NOT NULL default '', > PRIMARY KEY (id), > KEY id (id,passcode) > ) TYPE=MyISAM; > > I'm beginning to think it's a MySQL problem also because this PHP SHOULD > work. > > Tyler > > - Original Message - > From: "John Steele" <[EMAIL PROTECTED]> > To: "PHP General List" <[EMAIL PROTECTED]> > Sent: Monday, November 12, 2001 3:33 PM > Subject: Re: [PHP] for loop problem? > > > > Hi Tyler, > > > > This doesn't sound like a problem with PHP, but MySQL. Can you show > your CREATE TABLE and MySQL version? > > > > John > > > > >Hi Martin, > > > > > >I just got done doing that, and i got the same thing! :-( > > > > > >Here's something interesting though. There's an id field that's set to > > >AUTO_INCREMENT. I did a "SELECT * FROM passcodes WHERE > passcode='P100'" > > >This gave me this: > > > > > >id | passcode > > >--- > > >1 |P100 > > >82145 |P100 > > >209398 |P100 > > > > > >Shouldn't the ID's be further apart than that? Know what I'm saying? > > > > > >Tyler > > > > > >- Original Message - > > >From: "Martin Towell" <[EMAIL PROTECTED]> > > >To: "'Tyler Longren'" <[EMAIL PROTECTED]>; "Jack Dempsey" > > ><[EMAIL PROTECTED]> > > >Cc: "PHP-General" <[EMAIL PROTECTED]> > > >Sent: Monday, November 12, 2001 10:45 PM > > >Subject: RE: [PHP] for loop problem? > > > > > > > > >> How about changing the logic lightly? try this: > > >> > > >> $value1 = 0; > > >> $value2 = 223109; > > >> for($i=$value1; $i<=$value2; $i++) { > > >> $tmp = sprintf("1%06d\n", $i); > > >> mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$tmp')"); > > >> > > >> basically taking away 1,000,000 from the numbers then adding it back on > > >> later > > >> > > >> Martin T > > >> > > >> -Original Message- > > >> From: Tyler Longren [mailto:[EMAIL PROTECTED]] > > >> Sent: Tuesday, November 13, 2001 3:38 PM > > >> To: Jack Dempsey > > >> Cc: PHP-General > > >> Subject: Re: [PHP] for loop problem? > > >> > > >> > > >> I've ran it a few times without the MySQL code in there. Runs just > fine > > >> that way for me too. After it's run a few times for me (with the MySQL > > >> code), I start getting duplicate entries of codes in there. For > example, > > >> I'll end up with a few 'P100' entries in the 'passcodes' field. > > >> > > >> Oh well, here I come perl! > > >> > > >> Thanks, > > >> Tyler > > >> > > >> - Original Message - > > >> From: "Jack Dempsey" <[EMAIL PROTECTED]> > > >> To: "Tyler Longren" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > > >> Sent: Monday, November 12, 2001 10:43 PM > > >> Subject: RE: [PHP] for loop problem? > > >> > > >> > > >> > ran it (without mysql queries) and worked finereal strange. > > >> > have you tried the loop without the mysql queries? > > >> > > > >> > -Original Message- > > >> > From: Tyler Longren [mailto:[EMAIL PROTECTED]] > > >> > Sent: Monday, November 12, 2001 11:28 PM > > >> > To: Jack Dempsey; [EMAIL PROTECTED] > > >> > Subject: Re: [PHP] for loop problem? > > >> > > > >> &g
Re: [PHP] for loop problem?
Tyler, It must be something weird with your NT version of MySQL, you might try asking on the MySQL list, or checking the bug list on mysql.com. I have an even older version here on 95, that doesn't display any of those problems. Here's the code I used with it's output (no duplicates, I checked). Notice that I did have to change the CREATE TABLE to meet 3.21.29a-gamma restrictions. You might try changing the passcode to an int, and tacking the 'P' on the front in your application. Not sure if that's possible... John '; if (!$qid = mysql_query("SELECT id,passcode FROM passcodes ORDER BY passcode DESC LIMIT 10")) die ("SELECT failed: ". mysql_error()); while ($arr = mysql_fetch_array($qid)) echo "$arr[0]: $arr[1]\n"; if (!mysql_close($connection)) die ("Can't close connection: ". mysql_error()); ?> And it's output: INSERTs completed. 223110: P1223109 223109: P1223108 223108: P1223107 223107: P1223106 223106: P1223105 223105: P1223104 223104: P1223103 223103: P1223102 223102: P1223101 223101: P1223100 >Hi John, > >MySQL Version: MySQL 3.23.44-nt > >SQL: >CREATE TABLE passcodes ( > id int(11) NOT NULL auto_increment, > passcode varchar(255) NOT NULL default '', > PRIMARY KEY (id), > KEY id (id,passcode) >) TYPE=MyISAM; > >I'm beginning to think it's a MySQL problem also because this PHP SHOULD >work. > >Tyler > >- Original Message - >From: "John Steele" <[EMAIL PROTECTED]> >To: "PHP General List" <[EMAIL PROTECTED]> >Sent: Monday, November 12, 2001 3:33 PM >Subject: Re: [PHP] for loop problem? > > >> Hi Tyler, >> >> This doesn't sound like a problem with PHP, but MySQL. Can you show >your CREATE TABLE and MySQL version? >> >> John >> >> >Hi Martin, >> > >> >I just got done doing that, and i got the same thing! :-( >> > >> >Here's something interesting though. There's an id field that's set to >> >AUTO_INCREMENT. I did a "SELECT * FROM passcodes WHERE >passcode='P100'" >> >This gave me this: >> > >> >id | passcode >> >--- >> >1 |P100 >> >82145 |P1000000 >> >209398 |P100 >> > >> >Shouldn't the ID's be further apart than that? Know what I'm saying? >> > >> >Tyler >> > >> >- Original Message - >> >From: "Martin Towell" <[EMAIL PROTECTED]> >> >To: "'Tyler Longren'" <[EMAIL PROTECTED]>; "Jack Dempsey" >> ><[EMAIL PROTECTED]> >> >Cc: "PHP-General" <[EMAIL PROTECTED]> >> >Sent: Monday, November 12, 2001 10:45 PM >> >Subject: RE: [PHP] for loop problem? >> > >> > >> >> How about changing the logic lightly? try this: >> >> >> >> $value1 = 0; >> >> $value2 = 223109; >> >> for($i=$value1; $i<=$value2; $i++) { >> >> $tmp = sprintf("1%06d\n", $i); >> >> mysql_query("INSERT INTO passcodes (passcode) VALUES ('P$tmp')"); >> >> >> >> basically taking away 1,000,000 from the numbers then adding it back on >> >> later >> >> >> >> Martin T >> >> >> >> -Original Message- >> >> From: Tyler Longren [mailto:[EMAIL PROTECTED]] >> >> Sent: Tuesday, November 13, 2001 3:38 PM >> >> To: Jack Dempsey >> >> Cc: PHP-General >> >> Subject: Re: [PHP] for loop problem? >> >> >> >> >> >> I've ran it a few times without the MySQL code in there. Runs just >fine >> >> that way for me too. After it's run a few times for me (with the MySQL >> >> code), I start getting duplicate entries of codes in there. For >example, >> >> I'll end up with a few 'P100' entries in the 'passcodes' field. >> >> >> >> Oh well, here I come perl! >> >> >> >> Thanks, >> >> Tyler >> >> >> >> - Original Message - >> >> From: "Jack Dempsey" <[EMAIL PROTECTED]> >> >> To: "Tyler Longren" <[EMAIL PROTECTED]>; ><[EMAIL PROTECTED]> >> >> Sent: Monday, November 12, 2001 10:43 PM >> >> Subject: RE: [PHP] for loop problem? >> >> >> >> >> >>
Re: [PHP] for loop problem?
Tyler Longren wrote: > > Here's something interesting though. There's an id field that's set to > AUTO_INCREMENT. Yep, and that's one thing I've been looking at. See, I find it strange that you need an KEY idpass (id, passcode(245)) when the ID is quaranteed to be unique in itself. Funny... Would not explain why you get more, I'd rather expect you to get fewer entries. Anyway. Try this: Drop the passcode VARCHAR and make it fixed CHAR(10). It seems like MySQL can't keep up with the speed of your inserts, and varchar is obnoxiously slow. -- 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] Using PHP for CGI
Hello, I'm interested in a comparison study for using PHP vs. Perl for CGI programming. Specifically, I'm looking for information comparing the two in terms of speed, memory usage and efficiency. Any information or url's would be appreciated. Thanks, Don -- 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] Compiling PHP for Apache.
Hi! Right now, I'm trying to figure out which step in order is appropriate. I'm going to put it down now, if I got it wrong then help me out with the correct order. Whether it is from scratch or from existing softwares. 1) OpenSSL 2) libmcrypt (Add-on to PHP) 3) PHP 4.0 4) mod_ssl 5) apache Thanks, Scott -- 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] For India -- a fountain
For India / a fountain We have been working on a completely volunteer PHP/ MySQL / Linux project for about 6 months. It is a low-overhead way to showcase and fundraise for new small charitable projects. We just received (Jan 10th) tax exemption from the IRS as well as clearance to give grants overseas. We expected to complete work in about 2-3 months using part-time PHP coders. Then the earthquake happened. So we are asking ourselves, even though we are not prepared, if we can mobilize our resources and build this in time to give rebuilding grants, health grants, and other assistance grants to India. It is impossible to do our very ambitious web-site with the handful of PHP coders and get it ready in time. But I have been on PHP.net's list-serve for a few weeks and I have seen the *fountain* of knowledge and assistance and so I can't resist asking for your help. Right now our team is distributed over the US (Virginia, California, Arizona) and we've had help from a coder in Croatia. And the last two to join are from Vitebsk, Bellarus, and Delhi, India. If you are interested in learning more please email me at [EMAIL PROTECTED] or [EMAIL PROTECTED] I hope I didn't offend anyone for posting this non-tech notice but I had to ask. If a few of you said yes, it could make it a whole different ballgame. Mark Intelligence . . . is the faculty of making artificial objects, especially tools to make tools. --Henri Bergson -- 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] For My Information
Over 60% of websites use Apache. Many people using MySQL and PHP also run Apache for the complete open source solution. This is cheap to set up, and easy to get support for (there's even a mailing list called AMP - Apache/MySQL/PHP). And, IIRC, those on NT 4.0 Workstation don't *have* IIS. It's easy to configure and maintain, is constantly being upgraded and bug-fixed, and has tons of support and reference online. Just my 0.02 euros, obviously. Cheers Jon -Original Message- From: Dan Malcolm [mailto:[EMAIL PROTECTED]] Sent: 02 February 2001 11:49 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] For My Information I see in the posts, that a lot of people are using Apache on NT instead of the built in IIS. Is there a reason? I have PHP up and running with dBase tables converted to MySQL and ODBC connected to Access 2000, on an NT 4 box with IIS 4 and it runs very well. Performance is great. My only problem is automating the conversion to update tables in MySQL. I would like like to convert the Access 2000 tables also but the converters either don't seem to work with Access 2k, or not much at all, or are not such that a timed batch file can be generated using them. I just looked at what I've written and it's a little jumbled. Mega-Sigh. Let me summarize. 1.. Why Apache on NT 4.0? 2.. Is there a good way to automatically convert Access 2000 to MySQL to keep MySQL data up to date? The data needs to be updated several times a week. No I can't just switch everything over and not have to convert again. 3.. A way to do #2 for dBase would be good too, but less critical because the data only gets updated every couple months. Thanks in advance. Dan Malcolm [EMAIL PROTECTED] [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 for NetWare?
Ugh Netware. I believe that is Windows oriented/based so try the windows distrobutions - Original Message - From: "Tony Gettig" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 03, 2001 7:49 AM Subject: [PHP] PHP for NetWare? Hi there, Is PHP available for NetWare? I've looked high and low and find no reference to such a beast. I prefer PHP on my Linux box, but I need to explore being able to put it on a NetWare server running Netscape Enterprise. TIA for any pointers in the right direction. Tony Gettig Network Administrator Kalamazoo Public Schools -- 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 for NetWare?
Actually, NetWare is a very different operating system than Windows. It's a direct competitor to M$. Way more stable than windows. If PHP is available for NetWare, someone must have ported to the platform to run either as an NLM or with the JVM. There's a queston: is there perhaps a java executable version of PHP? If so, it could feasibly run on NetWare. The Netscape Enterprise server for NetWare supports ASP, which is not preferable to PHP. I'd really like to stick with PHP. Tony Gettig Network Administrator Kalamazoo Public Schools >>> "Chris Anderson" <[EMAIL PROTECTED]> 07/03/01 12:44PM >>> Ugh Netware. I believe that is Windows oriented/based so try the windows distrobutions - Original Message - From: "Tony Gettig" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 03, 2001 7:49 AM Subject: [PHP] PHP for NetWare? Hi there, Is PHP available for NetWare? I've looked high and low and find no reference to such a beast. I prefer PHP on my Linux box, but I need to explore being able to put it on a NetWare server running Netscape Enterprise. TIA for any pointers in the right direction. Tony Gettig Network Administrator Kalamazoo Public Schools -- 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] PHP for NetWare?
Actually, Netware isn't specifically a "direct" competitor of Microsloth. Netware is strictly a NOS (network operating System), where as Windows is a network, server and client OS. Now, this certainly isn't meant to make it look as if I like M$, but I used to work on my company's General Motors account, and GM has (literally) the world's largest NDS Tree/Novell Network. Frankly, it's not all that great. Whether Wind-woes 2000 and AD will be better has yet to be seen, but NW isn't too great either. At any rate, no, there is currently no (supported/official) port of PHP to Netware, and frankly I doubt there's much, if any, work being done on such a project. At the rate NW is losing it's customer base, there may be more client's with OS/2 then servers with NW soon. Jesse Williams -Original Message- From: Tony Gettig [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 03, 2001 1:10 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP for NetWare? Actually, NetWare is a very different operating system than Windows. It's a direct competitor to M$. Way more stable than windows. If PHP is available for NetWare, someone must have ported to the platform to run either as an NLM or with the JVM. There's a queston: is there perhaps a java executable version of PHP? If so, it could feasibly run on NetWare. The Netscape Enterprise server for NetWare supports ASP, which is not preferable to PHP. I'd really like to stick with PHP. Tony Gettig Network Administrator Kalamazoo Public Schools >>> "Chris Anderson" <[EMAIL PROTECTED]> 07/03/01 12:44PM >>> Ugh Netware. I believe that is Windows oriented/based so try the windows distrobutions - Original Message - From: "Tony Gettig" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 03, 2001 7:49 AM Subject: [PHP] PHP for NetWare? Hi there, Is PHP available for NetWare? I've looked high and low and find no reference to such a beast. I prefer PHP on my Linux box, but I need to explore being able to put it on a NetWare server running Netscape Enterprise. TIA for any pointers in the right direction. Tony Gettig Network Administrator Kalamazoo Public Schools -- 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] PHP for NetWare?
I agree, I've had it at work and I hated it. I love my SuSE box at home. What more security do you need than Linux? - Original Message - From: "Jesse S. Williams" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 04, 2001 3:30 AM Subject: RE: [PHP] PHP for NetWare? > Actually, Netware isn't specifically a "direct" competitor of Microsloth. > Netware is strictly a NOS (network operating System), where as Windows is a > network, server and client OS. Now, this certainly isn't meant to make it > look as if I like M$, but I used to work on my company's General Motors > account, and GM has (literally) the world's largest NDS Tree/Novell Network. > Frankly, it's not all that great. Whether Wind-woes 2000 and AD will be > better has yet to be seen, but NW isn't too great either. > > At any rate, no, there is currently no (supported/official) port of PHP to > Netware, and frankly I doubt there's much, if any, work being done on such a > project. At the rate NW is losing it's customer base, there may be more > client's with OS/2 then servers with NW soon. > > > Jesse Williams > > > > > > -Original Message- > From: Tony Gettig [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 03, 2001 1:10 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] PHP for NetWare? > > > Actually, NetWare is a very different operating system than Windows. It's a > direct competitor to M$. Way more stable than windows. If PHP is available > for NetWare, someone must have ported to the platform to run either as an > NLM or with the JVM. > > There's a queston: is there perhaps a java executable version of PHP? If so, > it could feasibly run on NetWare. > > The Netscape Enterprise server for NetWare supports ASP, which is not > preferable to PHP. I'd really like to stick with PHP. > > > Tony Gettig > Network Administrator > Kalamazoo Public Schools > > > > >>> "Chris Anderson" <[EMAIL PROTECTED]> 07/03/01 12:44PM >>> > Ugh Netware. I believe that is Windows oriented/based so try the windows > distrobutions > - Original Message - > From: "Tony Gettig" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, July 03, 2001 7:49 AM > Subject: [PHP] PHP for NetWare? > > > Hi there, > > Is PHP available for NetWare? I've looked high and low and find no reference > to such a beast. I prefer PHP on my Linux box, but I need to explore being > able to put it on a NetWare server running Netscape Enterprise. TIA for any > pointers in the right direction. > > > Tony Gettig > Network Administrator > Kalamazoo Public Schools > > > > > -- > 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] PHP for NetWare?
NetWare is great for an enterprise where directory enabled management is a requirement. And it is bullet-proof secure and 24/7 reliable if setup correctly. (Most NOS's are with a couple of exceptions. :) I work for a school system, and I can't imagine managing accounts on multiple servers without NDS. NDS is at version 8.x, whereas AD is at 1.0. And you don't need NetWare to have NDS. It runs on NT, 2000, Solaris, and Linux too. There's an LDAP server for NetWare that seems (so far) to work good too. I'm interacting with it from a PHP script with no problems at all. Someone has tried porting PHP to NetWare as recently as this past April. I emailed him this morning and await a reply. Since there seems to be no NetWare port of PHP yet, I think it would be great to get it started as a new open source project. Tony Gettig Network Administrator Kalamazoo Public Schools >>> "Chris Anderson" <[EMAIL PROTECTED]> 07/05/01 12:03PM >>> I agree, I've had it at work and I hated it. I love my SuSE box at home. What more security do you need than Linux? - Original Message - From: "Jesse S. Williams" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, July 04, 2001 3:30 AM Subject: RE: [PHP] PHP for NetWare? > Actually, Netware isn't specifically a "direct" competitor of Microsloth. > Netware is strictly a NOS (network operating System), where as Windows is a > network, server and client OS. Now, this certainly isn't meant to make it > look as if I like M$, but I used to work on my company's General Motors > account, and GM has (literally) the world's largest NDS Tree/Novell Network. > Frankly, it's not all that great. Whether Wind-woes 2000 and AD will be > better has yet to be seen, but NW isn't too great either. > > At any rate, no, there is currently no (supported/official) port of PHP to > Netware, and frankly I doubt there's much, if any, work being done on such a > project. At the rate NW is losing it's customer base, there may be more > client's with OS/2 then servers with NW soon. > > > Jesse Williams > > > > > > -Original Message- > From: Tony Gettig [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 03, 2001 1:10 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] PHP for NetWare? > > > Actually, NetWare is a very different operating system than Windows. It's a > direct competitor to M$. Way more stable than windows. If PHP is available > for NetWare, someone must have ported to the platform to run either as an > NLM or with the JVM. > > There's a queston: is there perhaps a java executable version of PHP? If so, > it could feasibly run on NetWare. > > The Netscape Enterprise server for NetWare supports ASP, which is not > preferable to PHP. I'd really like to stick with PHP. > > > Tony Gettig > Network Administrator > Kalamazoo Public Schools > > > > >>> "Chris Anderson" <[EMAIL PROTECTED]> 07/03/01 12:44PM >>> > Ugh Netware. I believe that is Windows oriented/based so try the windows > distrobutions > - Original Message - > From: "Tony Gettig" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, July 03, 2001 7:49 AM > Subject: [PHP] PHP for NetWare? > > > Hi there, > > Is PHP available for NetWare? I've looked high and low and find no reference > to such a beast. I prefer PHP on my Linux box, but I need to explore being > able to put it on a NetWare server running Netscape Enterprise. TIA for any > pointers in the right direction. > > > Tony Gettig > Network Administrator > Kalamazoo Public Schools > > > > > -- > 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]
[PHP] PHP for Apache 2.0
According to Apache, modules made for Apache 1.3 will not work as-is in 2.0 due to changes in the API. Is a version of PHP 4 for Apache 2.0 coming out? -- === Patrick Dunford, Christchurch, NZ - http://pdunford.godzone.net.nz/ Ill-gotten treasures are of no value, but righteousness delivers from death. -- Proverbs 10:2 http://www.heartlight.org/cgi-shl/todaysverse.cgi?day=20010414 === Created by Mail2Sig - http://pdunford.godzone.net.nz/software/mail2sig/ -- 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] ooops PHP for Zope
ooops - sorry about the other e-mail... I am sleeping here... heheheeh Hello! Any comments in PHP for Zope? I don't know much though... Some people told me that Zope is good a while ago... And I saw that now they have a PHP layer... How good is zope? Thank you, Rom -- 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] for and emailmessage
So sprach »Jan Grafström« am 2001-09-02 um 22:17:34 +0200 : > $i = 0; > $ii = count($vn); Sure that $vn contains anything? Add this line after the count() line to see what $vn contains: var_dump($vn); Alexander Skwar -- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.digitalprojects.com | http://www.iso-top.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 6 hours 16 minutes -- 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] For the RegExps gurus!
I want to write a RegExp that converts something like this: $mem = " Hello world! http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com" how can I write a single regexp that converts $mem to this: $mem = " Hello world! http://www.helloworld.com";>http://www.helloworld.com\n Hello world! ftp://ftp.server.com";>ftp://ftp.server.com\n Hello world http://www.helloworld.com";>http://www.helloworld.com" As you noticed that the second line didn't have the protocol specifier and it took by default "http://"; and the ones that had a protocol specifier were kept as is. -- 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] for loop changes?
From: "Michael Gerholdt" <[EMAIL PROTECTED]> > I want the week and month days to have leading zeros - how can I make the > new environment replicate the old? Loop using the numeric but use printf for the formatting (which is really what you should have used originally). Refer to the manual for the many and varied ways printf can be used. Mark C. -- 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: PHP for 3D scatterplots
"Simon De Deyne" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > is there any code for this available yet? > I am looking for a way of plotting gif images of objects > in a 3D space... > > thank you! > Simon Don't know of any offhand, but it doesn't sound all THAT hard to develop... actually, it could be kind of interesting. In fact, if you want to include a few more details I might whip up a demo for you. - what kind of axis scaling do you want? (linear / log) - axis data range figured how? (specified / auto) - where do you want the axis drawn (back edge / full box / at 0s) - what kind of projection (orthogonal / perspective) - how to draw data points (single-pixel / ball / icon) - depth indication (none / shading / drop-line to axis / other) - should data points be scaled (no / by size / by color) - how to handle overlapping / coincident data (ignore / emphasize) - how to color data points (specified / per-point / random/arbitrary) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] For Loop going too long
I have a question about something weird that I've noticed Here's some code that I have that loads up $sql = "SELECT * FROM pickup_times WHERE DAYOFMONTH(time0_name) = $dayofmonth"; $result = mysql_query($sql, $dbh); $day = mysql_fetch_array($result); for ($i=0; $i"; When I do this it prints out 2 times the number of columns that I actually have plus 1. All of the ones past the actual number of columns are just empty, but is there something that I'm doing wrong? Thanks, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using php for keywords
Here's a start. http://www.phpbuilder.com/columns/tim2526.php3 olinux --- Marc <[EMAIL PROTECTED]> wrote: > hi > > how can i use php to list keywords in search engines > ?!? > how to index a website keywords via php =) > > plz mail > > thx > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using PHP for NULLs
I do believe it is a MySql question!! What's wrong with the old standard way as: $result = mysql_query(" SELECT *, if (last_name is NULL,'zzz end',last_name) as last_name_sort FROM new_miatapix ORDER BY last_name_sort LIMIT $page, 20"); Good Luck.. HTH.. Dan.. === Jason Soza wrote: > I thought this was a MySQL question, or something that could be solved using > a creative SQL string, but after looking through the MySQL manual, I don't > think I can handle this with the database alone. According to the manual, > MySQL always sorts NULL values first - I want them last. I have a last_name > field that sometimes contains people's last names, sometimes they choose not > to enter their last names. I want those who don't enter a last name to end > up last on the list. > > Right now I have: $result = mysql_query("SELECT * FROM new_miatapix ORDER BY > last_name LIMIT $page, 20"); > > Am I going to have to do two queries here, then store them somehow using an > array? It seems like I'm going to have to do one query to get all NULL > values for last_name, then do another query to get all NOT NULL values for > last_name, but how would I handle that after I get it to PHP? > > Or can I use some PHP function to sort $result to place all NULL values > last? I'd check the PHP manual, but it seems to not be responding well at > the moment. > > Thanks, > > Jason Soza > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP for AIX.5.1
Go to PHP website, http://www.php.net and at the top, you'll see the download hyperlink. Click on that. Then use the tar.gz file under the title, "Complete Source Code". This is what I use with AIX. If you use the RPM to install other softwares, then you'll have to make sure the ./configure option can find the files. It is a matter of using hte environment variables and file paths. I had end up going back to AIX 4.3.3 because AIX 5.x use alot of Operating System archecture change. FletchSOD "A Jeyaraj" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > I like to know where i can get the > PHP download for the AIX.5.1 > > Pl, let me know the information. > > Regards, > Jey > > > _ > There is always a better job for you at Monsterindia.com. > Go now http://monsterindia.rediff.com/jobs > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP for AIX.5.1
That is because AIX 5.1 uses a linux kernel. That implies alot of changes for the architecture... However, I think you should be able to compile for 5.1, but you'll need the required libraries which have to be compiled and installed as well... which implies that you need the development stuff like gcc/gmake (I thought gmake was used, from the top of my head) "Scott Fletcher" <[EMAIL PROTECTED]> schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Go to PHP website, http://www.php.net and at the top, you'll see the > download hyperlink. Click on that. Then use the tar.gz file under the > title, "Complete Source Code". This is what I use with AIX. If you use the > RPM to install other softwares, then you'll have to make sure the > ./configure option can find the files. It is a matter of using hte > environment variables and file paths. I had end up going back to AIX 4.3.3 > because AIX 5.x use alot of Operating System archecture change. > > FletchSOD > > "A Jeyaraj" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi all, > > > > I like to know where i can get the > > PHP download for the AIX.5.1 > > > > Pl, let me know the information. > > > > Regards, > > Jey > > > > > > _ > > There is always a better job for you at Monsterindia.com. > > Go now http://monsterindia.rediff.com/jobs > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP for AIX.5.1
Yea, it use the Linux Kernel. I had to download RPM stuffs from IBM. It can not be from Red Hat or any other. IBM take the source code and put it into RPM. IBM kept making error message about some RPMs, so that is why I went back to non-linux kernal AIX. "Michiel Lange" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > That is because AIX 5.1 uses a linux kernel. That implies alot of changes > for the architecture... > However, I think you should be able to compile for 5.1, but you'll need the > required libraries which have to be compiled and installed as well... which > implies that you need the development stuff like gcc/gmake (I thought gmake > was used, from the top of my head) > > > "Scott Fletcher" <[EMAIL PROTECTED]> schreef in bericht > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Go to PHP website, http://www.php.net and at the top, you'll see the > > download hyperlink. Click on that. Then use the tar.gz file under the > > title, "Complete Source Code". This is what I use with AIX. If you use > the > > RPM to install other softwares, then you'll have to make sure the > > ./configure option can find the files. It is a matter of using hte > > environment variables and file paths. I had end up going back to AIX > 4.3.3 > > because AIX 5.x use alot of Operating System archecture change. > > > > FletchSOD > > > > "A Jeyaraj" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Hi all, > > > > > > I like to know where i can get the > > > PHP download for the AIX.5.1 > > > > > > Pl, let me know the information. > > > > > > Regards, > > > Jey > > > > > > > > > _ > > > There is always a better job for you at Monsterindia.com. > > > Go now http://monsterindia.rediff.com/jobs > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using PHP for server utilities
Hello- I am dreading having to break out my perl books, so here is a thought about using PHP on the server to handle a chore for me. I have a Linux ftp server that accepts files from a mainframe every night. I need to take those files, determine when the transfer is done and then re-send them to another machine across a wan. When that transfer is complete I need to make a new directory (date would be ok) and move all of the files into that directory, tar them and finally produce a status page. Thoughts? Has anyone tried this with php? BTW--it has to be automatic as a cron job. Thanks in advance. -Scott -- 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] Using PHP for directory indexing
Hi All, I am wondering if anyone can help me with this. I want people accessing my site to see a list of HTML reports but I don't want to turn on Directory indexing on my Apache webserver, seeing as the directory path is present. What I'm looking to do, is to write a basic php script which will read the files in a certain directory & create links to be presented to the user. Has anyone ever done this before? Can someone give me an example or a headstart on this. Thanks in advance Kev _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- 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] ? for the Reg Ex people
I'm making a small script that imports HTML pages and I need to do some string replacement. I need to replace add a url to all the 'HREF' links and images, but if someone could just give me an example of how to replace and append the HREF part, I think I can figure it out. It needs to find all the variations of HREF, such as 'HREF = "', href="', 'href =', etc. So it needs to be space and capitalization carefree. THANKS TO ANYONE WHO HELPS!!! Jason Bryner [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 PHP for CGI
> I'm interested in a comparison study for using PHP vs. Perl for CGI > programming. Specifically, I'm looking for information comparing the > two in terms of speed, memory usage and efficiency. Any information or > url's would be appreciated. Check the FAQ. http://php.net/FAQ.php If you really mean to compare them as *CGI* for performance... Why? CGI performance is grossly inferior to Module, no?... -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm -- 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] Compiling PHP for Apache.
El Jue 15 Feb 2001 11:47, escribiste: > Hi! > > Right now, I'm trying to figure out which step in order is > appropriate. I'm going to put it down now, if I got it wrong then help me > out with the correct order. Whether it is from scratch or from existing > softwares. > > > 1) OpenSSL > 2) libmcrypt (Add-on to PHP) > 3) PHP 4.0 > 4) mod_ssl > 5) apache OS is an importante issue. More info please. Saludos... ;-) -- System Administration: It's a dirty job, but someone told I had to do it. - Martín Marqués email: [EMAIL PROTECTED] Santa Fe - Argentinahttp://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar - -- 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] Compiling PHP for Apache.
you might find this useful http://www.devshed.com/Server_Side/PHP/SoothinglySeamless/ best regards Ankur Verma HCL Technologies A1CD, Sec -16 Noida, UP India - Original Message - From: "Scott Fletcher" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 15, 2001 8:17 PM Subject: [PHP] Compiling PHP for Apache. > Hi! > > Right now, I'm trying to figure out which step in order is > appropriate. I'm going to put it down now, if I got it wrong then help me > out with the correct order. Whether it is from scratch or from existing > softwares. > > > 1) OpenSSL > 2) libmcrypt (Add-on to PHP) > 3) PHP 4.0 > 4) mod_ssl > 5) apache > > Thanks, > Scott > > > > -- > 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] for() problem on php-4.0.6
Hi All, a for statment like below has been worked lowe php versions: for ( $idx = "01"; $idx <= 12; $idx++ ) { echo " $idx\n"; } like 01, 02, 03, 04, ... 12 but same statment on 4.0.6 version, it writes 01, 2, 3, 4, ... 12 what is the different between verisons? or how can I solve this? Regards... Mesut... -- 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] for() problem on php-4.0.6
Hi All, a for statment like below has been worked lowe php versions: for ( $idx = "01"; $idx <= 12; $idx++ ) { echo " $idx\n"; } like 01, 02, 03, 04, ... 12 but same statment on 4.0.6 version, it writes 01, 2, 3, 4, ... 12 what is the different between verisons? or how can I solve this? Regards... Mesut... -- 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 for Apache 2.0
Patrick Dunford wrote: > According to Apache, modules made for Apache 1.3 will not work as-is > in 2.0 due to changes in the API. > > Is a version of PHP 4 for Apache 2.0 coming out? Try the configure-option --with-apxs2 instead of --with-apxs and it should work with Apache 2. PHP 4 supports far more than one Webserver-API. regards Wagner -- 'When the computer industry is at a low, beer drinking is at a high.' Jon 'maddog' Hall said. By combining both industries into a single course you can make sure you always have a job. -- 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 for Apache 2.0
I've got PHP up and running partially under Apache 2.0 quite some time ago, however despite the sweetness of Apache 2, this is probably not something you want to do. Looking forward to PHP coming out more fully for Apache 2.0, if there is anything we can do to help it along I'm all ears. August - Original Message - From: "Alexander Wagner" <[EMAIL PROTECTED]> Newsgroups: php.general Sent: Saturday, April 14, 2001 11:07 AM Subject: Re: [PHP] PHP for Apache 2.0 > Patrick Dunford wrote: > > According to Apache, modules made for Apache 1.3 will not work as-is > > in 2.0 due to changes in the API. > > > > Is a version of PHP 4 for Apache 2.0 coming out? > > Try the configure-option --with-apxs2 instead of --with-apxs and it > should work with Apache 2. > > PHP 4 supports far more than one Webserver-API. > > regards > Wagner > > -- > 'When the computer industry is at a low, beer drinking is at a high.' > Jon 'maddog' Hall said. > By combining both industries into a single course you can make sure you > always have a job. > > -- > 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] For the RegExps gurus!
From: _lallous <[EMAIL PROTECTED]> Date: Wed, Sep 05, 2001 at 12:17:21PM +0200 Message-ID: <[EMAIL PROTECTED]> Subject: [PHP] For the RegExps gurus! > I want to write a RegExp that converts something like this: > $mem = " > Hello world! http://www.helloworld.com\n > Hello world! ftp://ftp.server.com\n > Hello world www.helloworld.com" > > how can I write a single regexp that converts $mem to this: > $mem = " > Hello world! href="http://www.helloworld.com";>http://www.helloworld.com\n > Hello world! ftp://ftp.server.com";>ftp://ftp.server.com\n > Hello world href="http://www.helloworld.com";>http://www.helloworld.com" > > As you noticed that the second line didn't have the protocol specifier and > it took by default "http://"; and the ones that had a protocol specifier were > kept as is. This should do the job: --- PHP code --- http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com"; /* -- ! Here's your regexp ! -- */ $mem = preg_replace ("/\s+([http:|ftp:]{0,1}\S+\.\S+)/me", "' \\1' : 'http://\\1\";>http://\\1')", $mem); print ($mem); ?> --- End of PHP code --- Let me know if this was what you were looking for... -- * 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]
Re: [PHP] For the RegExps gurus!
Sort of yes I thought it can be done with the /e modifier! Can't it be done with pure RegExps? "* R&Ze:" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > From: _lallous <[EMAIL PROTECTED]> > Date: Wed, Sep 05, 2001 at 12:17:21PM +0200 > Message-ID: <[EMAIL PROTECTED]> > Subject: [PHP] For the RegExps gurus! > > > I want to write a RegExp that converts something like this: > > $mem = " > > Hello world! http://www.helloworld.com\n > > Hello world! ftp://ftp.server.com\n > > Hello world www.helloworld.com" > > > > how can I write a single regexp that converts $mem to this: > > $mem = " > > Hello world! > href="http://www.helloworld.com";>http://www.helloworld.com\n > > Hello world! ftp://ftp.server.com";>ftp://ftp.server.com\n > > Hello world > href="http://www.helloworld.com";>http://www.helloworld.com" > > > > As you noticed that the second line didn't have the protocol specifier and > > it took by default "http://"; and the ones that had a protocol specifier were > > kept as is. > > > > > > This should do the job: > > --- PHP code --- > > > $mem = "Hello world! http://www.helloworld.com\n > Hello world! ftp://ftp.server.com\n > Hello world www.helloworld.com"; > > /* -- ! Here's your regexp ! -- */ > $mem = preg_replace ("/\s+([http:|ftp:]{0,1}\S+\.\S+)/me", "' (ereg('^[http:|ftp:]','\\1') > ? '\\1\">\\1' > : 'http://\\1\";>http://\\1')", $mem); > > print ($mem); > > ?> > > --- End of PHP code --- > > Let me know if this was what you were looking for... > > > > -- > > * 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]
Re: [PHP] For the RegExps gurus!
> Sort of yes > I thought it can be done with the /e modifier! Well... the /e modifier is used. But you have a different problem, you're matching over multiple lines. That's what the /m modifier is for. > Can't it be done with pure RegExps? Ehh... no. How would you implement an if-statement then? You could use the very simple pure regexps if you don't also want to match/replace the www.some.thing. If you only want to replace the URL's that start with the protocol, then you can use the pure regexps. If not... to bad, you'll need /e. -- * 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]
Re: [PHP] For the RegExps gurus!
> Ehh... no. How would you implement an if-statement then? I thought I could have build a regexp that allow you to specify a default value of a subset if it was not matched... and it seems there is no way then! Thanks Renze. "* R&Ze:" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Sort of yes > > I thought it can be done with the /e modifier! > > Well... the /e modifier is used. But you have a different problem, > you're matching over multiple lines. That's what the /m modifier is > for. > > > > Can't it be done with pure RegExps? > > Ehh... no. How would you implement an if-statement then? You could > use the very simple pure regexps if you don't also want to > match/replace the www.some.thing. If you only want to replace the > URL's that start with the protocol, then you can use the pure > regexps. If not... to bad, you'll need /e. > > -- > > * 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]
Re: [PHP] For the RegExps gurus!
From: _lallous <[EMAIL PROTECTED]> Date: Thu, Sep 06, 2001 at 11:34:45AM +0200 Message-ID: <[EMAIL PROTECTED]> Subject: Re: [PHP] For the RegExps gurus! > > Ehh... no. How would you implement an if-statement then? > I thought I could have build a regexp that allow you to specify a default > value of a subset if it was not matched... > and it seems there is no way then! > > Thanks Renze. Okay... I found a different way. I don't actually think this is better, but the regexp is some what more pure: --- PHP code --- http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com"; /* -- ! Here's the old regexp ! -- */ // $mem = preg_replace ("/\s+([http:|ftp:]{0,1}\S+\.\S+)/me", "' \\1' // : 'http://\\1\";>http://\\1')", $mem); /* -- ! Here's the new regexp ! -- */ // Need an associative array... $repl = array ("" => "http://";, "http://"; => "http://";, "ftp://"; => "ftp://";); // The regexp itself: $mem = preg_replace ("/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/me", "' '.\$repl['\\1'].'\\3'", $mem); print ($mem); ?> --- End of PHP code --- I'll let you know when I find a better way... I think there must be one... -- * 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]
Re: [PHP] For the RegExps gurus!
And another option... --- PHP code --- http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com"; /* -- ! First regexp ! -- */ // $mem = preg_replace ("/\s+([http:|ftp:]{0,1}\S+\.\S+)/me", "' \\1' // : 'http://\\1\";>http://\\1')", $mem); /* -- ! Second regexp ! -- */ // $repl = array ("" => "http://";, // "http://"; => "http://";, // "ftp://"; => "ftp://";); // $mem = preg_replace ("/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/me", // "' '.\$repl['\\1'].'\\3'", // $mem); /* -- ! Third regexp ! -- */ $mem = preg_replace ("/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/me", "' http://\";).'\\3\">'. ('\\1' ? '\\1' : \"http://\";).'\\3'", $mem); print ($mem); ?> --- End of PHP code --- ...and ...keep on trying... -- * 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]
Re: [PHP] For the RegExps gurus!
Thanks alot man! They are all still using /e switch... ;) "* R&Ze:" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > And another option... > > --- PHP code --- > > > $mem = "Hello world! http://www.helloworld.com\n > Hello world! ftp://ftp.server.com\n > Hello world www.helloworld.com"; > > /* -- ! First regexp ! -- */ > // $mem = preg_replace ("/\s+([http:|ftp:]{0,1}\S+\.\S+)/me", "' // href=\"'. > // (ereg('^[http:|ftp:]','\\1') > // ? '\\1\">\\1' > // : 'http://\\1\";>http://\\1')", $mem); > > /* -- ! Second regexp ! -- */ > // $repl = array ("" => "http://";, > // "http://"; => "http://";, > // "ftp://"; => "ftp://";); > // $mem = preg_replace ("/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/me", > // "' // href=\"'.\$repl['\\1'].'\\3\">'.\$repl['\\1'].'\\3'", > // $mem); > > /* -- ! Third regexp ! -- */ > $mem = preg_replace ("/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/me", > "' http://\";).'\\3\">'. > ('\\1' ? '\\1' : \"http://\";).'\\3'", > $mem); > > print ($mem); > > ?> > > --- End of PHP code --- > > ...and ...keep on trying... > > -- > > * 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]
Re: [PHP] For the RegExps gurus!
The reason I don't want to use the /e switch is that i'll be able to port that expression to perl or to javascript. "* R&Ze:" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > And another option... > > --- PHP code --- > > > $mem = "Hello world! http://www.helloworld.com\n > Hello world! ftp://ftp.server.com\n > Hello world www.helloworld.com"; > > /* -- ! First regexp ! -- */ > // $mem = preg_replace ("/\s+([http:|ftp:]{0,1}\S+\.\S+)/me", "' // href=\"'. > // (ereg('^[http:|ftp:]','\\1') > // ? '\\1\">\\1' > // : 'http://\\1\";>http://\\1')", $mem); > > /* -- ! Second regexp ! -- */ > // $repl = array ("" => "http://";, > // "http://"; => "http://";, > // "ftp://"; => "ftp://";); > // $mem = preg_replace ("/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/me", > // "' // href=\"'.\$repl['\\1'].'\\3\">'.\$repl['\\1'].'\\3'", > // $mem); > > /* -- ! Third regexp ! -- */ > $mem = preg_replace ("/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/me", > "' http://\";).'\\3\">'. > ('\\1' ? '\\1' : \"http://\";).'\\3'", > $mem); > > print ($mem); > > ?> > > --- End of PHP code --- > > ...and ...keep on trying... > > -- > > * 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]
Re: [PHP] For the RegExps gurus!
From: _lallous <[EMAIL PROTECTED]> Date: Thu, Sep 06, 2001 at 02:28:03PM +0200 Message-ID: <[EMAIL PROTECTED]> Subject: Re: [PHP] For the RegExps gurus! > Thanks alot man! > > They are all still using /e switch... ;) Yep... still using /e switch. I'm not sure if there's a way to do this without using it. But I'm still pretty sure there's a better way then the three I've mentioned so far. But you know... fact is that I do have to work, so I don't have time to keep on trying nonstop. In between things I'm trying to figure out what's the best way to do this. I believe there's a better way, and I'm (also) trying to figure out a way to do it without /e. Btw... It's your job to try to proof the regexp's aren't correct. Try to find some weird construction in $mem that should be a valid URL but isn't matched/replaced by the regexp's. It's a necessary evil to (try to) proof what you have is wrong. Seems strange, but one should realy try hard to find a way to make one's own program's fail. Only then you can fix realy everything a make the most optimal program. So... if you find something where the regexp's fail: plz let me know. I don't have time to test the regexp's thoroughly. (sorry?!) -- * 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]
Re: [PHP] For the RegExps gurus!
Got another solution. So far the first solution not using the /e modifier. It's not realy the best solution, but I'm still trying to improve it. Getting closer every time... --- PHP code --- http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com"; /* -- ! Fourth regexp ! -- */ $mem = preg_replace ("/\s+([http:|ftp:]*(\/\/)*)(\S+\.\S+)/m", " http://\\1\\3\";>http://\\1\\3", $mem); $mem = preg_replace ("/http:\/\/([http:\/\/|ftp:\/\/]+)/m", "\\1", $mem); print ($mem); ?> --- End of PHP code --- -- * 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]
Re: [PHP] For the RegExps gurus!
Okay... this time an even better solution, without the /e modifier. Think this comes pretty close to some final solution. --- PHP code --- http://www.helloworld.com\n Hello world! ftp://ftp.server.com\n Hello world www.helloworld.com"; /* -- ! Fifth regexp ! -- */ $pattern = array ("~\s+((?:http://|ftp://){0}(?:\w+\.)+(?:\w+))~m", "~\s+((?:http://|ftp://)+(?:\w+\.)+(?:\w+))~m"); $replace = array (" http://$1\";>http://$1", " $1"); $mem = preg_replace ($pattern, $replace, $mem); print ($mem); ?> --- End of PHP code --- This still needs some optimization imo (...) -- * 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]
Re: [PHP] For the RegExps gurus!
And here is version 5.2! I optimized the search patterns. I found out that there was only a very limited scope of URL's that was matched... So I pretty much fixed that now (see the example). Repeating elements from the patterns have been extracted and put in an array, so that you can easily see the diff between the two patterns. Also it's a bit easier to read this way. Also note the adjusted test-string $mem. There are some more realistic URL's in it than before. Just to see that they can realy be matched. --- PHP code --- http://www.helloworld.com/index.html\n Hello world! ftp://ftp-system.server.com?name=Renze%20Munnik\n Hello world! www.helloworld.com this-is/not=a%link.\n Hello world! www.helloworld.com/dynamic-html/main.php?and=some%20Extra"; /* --- RE version 5.2 --- */ /* Sub patterns: */ $sub = array ("(ht|f)tp://",/* protocols */ "(\w+|-)+\.", /* first (required) part of URL */ "\w+[/?=\.%\-]*");/* rest of the URL */ /* Search-patterns: */ $pattern = array ("~\s+(($sub[0])+($sub[1])($sub[2])+)~m", "~\s+(($sub[0]){0}($sub[1])($sub[2])+)~m"); $replace = array (" $1", " http://$1\";>http://$1"); $mem = preg_replace ($pattern, $replace, $mem); print ($mem); ?> --- End of PHP code --- -- * 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]
Re: [PHP] For the RegExps gurus!
On Wed, 5 Sep 2001 12:15:34 +0200 impersonator of [EMAIL PROTECTED] (* R&Ze:) planted &I saw in php.general: >This should do the job: > ... You can keep improving:) or you can use piece of my working (except for $Harlem, to which i am not going:) code (I give it for free this time:) No /me, no ereg, no nothing - gentleMen:)-just /i (did you miss it, btw?:) note1: your url shouldn't be broken in the middle by \n note2: you might see strange characters in patterns - its allowed by standart - cyrilic. If you are sure to not need anything but latinic, take others out. $pref = "([a-z0-9~#%\&=\?/\._-]+?:([a-z0-9~#%\&=\?/\._-]+?@)?)?"; $port = "(:[\d]+)?"; $domain = "([_0-9a-zÿâåðòûóèîïøùýúüþ¸àñäôã÷éêëìíáæöõç][_0-9a-zÿâåðòûóèîïøùýúüþ¸àñäôã÷éêëìíáæöõç-]+?[\.])+[a-z]{2,3}"; $subpat = $domain . $port . "([/\\][a-zÿâåðòûóèîïøùýúüþ¸àñäôã÷éêëìíáæöõç0-9~#%@\&:\.=\?_-]*)*"; $patterns = array ("`(?<=[;\x20^<>{}+-=|\\&%^\^\$#!~:.,\(\)\"'\[])((f|ht)tps?|news)://" . $pref . $subpat ."`i", "`(?<=[;\x20^<\(\)\"'\[])www[\.]" . $subpat . "`i", "`(?<=[;\x20^<\(\)\"'\[])[_\.0-9a-z-]+@" . $domain . "`i"); $links = array ("\\0", "http://\\0'>\\0", "\\0"); $Harlem=explode("\n",$mem); foreach($Harlem as $line){ $line = htmlspecialchars ( $line); $line = preg_replace ($patterns, $links, $line); } >-- >-- 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 >-- -- i leonid http://nux.home.dk3.com/ no phone here, but for other personals - donation info. - visit i site^:) -- 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] For the RegExps gurus!
From: ~~~i LeoNid ~~ <[EMAIL PROTECTED]> Date: Thu, Sep 06, 2001 at 05:30:44PM + Message-ID: <3b97b222.78196206@localhost> Subject: Re: [PHP] For the RegExps gurus! > You can keep improving:) or you can use piece of my working (except for > $Harlem, to which i am not going:) code (I give it for free this time:) > > No /me, no ereg, no nothing - gentleMen:)-just /i (did you miss it, btw?:) If you look at the stuff you sent you'll understand why I improved it. Btw... why the h*ll do you explode() the string you're matching, while there's the /m modifier? You're making it to difficult for yourself (and others). No need for the messy solution you created... Just use RE's that are as simple as possible. It has the best performance and it reads a lot easier. -- * 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]
Re: [PHP] For the RegExps gurus!
On Fri, 7 Sep 2001 09:39:37 +0200 impersonator of [EMAIL PROTECTED] (* R&Ze:) planted &I saw in php.general: > >From: ~~~i LeoNid ~~ <[EMAIL PROTECTED]> >Date: Thu, Sep 06, 2001 at 05:30:44PM + >Message-ID: <3b97b222.78196206@localhost> >Subject: Re: [PHP] For the RegExps gurus! > >> You can keep improving:) or you can use piece of my working (except for >> $Harlem, to which i am not going:) code (I give it for free this time:) >> >> No /me, no ereg, no nothing - gentleMen:)-just /i (did you miss it, btw?:) > > > > > >If you look at the stuff you sent you'll understand why I improved >it. > You didn't. Actually please expose - tell i tell i:). I am all ears:) >Btw... why the h*ll do you explode() the string you're matching, >while there's the /m modifier? You're making it to difficult for >yourself (and others). No need for the messy solution you created... Well. So much fuss of so little issue. I admit, It was just a quick addition for the posting without much thinking (may be just to add $Harlem variable:). You can do without exploding - and no need for other code alterations there, I believe. No need in /m either (Correct me, if I am wrong:), coz I am not checking on beginning or end of string. What other "mess" you have noticed:) >Just use RE's that are as simple as possible. It has the best >performance and it reads a lot easier. > ? RE ? Sorry, I am not a club insider:) Please, > -- 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] For the RegExps gurus!
Ehhh... hai! I've been away on vacation, so it's a bit late, but anyway... > You didn't. Actually please expose - tell i tell i:). I am all ears:) I meant I improved my own versions, not you're version. That's why you can't find the improvement on you're code. If that's what you meant... > ? RE ? Sorry, I am not a club insider:) Not realy any kind of club... just lazy typing; RE stands for Regular Expression. -- * 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]
Re: [PHP] For the RegExps gurus!
On Mon, 17 Sep 2001 13:15:08 +0200 impersonator of [EMAIL PROTECTED] (* R&Ze:) planted &I saw in php.general: >Ehhh... hai! > Halo! Good to see you back:) >I've been away on vacation, so it's a bit late, but anyway... > Indeed late.. Had a good one? > >> You didn't. Actually please expose - tell i tell i:). I am all ears:) > >I meant I improved my own versions, not you're version. That's why >you can't find the improvement on you're code. If that's what you >meant... > Hmm, Why R U not employing smilers, why you after 'humor':) Of course, I meant, that the WAY your code is made is not better, not that you _litteraly_ improved my code (The later case would be a breakage of ownership, so you wouldn't admit it, unless you R a Skliarov' type:) > >> ? RE ? Sorry, I am not a club insider:) > >Not realy any kind of club... just lazy typing; RE stands for >Regular Expression. > Guess wat? I use RegExp abbr. Thats why. Silly me. Now I know that this is not a developer's kit:) TnX a lot. And, BTW, I agree with your thoughts about clarity and simplicity (causing performance 'optimality') of expressions. Not though - that it should be done at the expense of functionality. In the discussed case, your approach is just an approach to solution, sorry, whereus mine include practicaly allowed by standard symbols. May be I am missing something too, but at least do not include, what is not allowed, i hope. Correct me if I am wrong. >-- > >* R&zE: > > >-- >-- Renze Munnik >-- DataLink BV -- Best Regards. i Leonid PS: Have you seen a bike/pilot helmeted guy, speaking of unix advantages, lately? - in your 'dream'. I did - in mine (submitted to me actually:) -- 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] For the RegExps gurus!
> Halo! Good to see you back:) Thanks :) Same here! ...oh... wait; _I_ was the one a was away... Well... anyway: good to be back! > >I've been away on vacation, so it's a bit late, but anyway... > > > Indeed late.. Had a good one? Yep! Sun in France io rain in Holland. But :( I'm back in the rain again. And believe me: IT'S A LOT OF RAIN HERE! > Hmm, Why R U not employing smilers, why you after 'humor':) Of course, I > meant, that the WAY your code is made is not better, not that you > _litteraly_ improved my code (The later case would be a breakage of > ownership, so you wouldn't admit it, unless you R a Skliarov' type:) Skliarov... I'm still free out of prison; so guess not :) > Guess wat? I use RegExp abbr. Thats why. Silly me. Now I know that this is > not a developer's kit:) TnX a lot. 'Silly me'; don't think so. The number of abbr's is pretty huge on these kinds of mailinglists. So the change of someone (_anyone_) missing one is pretty large. Nothing to call yourself 'silly' over. > And, BTW, I agree with your thoughts about clarity and simplicity > (causing performance 'optimality') of expressions. Me too :) > Not though - that it should be done at the expense of > functionality. In the discussed case, your approach is just an > approach to solution, sorry, whereus mine include practicaly > allowed by standard symbols. May be I am missing something too, > but at least do not include, what is not allowed, i hope. Correct > me if I am wrong. And this is where the misunderstanding came up. I thought you were talking about the construction I was using, while you were - and correct me if I'm wrong - talking about the characters I allowed. And concerning those, it might very well be that I don't only allow characters allowed by specifications and even maybe I don't allow characters allowed by specifications. I didn't spend much time on that point. What I did was just creating the RE to parse the URL's. The allowed characters weren't really of my concern then. Let me know... -- * 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]
Re: [PHP] For the RegExps gurus!
On Thu, 20 Sep 2001 10:37:58 +0200 impersonator of [EMAIL PROTECTED] (* R&Ze:) planted &I saw in php.general: >again. And believe me: IT'S A LOT OF RAIN HERE! > "Its raining back, Aleluia":) Like in UK reign in "foggy Albion":)? I can understand you, I used to live in St. Petersburg.. Or do you mean that you visited Monaco (Isn't it a Rein`e - a rulling family there?:) & lost a fortune?:) > >'Silly me'; don't think so. The number of abbr's is pretty huge on Thank you for comforting me:) _That_ was what I had in mind (+coquetry:) writing (not _thinking_) this, of course:) >And this is where the misunderstanding came up. I thought you were >talking about the construction I was using, while you were - and >correct me if I'm wrong - talking about the characters I allowed. Well, as far as i am concerned, these two can not be separated for such issues. This IS functionality of the script, applied to what it needs done. (Its _not_ like separating a messenger from a message, which _idealy_, should always be performed, provided the MSG is independent of messenger <-[quite seldom, unfortunately, in our "team work" times]) >And concerning those, it might very well be that I don't only allow >characters allowed by specifications and even maybe I don't allow >characters allowed by specifications. I didn't spend much time on >that point. What I did was just creating the RE to parse the URL's. >The allowed characters weren't really of my concern then. > So, the "URL's" is not the right word here, then:) And th WAY, you did it, (even irrelevant of character set, as far, as it could be) - I compared with mine (not yours previous) - and havn't found, what I can improve. Believe me, if i see s/t usefull for me, i would use it, as long as it is not copyrighted:) >Let me know... > Just did. Best regards. -- i leonid http://nux.home.dk3.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] readline() Fails in PHP for Win2000
What do I need to do to allow the readline functions to work? The following short program fails when run from the command line: Execution command and error message: C:\>php -q myscript.php Fatal error: Call to undefined function: readline() in C:\myscript.php on line 2 My system: Windows 2000 PHP version 4.1.1 I installed PHP from binaries. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] For Loop going too long
On Sat, 2002-03-30 at 15:40, David Johansen wrote: > I have a question about something weird that I've noticed Here's some code > that I have that loads up > >$sql = "SELECT * FROM pickup_times WHERE DAYOFMONTH(time0_name) = > $dayofmonth"; > >$result = mysql_query($sql, $dbh); >$day = mysql_fetch_array($result); >for ($i=0; $i echo "I: $i Result: $day[$i]"; > > When I do this it prints out 2 times the number of columns that I actually > have plus 1. All of the ones past the actual number of columns are just > empty, but is there something that I'm doing wrong? Thanks, > Dave Yup. ;) Give http://www.php.net/mysql_fetch_array a thorough beating. The function returns the results both in associatively-indexed elements and in indexed ones, so you get each one twice. Try the following and it should become clearer: $result = mysql_query($sql, $dbh); // Try both of the following lines and notice the difference. //$day = mysql_fetch_array($result); $day = mysql_fetch_array($result, MYSQL_ASSOC); foreach ($day as $colname => $value) { echo "Column name: $colname; Value: $value\n"; } Cheers! -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] For Loop going too long
Try a foreach... it works well... -Original Message- From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]] On Behalf Of Lars Torben Wilson Sent: Saturday, March 30, 2002 4:38 PM To: David Johansen Cc: [EMAIL PROTECTED] Subject: Re: [PHP] For Loop going too long On Sat, 2002-03-30 at 15:40, David Johansen wrote: > I have a question about something weird that I've noticed Here's some code > that I have that loads up > >$sql = "SELECT * FROM pickup_times WHERE DAYOFMONTH(time0_name) = > $dayofmonth"; > >$result = mysql_query($sql, $dbh); >$day = mysql_fetch_array($result); >for ($i=0; $i echo "I: $i Result: $day[$i]"; > > When I do this it prints out 2 times the number of columns that I actually > have plus 1. All of the ones past the actual number of columns are just > empty, but is there something that I'm doing wrong? Thanks, > Dave Yup. ;) Give http://www.php.net/mysql_fetch_array a thorough beating. The function returns the results both in associatively-indexed elements and in indexed ones, so you get each one twice. Try the following and it should become clearer: $result = mysql_query($sql, $dbh); // Try both of the following lines and notice the difference. //$day = mysql_fetch_array($result); $day = mysql_fetch_array($result, MYSQL_ASSOC); foreach ($day as $colname => $value) { echo "Column name: $colname; Value: $value\n"; } Cheers! -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- 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] Re: Using PHP for NULLs
Thanks for the help! I spent more time looking at IFNULL() when I should've just been looking at IF(). Thanks again, sorry for the off-topic! Jason Soza -Original Message- From: Dan Koken [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 18, 2002 11:16 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Using PHP for NULLs I do believe it is a MySql question!! What's wrong with the old standard way as: $result = mysql_query(" SELECT *, if (last_name is NULL,'zzz end',last_name) as last_name_sort FROM new_miatapix ORDER BY last_name_sort LIMIT $page, 20"); Good Luck.. HTH.. Dan.. === Jason Soza wrote: > I thought this was a MySQL question, or something that could be solved using > a creative SQL string, but after looking through the MySQL manual, I don't > think I can handle this with the database alone. According to the manual, > MySQL always sorts NULL values first - I want them last. I have a last_name > field that sometimes contains people's last names, sometimes they choose not > to enter their last names. I want those who don't enter a last name to end > up last on the list. > > Right now I have: $result = mysql_query("SELECT * FROM new_miatapix ORDER BY > last_name LIMIT $page, 20"); > > Am I going to have to do two queries here, then store them somehow using an > array? It seems like I'm going to have to do one query to get all NULL > values for last_name, then do another query to get all NOT NULL values for > last_name, but how would I handle that after I get it to PHP? > > Or can I use some PHP function to sort $result to place all NULL values > last? I'd check the PHP manual, but it seems to not be responding well at > the moment. > > Thanks, > > Jason Soza > > -- 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] Re: Using PHP for NULLs
[snip] I do believe it is a MySql question!! What's wrong with the old standard way as: $result = mysql_query(" SELECT *, if (last_name is NULL,'zzz end',last_name) as last_name_sort FROM new_miatapix ORDER BY last_name_sort LIMIT $page, 20"); $result = mysql_query("SELECT * FROM new_miatapix ORDER BY last_name LIMIT $page, 20"); [/snip] And then there is the very old standard; SELECT * FROM new_miatapix ORDER BY last_name DESC LIMIT $page 20 HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP for AIX.5.1
Scott Fletcher wrote: > Yea, it use the Linux Kernel. I had to download RPM stuffs from IBM. It > can not be from Red Hat or any other. IBM take the source code and put it > into RPM. IBM kept making error message about some RPMs, so that is why I > went back to non-linux kernal AIX. > ðÒÉ×ÅÔ! Try installing the RPMs with the --force parameter. It usually solves the problem on Linux and since the kernel is the same... ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP for server utilities
Scott, This seems a pretty elementary task, ATC, though the detection of when the transfers are done is problematic. You could use the filesystem functions, particularly stat(), for assistance. I run php code as regular programs, not for web-based access, pretty regularly. You simply use the shebang on the first line of your file, as in Perl, etc. #!/usr/local/bin/php "The rest is left as an exercise for the reader" Cheers, Chuck At 7:32 AM -0700 10/25/01, Scott wrote: >Hello- > >I am dreading having to break out my perl books, so here is a thought >about using PHP on the server to handle a chore for me. > >I have a Linux ftp server that accepts files from a mainframe every >night. I need to take those files, determine when the transfer is >done and then re-send them to another machine across a wan. When that >transfer is complete I need to make a new directory (date would be ok) >and move all of the files into that directory, tar them and finally >produce a status page. > >Thoughts? Has anyone tried this with php? BTW--it has to be automatic >as a cron job. > >Thanks in advance. > >-Scott > >-- >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] Chuck Theobald, Technology Manager ERIC Clearinghouse on Educational Management 5207 University of Oregon, Eugene, OR, 97403-5207 800-438-8841 * 541-346-1662 (voice) * 541-346-2334 (fax) * 541-337-0182 (cell) * * http://eric.uoregon.edu/ * 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]
RE: [PHP] Using PHP for directory indexing
\n"); // open directory $myDirectory = dir("."); // get each entry while($entryName = $myDirectory->read()) { print("$entryName \n"); } // close directory $myDirectory->close(); print("\n"); ?> Sjoerd van Oosten Digitaal vormgever [EMAIL PROTECTED] Datamex E-sites B.V. http://www.esites.nl Minervum 7368 Telefoon: (076) 5 730 730 4817 ZH BREDA Telefax: (076) 5 877 757 ___ -Oorspronkelijk bericht- Van: Kevin Garrett [mailto:[EMAIL PROTECTED]] Verzonden: maandag 12 november 2001 14:08 Aan: [EMAIL PROTECTED] Onderwerp: [PHP] Using PHP for directory indexing Hi All, I am wondering if anyone can help me with this. I want people accessing my site to see a list of HTML reports but I don't want to turn on Directory indexing on my Apache webserver, seeing as the directory path is present. What I'm looking to do, is to write a basic php script which will read the files in a certain directory & create links to be presented to the user. Has anyone ever done this before? Can someone give me an example or a headstart on this. Thanks in advance Kev _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- 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 PHP for directory indexing
function GetFiles ($DataPath, &$files, &$nfiles) { // Reads a directory and puts filenames into a sorted array $handle=opendir($DataPath); if ($handle) { $nfiles = -1; while (false!==($file = readdir($handle))) { if ($file != "." && $file != "..") { $nfiles++; $files[$nfiles] = $file; } } sort($files); closedir($handle); } return 0; } Rudolf Visagie Principal Software Developer Digital Healthcare Solutions Tel. +27(0)11 266 6946 Fax. +27(0)11 266 5080 Cell: +27(0)82 895 1598 E-mail: [EMAIL PROTECTED] -Original Message- From: Kevin Garrett [mailto:[EMAIL PROTECTED]] Sent: 12 November 2001 03:08 To: [EMAIL PROTECTED] Subject: [PHP] Using PHP for directory indexing Hi All, I am wondering if anyone can help me with this. I want people accessing my site to see a list of HTML reports but I don't want to turn on Directory indexing on my Apache webserver, seeing as the directory path is present. What I'm looking to do, is to write a basic php script which will read the files in a certain directory & create links to be presented to the user. Has anyone ever done this before? Can someone give me an example or a headstart on this. Thanks in advance Kev _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- 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 PHP for directory indexing
Wow that was a quick response...Thanks alot! That those the listing part of my problem but is there a way of only showing a certain type of file such as only HTML? & is there a way of somehow automatically making a link to access those pages? >From: "Oosten, Sjoerd van" <[EMAIL PROTECTED]> >To: 'Kevin Garrett' <[EMAIL PROTECTED]>, "'[EMAIL PROTECTED]'" ><[EMAIL PROTECTED]> >Subject: RE: [PHP] Using PHP for directory indexing >Date: Mon, 12 Nov 2001 14:15:14 +0100 > > // print the current directory in unordered list > print("\n"); > > // open directory > $myDirectory = dir("."); > > // get each entry > while($entryName = $myDirectory->read()) > { > print("$entryName \n"); > } > > // close directory > $myDirectory->close(); > > print("\n"); >?> > > >Sjoerd van Oosten >Digitaal vormgever [EMAIL PROTECTED] >Datamex E-sites B.V. >http://www.esites.nl >Minervum 7368 Telefoon: (076) 5 730 730 >4817 ZH BREDA Telefax: (076) 5 877 757 >___________ > > >-Oorspronkelijk bericht- >Van: Kevin Garrett [mailto:[EMAIL PROTECTED]] >Verzonden: maandag 12 november 2001 14:08 >Aan: [EMAIL PROTECTED] >Onderwerp: [PHP] Using PHP for directory indexing > > >Hi All, > > I am wondering if anyone can help me with this. I want people >accessing my >site to see a list of HTML reports but I don't want to turn on Directory >indexing on my Apache webserver, seeing as the directory path is present. >What I'm looking to do, is to write a basic php script which will read the >files in a certain directory & create links to be presented to the user. >Has anyone ever done this before? Can someone give me an example or a >headstart on this. > >Thanks in advance >Kev > >_ >Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > > >-- >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] _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp -- 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: Using PHP for directory indexing
Hi! Kevin! Try this... :-) have a nica day! «'.START_PATH.$catalog.'»'; print $str; echo ''; echo ''; echo 'Record type Path'; for ($i = 0; $i < count($filenames); $i++) { if ($filenames[$i]!='.' && $filenames[$i]!='..') { if (is_dir(START_PATH.$catalog.'/'.$filenames[$i])) { print 'Directory'; print ''.$filenames[$i].''; } else { print 'File'; print ''.$filenames[$ i].''; } 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] Re: Using PHP for directory indexing
line print ''.$filenames[$ i].''; change on print ''.$filenames[$i].'' ; -- 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]