php-general Digest 17 Feb 2001 10:01:18 -0000 Issue 517 Topics (messages 40229 through 40311): Re: Delete from cart 40229 by: Chris Lee 40250 by: Gary 40262 by: Chris Lee 40265 by: Gary Re: PHP and cookies and/or headers 40230 by: Angela using tar to untar a file into a certain dir... In php of course 40231 by: Brandon Orther 40236 by: DanO 40239 by: Brandon Orther 40244 by: DanO 40246 by: Javier Muniz 40264 by: Brandon Orther 40268 by: Brian Drexler 40291 by: lwh.mysqldeveloper.com Re: SMTP 40232 by: php3.developersdesk.com Re: shopping cart classes 40233 by: Chris Lee 40234 by: Joe Stump 40260 by: Thor M. Steindorsson Re: New Mod-gzip 40235 by: Michael Kimsal 40240 by: David VanHorn Re: Specific PHP/JSP questions 40237 by: php3.developersdesk.com 40238 by: DanO Re: PHP Book Recommendations 40241 by: John Monfort 40249 by: ..s.c.o.t.t.. [gts] 40276 by: Philip Olson Re: the best so far 40242 by: php3.developersdesk.com 40311 by: php3.developersdesk.com multiple select 40243 by: Pablo Martin De Natale 40245 by: Toby Butzon CORBA? 40247 by: Jonathan Sharp 40256 by: Gerald Gutierrez 40259 by: DanO 40261 by: Jonathan Sharp Finding the? in $REQUEST_URI?page=blah 40248 by: James, Yz 40252 by: Javier Muniz 40258 by: ..s.c.o.t.t.. [gts] 40273 by: John Monfort 40296 by: ..s.c.o.t.t.. Re: splitting up contents of a test box 40251 by: James, Yz Re: ereg problem 40253 by: Jeff Warrington PHP-as-servlet can't ldopen php_java 40254 by: Clark Freifeld Re: deleting cart items on session expire 40255 by: Lic. Rodolfo Gonzalez Gonzalez save some typing 40257 by: Christopher Allen 40272 by: Mark Maggelet input type=file 40263 by: Jerry Lake 40266 by: Joe Sheble (Wizaerd) 40269 by: Jerry Lake 40270 by: Jerry Lake 40271 by: Joe Sheble (Wizaerd) Newbie: Fundamental question. Long. 40267 by: james MySQL: Add Autoincrement Field? 40274 by: Jeff Oien 40284 by: Chad Guilette 40292 by: Jeff Oien 40293 by: Brian Drexler Re: PHP Editors 40275 by: Alexander Wagner [S.O.S.] round() problem 40277 by: SED Quick hellp, How do I stip new lines? 40278 by: Brandon Orther 40279 by: Kath 40280 by: Brian Clark 40281 by: Toby Butzon 40282 by: Toby Butzon Dir? Can I get a dir listing of the current dir my php file is in? 40283 by: Brandon Orther Can PHP execute a refresh to a new page? 40285 by: Kenneth R Zink II 40286 by: Brian Drexler 40288 by: Chris Lee 40289 by: ..s.c.o.t.t.. Re: Code Optimizer 40287 by: Michael Stearne Can I select only the newest record? 40290 by: Brian Drexler 40297 by: ..s.c.o.t.t.. about PHPLib 40294 by: JW Database Code Portability 40295 by: Dave Haggerty 40298 by: Michael Stearne 40301 by: Dallas Kropka 40304 by: PHPBeginner.com search 40299 by: Brandon Feldhahn 40308 by: ..s.c.o.t.t.. Installer 40300 by: B Satish , Gurgaon location 40302 by: Brandon Feldhahn 40305 by: jaskirat 40307 by: ..s.c.o.t.t.. more on trimming 40303 by: jaskirat 40306 by: ..s.c.o.t.t.. 40309 by: Simon Robson 40310 by: CC Zona Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
are you using a spec cart system? or did you write your own? its hard to give an accurate answer without knowing. Ive wrote my own simple cart, using sessions, to delete an item I just unset the variable. unset($stockno['1234']); where $stockno is an session array variable. its very spec on what software your using. -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 "Gary" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi All, > It is Friday afternoon here and I don't want to have to reinvent the > wheel. What would be the easiest way to delete an item from a shopping > cart? I know what is required for Mysql but I am stumped on how to > implement it. > > TIA > Gary > > > -- > 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] >
Chris Lee wrote: > are you using a spec cart system? or did you write your own? its hard to > give an accurate answer without knowing. Ive wrote my own simple cart, using > sessions, to delete an item I just unset the variable. > > unset($stockno['1234']); > > where $stockno is an session array variable. its very spec on what software > your using. > > > -- > > > Chris Lee > Mediawaveonline.com > > em. [EMAIL PROTECTED] > > ph. 250.377.1095 > ph. 250.376.2690 > fx. 250.554.1120 > > > > > "Gary" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> Hi All, >> It is Friday afternoon here and I don't want to have to reinvent the >> wheel. What would be the easiest way to delete an item from a shopping >> cart? I know what is required for Mysql but I am stumped on how to >> implement it. >> >> TIA >> Gary >> >> >> -- >> 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] >> I am writing my own system. It is using cookies to give a temp id number. When you choose something from the menu it uses the stock number to generate a description and cart page. I was thinking about using the stock number with a db query to delete the row. I am not sure about the best way to accomplish this. Gary
here is a very simple cart in sessions. you have stockno and quan, it can be easily modified to handle various other variables. <?php class cart { function add($product_id, $product_quan = 1) { if ($product_quan < 1) $product_quan = 1; $this->cart_product_id[$product_id] = $product_id; $this->cart_product_quan[$product_id] = $product_quan; } function add_single($var_name) { if ( !isset($GLOBALS[$var_name]) ) return ; $this->add($GLOBALS[$var_name], 1); } function add_multiple($var_name) { if ( !isset($GLOBALS[$var_name]) ) return ; foreach($GLOBALS[$var_name] as $pos => $val) $this->add($pos, $quan); } function delete($product_id) { unset($this->cart_product_id[$product_id]); unset($this->cart_product_quan[$product_id]); if ( !count($this->cart_product_id) ) { unset($this->cart_product_id); unset($this->cart_product_quan); } } function delete_multiple($var_name) { if ( !isset($GLOBALS[$var_name]) ) return ; foreach($GLOBALS[$var_name] as $pos => $val) $this->delete($pos); } function update($product_id, $product_quan) { if ($product_quan < 1) $product_quan = 1; $this->cart_product_id[$product_id] = $product_id; $this->cart_product_quan[$product_id] = $product_quan; } function update_multiple($var_name) { if ( !isset($GLOBALS[$var_name]) ) return ; foreach ($GLOBALS[$var_name] as $pos => $val) $this->update($pos, $val); } } $cart = new cart; if (!isset($HTTP_SESSION_VARS['cart'])) { $cart = new cart(); session_register('cart'); } ?> -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 "Gary" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Chris Lee wrote: > > > are you using a spec cart system? or did you write your own? its hard to > > give an accurate answer without knowing. Ive wrote my own simple cart, using > > sessions, to delete an item I just unset the variable. > > > > unset($stockno['1234']); > > > > where $stockno is an session array variable. its very spec on what software > > your using. > > > > > > -- > > > > > > Chris Lee > > Mediawaveonline.com > > > > em. [EMAIL PROTECTED] > > > > ph. 250.377.1095 > > ph. 250.376.2690 > > fx. 250.554.1120 > > > > > > > > > > "Gary" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > >> Hi All, > >> It is Friday afternoon here and I don't want to have to reinvent the > >> wheel. What would be the easiest way to delete an item from a shopping > >> cart? I know what is required for Mysql but I am stumped on how to > >> implement it. > >> > >> TIA > >> Gary > >> > >> > >> -- > >> 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] > >> > > I am writing my own system. It is using cookies to give a temp id > number. When you choose something from the menu it uses the stock number > to generate a description and cart page. I was thinking about using the > stock number with a db query to delete the row. I am not sure about the > best way to accomplish this. > > Gary > > > -- > 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] >
Thanks Chris, It is a little late in the design to use your class, but it has given me an idea on how to delete from my code. Thanks Gary Chris Lee wrote: > here is a very simple cart in sessions. you have stockno and quan, it can be > easily modified to handle various other variables. > > <?php > > class cart > { > > function add($product_id, $product_quan = 1) > { > if ($product_quan < 1) > $product_quan = 1; > > $this->cart_product_id[$product_id] = $product_id; > $this->cart_product_quan[$product_id] = $product_quan; > } > > function add_single($var_name) > { > if ( !isset($GLOBALS[$var_name]) ) > return ; > > $this->add($GLOBALS[$var_name], 1); > } > > function add_multiple($var_name) > { > if ( !isset($GLOBALS[$var_name]) ) > return ; > > foreach($GLOBALS[$var_name] as $pos => $val) > $this->add($pos, $quan); > } > > function delete($product_id) > { > unset($this->cart_product_id[$product_id]); > unset($this->cart_product_quan[$product_id]); > > if ( !count($this->cart_product_id) ) > { > unset($this->cart_product_id); > unset($this->cart_product_quan); > } > } > > function delete_multiple($var_name) > { > if ( !isset($GLOBALS[$var_name]) ) > return ; > > foreach($GLOBALS[$var_name] as $pos => $val) > $this->delete($pos); > } > > function update($product_id, $product_quan) > { > if ($product_quan < 1) > $product_quan = 1; > > $this->cart_product_id[$product_id] = $product_id; > $this->cart_product_quan[$product_id] = $product_quan; > } > > function update_multiple($var_name) > { > if ( !isset($GLOBALS[$var_name]) ) > return ; > > foreach ($GLOBALS[$var_name] as $pos => $val) > $this->update($pos, $val); > } > } > > $cart = new cart; > > if (!isset($HTTP_SESSION_VARS['cart'])) > { > $cart = new cart(); > session_register('cart'); > } > ?> > > > -- > > > Chris Lee > Mediawaveonline.com > > em. [EMAIL PROTECTED] > > ph. 250.377.1095 > ph. 250.376.2690 > fx. 250.554.1120 > > > "Gary" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> Chris Lee wrote: >> >> >>> are you using a spec cart system? or did you write your own? its hard to >>> give an accurate answer without knowing. Ive wrote my own simple cart, >> > using > >>> sessions, to delete an item I just unset the variable. >>> >>> unset($stockno['1234']); >>> >>> where $stockno is an session array variable. its very spec on what >> > software > >>> your using. >>> >>> >>> -- >>> >>> >>> Chris Lee >>> Mediawaveonline.com >>> >>> em. [EMAIL PROTECTED] >>> >>> ph. 250.377.1095 >>> ph. 250.376.2690 >>> fx. 250.554.1120 >>> >>> >>> >>> >>> "Gary" <[EMAIL PROTECTED]> wrote in message >>> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >>> >>> >>>> Hi All, >>>> It is Friday afternoon here and I don't want to have to reinvent the >>>> wheel. What would be the easiest way to delete an item from a shopping >>>> cart? I know what is required for Mysql but I am stumped on how to >>>> implement it. >>>> >>>> TIA >>>> Gary >>>> >>>> >>>> -- >>>> 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] > >> I am writing my own system. It is using cookies to give a temp id >> number. When you choose something from the menu it uses the stock number >> to generate a description and cart page. I was thinking about using the >> stock number with a db query to delete the row. I am not sure about the >> best way to accomplish this. >> >> Gary >> >> >> -- >> 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] >>
When they click on the tab to change languages, you could have that go back to a page on the main site, reset the cookie, and then send it on to the site you want it to go to. -Angela Jeremy Gillies wrote: > > angela, > > this would work if people did not switch back and forth between langauges. > We have many bilingual users who want print copies, for example, in french > and english. Each time they click a little tab at the top, it will switch > languages and sites too, BUT will remain with the corresponding text in the > other language. > > thank you for your help so far, > jeremy > > > -----Original Message----- > > From: Angela [mailto:[EMAIL PROTECTED]] > > Sent: Friday, February 16, 2001 8:57 AM > > To: Jeremy Gillies; [EMAIL PROTECTED] > > Subject: Re: PHP and cookies and/or headers > > > > > > On your splash page, instead of having it send the user > > directly to either the english or > > french site, first have it send to another page on that > > domain along with a variable to > > tell it whether it's english or french. For example, the > > English button would be linked > > to "setcookie.php?Language=English" and the French button > > would be linked to > > "setcookie.php?Language=Francais". On the setcookie.php > > page, use an if statement to > > determine which language they chose, then inside of it set > > the cookie then redirect them > > to the language site of their choice. For example: > > > > <? > > if($Language=="English"){ > > setcookie("Language", "$Language"); > > header("location: http://www.english.com"); > > }else{ > > setcookie("Language", "$Language"); > > header("location: http://www.francais.com"); > > } > > ?> > > > > Then on your home page, you would have it check for these cookies: > > > > <? > > if($Language=="English"){ > > header("location: http://www.english.com"); > > }elseif($Language=="Francais"){ > > header("location: http://www.francais.com"); > > }else{ > > show_the_choice_page(); > > } > > ?> > > > > I think this would be the best solution. Let me know if > > anybody comes up with anything > > better. > > -Angela > > > > -- > > Angela Curtis > > Internet Programmer > > Innovative Business Consultants > > http://www.ibc2001.com > > -- Angela Curtis Internet Programmer Innovative Business Consultants http://www.ibc2001.com
Hello, I am making a php file that untars files. What I can't seem to figure out is how to untar a file into another folder. I have tried: tar -xpf file.tar /new/folder/* & and & tar -xpf file.tar /new/folder/ does anyone know how to do this? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
have you tried: mv mytar.tar /my/path/to/dir/; tar -xpf /my/path/to/dir/mytar.tar this should work, but there may be a more direct unix-y way to do it. DanO -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:49 PM To: PHP User Group Subject: [PHP] using tar to untar a file into a certain dir... In php of course Hello, I am making a php file that untars files. What I can't seem to figure out is how to untar a file into another folder. I have tried: tar -xpf file.tar /new/folder/* & and & tar -xpf file.tar /new/folder/ does anyone know how to do this? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.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]
From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:07 PM To: DanO Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course That just untars it into the current dir the php script is in. -----Original Message----- From: DanO [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:58 PM To: PHP User Group Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course have you tried: mv mytar.tar /my/path/to/dir/; tar -xpf /my/path/to/dir/mytar.tar this should work, but there may be a more direct unix-y way to do it. DanO -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:49 PM To: PHP User Group Subject: [PHP] using tar to untar a file into a certain dir... In php of course Hello, I am making a php file that untars files. What I can't seem to figure out is how to untar a file into another folder. I have tried: tar -xpf file.tar /new/folder/* & and & tar -xpf file.tar /new/folder/ does anyone know how to do this? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
good point. i should think before i post. here is another go: <? chdir("destination"); system("tar -xpf /some/path/to/mytar.tar"); ?> i can't test this as i am on a windows box at the moment, but i think you can get the gist of it. change the working directory of php and then extract from another file. DanO -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:16 PM To: PHP User Group Subject: FW: [PHP] using tar to untar a file into a certain dir... In php of course From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:07 PM To: DanO Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course That just untars it into the current dir the php script is in. -----Original Message----- From: DanO [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:58 PM To: PHP User Group Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course have you tried: mv mytar.tar /my/path/to/dir/; tar -xpf /my/path/to/dir/mytar.tar this should work, but there may be a more direct unix-y way to do it. DanO -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:49 PM To: PHP User Group Subject: [PHP] using tar to untar a file into a certain dir... In php of course Hello, I am making a php file that untars files. What I can't seem to figure out is how to untar a file into another folder. I have tried: tar -xpf file.tar /new/folder/* & and & tar -xpf file.tar /new/folder/ does anyone know how to do this? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- 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]
Don't calls to system() live within their own shell and environment? If so you may need to: system("cd /destination/dir && tar -xpf /some/path/to/tarfile.tar"); this will also insure that if the cd fails for some reason, tar will not execute. -jm -----Original Message----- From: DanO [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:34 PM To: Brandon Orther; PHP User Group Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course good point. i should think before i post. here is another go: <? chdir("destination"); system("tar -xpf /some/path/to/mytar.tar"); ?> i can't test this as i am on a windows box at the moment, but i think you can get the gist of it. change the working directory of php and then extract from another file. DanO -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:16 PM To: PHP User Group Subject: FW: [PHP] using tar to untar a file into a certain dir... In php of course From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:07 PM To: DanO Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course That just untars it into the current dir the php script is in. -----Original Message----- From: DanO [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:58 PM To: PHP User Group Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course have you tried: mv mytar.tar /my/path/to/dir/; tar -xpf /my/path/to/dir/mytar.tar this should work, but there may be a more direct unix-y way to do it. DanO -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:49 PM To: PHP User Group Subject: [PHP] using tar to untar a file into a certain dir... In php of course Hello, I am making a php file that untars files. What I can't seem to figure out is how to untar a file into another folder. I have tried: tar -xpf file.tar /new/folder/* & and & tar -xpf file.tar /new/folder/ does anyone know how to do this? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- 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]
Hello, I can't seem to get cd to work while using system???? I even use the whole root path. Anyone got any ideas? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -------------------------------------------- -----Original Message----- From: Javier Muniz [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:48 PM To: 'DanO'; Brandon Orther; PHP User Group Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course Don't calls to system() live within their own shell and environment? If so you may need to: system("cd /destination/dir && tar -xpf /some/path/to/tarfile.tar"); this will also insure that if the cd fails for some reason, tar will not execute. -jm -----Original Message----- From: DanO [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:34 PM To: Brandon Orther; PHP User Group Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course good point. i should think before i post. here is another go: <? chdir("destination"); system("tar -xpf /some/path/to/mytar.tar"); ?> i can't test this as i am on a windows box at the moment, but i think you can get the gist of it. change the working directory of php and then extract from another file. DanO -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:16 PM To: PHP User Group Subject: FW: [PHP] using tar to untar a file into a certain dir... In php of course From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:07 PM To: DanO Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course That just untars it into the current dir the php script is in. -----Original Message----- From: DanO [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:58 PM To: PHP User Group Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course have you tried: mv mytar.tar /my/path/to/dir/; tar -xpf /my/path/to/dir/mytar.tar this should work, but there may be a more direct unix-y way to do it. DanO -----Original Message----- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:49 PM To: PHP User Group Subject: [PHP] using tar to untar a file into a certain dir... In php of course Hello, I am making a php file that untars files. What I can't seem to figure out is how to untar a file into another folder. I have tried: tar -xpf file.tar /new/folder/* & and & tar -xpf file.tar /new/folder/ does anyone know how to do this? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- 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]
Try just specifying the path.... system("tar -xvf /home/httpd/html/file.tar /home/httpd/html/filedirectory/."); Let me know if this helps. Brian Drexler ----- Original Message ----- From: Brandon Orther <[EMAIL PROTECTED]> To: PHP User Group <[EMAIL PROTECTED]> Sent: Friday, February 16, 2001 7:10 PM Subject: RE: [PHP] using tar to untar a file into a certain dir... In php of course > Hello, > > I can't seem to get cd to work while using system???? I even use the whole > root path. > > Anyone got any ideas? > > Thank you, > > -------------------------------------------- > Brandon Orther > WebIntellects Design/Development Manager > [EMAIL PROTECTED] > 800-994-6364 > www.webintellects.com > -------------------------------------------- > > -----Original Message----- > From: Javier Muniz [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 2:48 PM > To: 'DanO'; Brandon Orther; PHP User Group > Subject: RE: [PHP] using tar to untar a file into a certain dir... In > php of course > > > Don't calls to system() live within their own shell and environment? If so > you may need to: > > system("cd /destination/dir && tar -xpf /some/path/to/tarfile.tar"); > > this will also insure that if the cd fails for some reason, tar will not > execute. > > -jm > > -----Original Message----- > From: DanO [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 2:34 PM > To: Brandon Orther; PHP User Group > Subject: RE: [PHP] using tar to untar a file into a certain dir... In > php of course > > > > good point. i should think before i post. > > here is another go: > > <? > chdir("destination"); > system("tar -xpf /some/path/to/mytar.tar"); > ?> > > i can't test this as i am on a windows box at the moment, but i think you > can get the gist of it. > > change the working directory of php and then extract from another file. > > DanO > > > > -----Original Message----- > From: Brandon Orther [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 2:16 PM > To: PHP User Group > Subject: FW: [PHP] using tar to untar a file into a certain dir... In > php of course > > > From: Brandon Orther [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 2:07 PM > To: DanO > Subject: RE: [PHP] using tar to untar a file into a certain dir... In > php of course > > > That just untars it into the current dir the php script is in. > > -----Original Message----- > From: DanO [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 1:58 PM > To: PHP User Group > Subject: RE: [PHP] using tar to untar a file into a certain dir... In > php of course > > > > have you tried: > > mv mytar.tar /my/path/to/dir/; tar -xpf /my/path/to/dir/mytar.tar > > this should work, but there may be a more direct unix-y way to do it. > > DanO > > > -----Original Message----- > From: Brandon Orther [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 1:49 PM > To: PHP User Group > Subject: [PHP] using tar to untar a file into a certain dir... In php of > course > > > Hello, > > I am making a php file that untars files. What I can't seem to figure out > is how to untar a file into another folder. I have tried: > > tar -xpf file.tar /new/folder/* > > & and & > > tar -xpf file.tar /new/folder/ > > > does anyone know how to do this? > > Thank you, > > -------------------------------------------- > Brandon Orther > WebIntellects Design/Development Manager > [EMAIL PROTECTED] > 800-994-6364 > www.webintellects.com > -------------------------------------------- > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- > 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]
tar on all my systems (got this from 'man tar') tar xf file.tar -C /dest/dir
Addressed to: "Richard Lynch" <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from "Richard Lynch" <[EMAIL PROTECTED]> Thu, 15 Feb 2001 19:25:14 -0600 > > I think you *can* use the "for win32 only" stuff on Linux if you want to > send your mail to a different server... I don't think so... I just tried to add: php_value SMTP 'mail.mydomain.com' php_value sendmail_from '[EMAIL PROTECTED]' php_value sendmail_path ' ' into my Apache configuration, and PHP is still sending mail thru the local sendmail rather than qmail on my main server. I wish it would work as it would take care of a problem I am having. It looks like I may have to dig out the Sendmail book, and do some work on it to take control of bounce messages when PHP's mail() function tries to send to an invalid address. Also, if I use: php_value sendmail_path '' Apache will not run. I get an error that php_value must have two parameters. I am not complaining, it is just something I noticed while testing. FYI, I would like to see this work on UNIX, so I have submitted a feature request to have it added: http://bugs.php.net/?id=9308 Anybody else think this would be good to have? Rick Widmer Internet Marketing Specialists http://www.developersdesk.com
I found the same as you, I wrote some classes of my own. have you done much with postgres ? Ive used mySQL alot here and am not happy with the stability, postgres (beta) seems to be faster but havent used it in products so cant comment on stability. Im curious. -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 "Randall Perry" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I've checked out the shopping cart packages available for PHP and am not > thrilled by any of them. Was wondering if there are a set of classes > available that could be used to support a shopping cart. I'm interested in > the 'back end' -- working with the actual data, rather than the front end -- > the user interface. Want to build it with php + mySQL or PostgreSQL. > > I want complete freedom to build the interface but don't want to reinvent > the wheel for credit card validation, online credit card processing, > shipping calculation, etc. > > > I've built a simple shopping cart for a site currently under construction. > This uses a combination of javascript and php, and doesn't use database > (less than 1 dozen items). > > You can see an example (excuse the mess) by going to: > > http://www.bhagavati.com/trial/mainframe.htm > > and clicking the 'order' link in the navbar frame at the top. HINT: close > movie window as soon as it opens. > > > > Randy Perry > sysTame > > Mac Consulting/Sales > > > -- > 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] >
Odd - we serve millions of pages a day off of MySQL - solid as a rock. Hhmmmmm wonder if that Quad SPARC has anything to do with it... --Joe On Fri, Feb 16, 2001 at 01:50:59PM -0800, Chris Lee wrote: > I found the same as you, I wrote some classes of my own. have you done much > with postgres ? Ive used mySQL alot here and am not happy with the > stability, postgres (beta) seems to be faster but havent used it in products > so cant comment on stability. Im curious. > > > -- > > > Chris Lee > Mediawaveonline.com > > em. [EMAIL PROTECTED] > > ph. 250.377.1095 > ph. 250.376.2690 > fx. 250.554.1120 > > > > > "Randall Perry" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I've checked out the shopping cart packages available for PHP and am not > > thrilled by any of them. Was wondering if there are a set of classes > > available that could be used to support a shopping cart. I'm interested in > > the 'back end' -- working with the actual data, rather than the front > end -- > > the user interface. Want to build it with php + mySQL or PostgreSQL. > > > > I want complete freedom to build the interface but don't want to reinvent > > the wheel for credit card validation, online credit card processing, > > shipping calculation, etc. > > > > > > I've built a simple shopping cart for a site currently under construction. > > This uses a combination of javascript and php, and doesn't use database > > (less than 1 dozen items). > > > > You can see an example (excuse the mess) by going to: > > > > http://www.bhagavati.com/trial/mainframe.htm > > > > and clicking the 'order' link in the navbar frame at the top. HINT: close > > movie window as soon as it opens. > > > > > > > > Randy Perry > > sysTame > > > > Mac Consulting/Sales > > > > > > -- > > 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] -- ------------------------------------------------------------------------------- Joe Stump, PHP Hacker, [EMAIL PROTECTED] -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V -------------------------------------------------------------------------------
Seems to be good enough for NASA. :) -----Original Message----- From: Chris Lee [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 1:51 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] shopping cart classes I found the same as you, I wrote some classes of my own. have you done much with postgres ? Ive used mySQL alot here and am not happy with the stability, postgres (beta) seems to be faster but havent used it in products so cant comment on stability. Im curious. -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 "Randall Perry" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I've checked out the shopping cart packages available for PHP and am not > thrilled by any of them. Was wondering if there are a set of classes > available that could be used to support a shopping cart. I'm interested in > the 'back end' -- working with the actual data, rather than the front end -- > the user interface. Want to build it with php + mySQL or PostgreSQL. > > I want complete freedom to build the interface but don't want to reinvent > the wheel for credit card validation, online credit card processing, > shipping calculation, etc. > > > I've built a simple shopping cart for a site currently under construction. > This uses a combination of javascript and php, and doesn't use database > (less than 1 dozen items). > > You can see an example (excuse the mess) by going to: > > http://www.bhagavati.com/trial/mainframe.htm > > and clicking the 'order' link in the navbar frame at the top. HINT: close > movie window as soon as it opens. > > > > Randy Perry > sysTame > > Mac Consulting/Sales > > > -- > 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]
Does it work when you print from Netscape? I don't have a printer hooked up, but that was a problem with some other gzip stuff I used in the past. David VanHorn wrote: > There's a new mod_gzip out that does work with PHP output. > Have a look at www.dvanhorn.org > All the pages are PHP generated, with nothing special in the PHP code. > -- > Dave's Engineering Page: http://www.dvanhorn.org > Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9 > > -- > 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]
At 04:53 PM 2/16/01 -0500, Michael Kimsal wrote: >Does it work when you print from Netscape? I don't have a printer hooked Hmm. Couldn't tell you, I don't have Netscape. The only bug reports so far, all involve a relatively minor config tweak. I've had no problem reports on my page. -- Dave's Engineering Page: http://www.dvanhorn.org Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9
Addressed to: Gerald Gutierrez <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from Gerald Gutierrez <[EMAIL PROTECTED]> Thu, 15 Feb 2001 01:04:30 -0800 > 2) In JSPs, it is possible to do server-side page redirection, i.e. > "forward" a request from page A to page B, as if the user actually > requested page B. There is no browser involvement in the redirection; it is > complete on the server. In this scenario, there are two "page scopes", and > one "request scope". How is this server-side redirection done in PHP? You might do something like: pageA.php ------------------------------------- <? if( user_realy_wants_page_b ) { include( 'pageb.php' ); exit; } ?> Page A starts here... ------------------------------------- That all happens on the server, and does not require anything outside of page A to implement. > 3) In doing the server-side page redirection, variables can be added to a > "request" object, which embodies parameters related to a request. Page A > can add variables to the request object (perhaps values from an SQL > select), which page B can then retrieve and display. How is this done in PHP? In the example above, any variables set in page A will be visible in page B when it is included. The values must be set BEFORE the include() is hit. > 5) On a JSP site, I typically arrange things such that a particular JSP (or > servlet) accepts requests, processes them and then forwards them to one of > a number of different pages, depending on the outcome of the processing. > This is in contrast to the alternative approach where one simply goes to a > page, which does some processing and then displays the contents of the > requested page. What is the typical way to achieving this "funnel all > requests to a single point and have it forward the correct response to the > user" paradigm? <? switch ( $Desired_Action ) { case 'PageA' : include( 'pagea.php' ); break; case 'PageB' : include( 'pageb.php' ); break; case 'PageC' : include( 'pagec.php' ); break; default: include( 'defailt.php' ); break; } would be one possibility. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com
see: http://www.php.net/manual/en/function.header.php it works just like JSP. DanO -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:01 PM To: Gerald Gutierrez; [EMAIL PROTECTED] Subject: Re: [PHP] Specific PHP/JSP questions Addressed to: Gerald Gutierrez <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from Gerald Gutierrez <[EMAIL PROTECTED]> Thu, 15 Feb 2001 01:04:30 -0800 > 2) In JSPs, it is possible to do server-side page redirection, i.e. > "forward" a request from page A to page B, as if the user actually > requested page B. There is no browser involvement in the redirection; it is > complete on the server. In this scenario, there are two "page scopes", and > one "request scope". How is this server-side redirection done in PHP? You might do something like: pageA.php ------------------------------------- <? if( user_realy_wants_page_b ) { include( 'pageb.php' ); exit; } ?> Page A starts here... ------------------------------------- That all happens on the server, and does not require anything outside of page A to implement. > 3) In doing the server-side page redirection, variables can be added to a > "request" object, which embodies parameters related to a request. Page A > can add variables to the request object (perhaps values from an SQL > select), which page B can then retrieve and display. How is this done in PHP? In the example above, any variables set in page A will be visible in page B when it is included. The values must be set BEFORE the include() is hit. > 5) On a JSP site, I typically arrange things such that a particular JSP (or > servlet) accepts requests, processes them and then forwards them to one of > a number of different pages, depending on the outcome of the processing. > This is in contrast to the alternative approach where one simply goes to a > page, which does some processing and then displays the contents of the > requested page. What is the typical way to achieving this "funnel all > requests to a single point and have it forward the correct response to the > user" paradigm? <? switch ( $Desired_Action ) { case 'PageA' : include( 'pagea.php' ); break; case 'PageB' : include( 'pageb.php' ); break; case 'PageC' : include( 'pagec.php' ); break; default: include( 'defailt.php' ); break; } would be one possibility. Rick Widmer Internet Marketing Specialists http://www.developersdesk.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]
Profession PHP Programming ISBN: 1-861002-96-3 __________John Monfort_________________ _+-----------------------------------+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___________________________________+- On Fri, 16 Feb 2001, Brian V Bonini wrote: > Can I get some recommendations on some good PHP > books. Something broad but with good novice > concepts........ > > -- > 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] > >
I agree... The red book "Professional PHP Programming" (WROX "Programmer to Programmer" series) is an exellent PHP book but, if you're looking for novice level stuff, WROX also published a companion called "Beginning PHP4". i was fluent in perl when i picked up the professional one, and had no problems with it... but i wouldnt reccomend it to people with little or no programming experience... the professional book seems to take for granted a grasp of fundamental programming concepts, if you're a true novice, get the "beginning php4" one first (and then professional :) ----- Original Message ----- From: "John Monfort" <[EMAIL PROTECTED]> To: "Brian V Bonini" <[EMAIL PROTECTED]> Cc: "PHP Lists" <[EMAIL PROTECTED]> Sent: Friday, February 16, 2001 5:26 PM Subject: Re: [PHP] PHP Book Recommendations > > > Profession PHP Programming > > ISBN: 1-861002-96-3 > > > __________John Monfort_________________ > _+-----------------------------------+_ > P E P I E D E S I G N S > www.pepiedesigns.com > "The world is waiting, are you ready?" > -+___________________________________+- > > On Fri, 16 Feb 2001, Brian V Bonini wrote: > > > Can I get some recommendations on some good PHP > > books. Something broad but with good novice > > concepts........ > > > > -- > > 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] >
The most useful "second" book is : PHP Developers Cookbook It really is nice. I say "second" because it's geared towards those that understand a bit already but still, it'll even help the complete newbie (easy to read). Excellent tips, short-cuts, examples, etc. Includes uses of various PEAR classes too. Regards, Philip
Addressed to: "Richard Lynch" <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from "Richard Lynch" <[EMAIL PROTECTED]> Thu, 15 Feb 2001 19:54:55 -0600 > Does die() give you a line number? If not, just put it in there. No, die() does not add to your message. Here is how I solved the problem: function Query( $Query ) { global $ShowQueries; $Result = mysql_query( $Query ); if( !$Result ) echo( mysql_error() . " in Query at $__LINE__ in $__FILE__<BR>\n$Query<BR>\n" ); elseif( $ShowQueries ) echo( "$Query<BR>\n" ); return( $Result ); } usage: $Result = Query( "SELECT fielda, fieldb. fieldc, fieldd, fielde " . " fieldf, fieldg, fieldh " . "FROM Table1 " . "LEFT JOIN Table2 USING( common_field ) " . "WHERE condition1 = '$Value1' " . " AND condition2 > '$Value2' " . "ORDER BY SortField " ); Every query I've written goes thru this function. A couple of things about this: The queries jump out at you when you are looking at the source code. When you have an error in a query you get the mysql_error() message and the entire query printed just below it. I've found that quite handy for debugging. Almost every one of my programs has #$ShowQueries='on'; very near the top of the file. If I am not sure just what it is doing to the database, I just un-comment this line and each query string is printed as it is executed. I've used it enough that I just add the line in every program, or use a template that includes it. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com
Addressed to: "Richard Lynch" <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from "Richard Lynch" <[EMAIL PROTECTED]> Fri, 16 Feb 2001 17:21:03 -0600 > > Do you get the line number and filename of the script that *called* the > query function, or is it always the query function itself. > > This is the sticking point for the original poster. I get the line and file of the include file. Also, note that the $'s should not be in there, I just removed them from the latest version of the include file too, as it doesn't help much. The idea of being able to get the line and file name info of where a function was called from has come up on the developers list a couple of times, and I'd love to see it happen, but it was shot down, and I'm pretty sure it won't happen. The only way to do it would be like: function Query( $Query, $Line, $File ) { .. } and call it like: Query( $SomeQuery, __LINE__, __FILE__ ); Rick Widmer Internet Marketing Specialists http://www.developersdesk.com
Hello, I'm trying to make a multiple select... I've this code... <select name="test" size="3" multiple> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> then I select more than one option but when I see the value of $test, I only see the last value that I checked. Somebody can help me? Thanks Pablo
Change the name of your select to "test[]" instead of "test", then access it like an array: foreach($test as $current) { echo "$current was selected<br>\n"; } --toby Pablo Martin De Natale wrote: > > Hello, I'm trying to make a multiple select... > > I've this code... > > <select name="test" size="3" multiple> > <option value="1">1</option> > <option value="2">2</option> > <option value="3">3</option> > </select> > > then I select more than one option but when I see the value of $test, I only see > > the last value that I checked. > > Somebody can help me? > > Thanks > > Pablo > > -- > 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]
I've seen mentions of CORBA before and skimmed a book at the local b&n, but what exactly is it? Is it programming standards? A seperate language all together? (something like COM?) Thanks, -Jonathan Sharp Technology Director Imprev, Inc. http://imprev.com [EMAIL PROTECTED], [EMAIL PROTECTED] EPage: [EMAIL PROTECTED] Office: 425.458.4800 Direct: 425.458.4804 Fax: 425.458.4801 Cell: 425.766.1398
At 02:49 PM 2/16/2001 -0800, Jonathan Sharp wrote: >I've seen mentions of CORBA before and skimmed a book at the local b&n, but >what exactly is it? Is it programming standards? A seperate language all >together? (something like COM?) > >Thanks, >-Jonathan Sharp > >Technology Director >Imprev, Inc. >http://imprev.com CORBA is a distributed object standard. You say you're a technology director?
how is this type of comment on a mailing list productive? DanO -----Original Message----- From: Gerald Gutierrez [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 3:26 PM To: Jonathan Sharp; [EMAIL PROTECTED] Subject: Re: [PHP] CORBA? At 02:49 PM 2/16/2001 -0800, Jonathan Sharp wrote: >I've seen mentions of CORBA before and skimmed a book at the local b&n, but >what exactly is it? Is it programming standards? A seperate language all >together? (something like COM?) > >Thanks, >-Jonathan Sharp > >Technology Director >Imprev, Inc. >http://imprev.com CORBA is a distributed object standard. You say you're a technology director? -- 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]
Well, since Gerald's answer was so informative...check out www.corba.com they list the main concepts and give standards. Cheers, -Jonathan > -----Original Message----- > From: DanO [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 3:47 PM > To: Gerald Gutierrez; Jonathan Sharp; [EMAIL PROTECTED] > Subject: RE: [PHP] CORBA? > > > > how is this type of comment on a mailing list productive? > > DanO > > -----Original Message----- > From: Gerald Gutierrez [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 3:26 PM > To: Jonathan Sharp; [EMAIL PROTECTED] > Subject: Re: [PHP] CORBA? > > > > At 02:49 PM 2/16/2001 -0800, Jonathan Sharp wrote: > >I've seen mentions of CORBA before and skimmed a book at the > local b&n, but > >what exactly is it? Is it programming standards? A seperate language all > >together? (something like COM?) > > > >Thanks, > >-Jonathan Sharp > > > >Technology Director > >Imprev, Inc. > >http://imprev.com > > > CORBA is a distributed object standard. You say you're a technology > director? > > > > > > -- > 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] > > >
I really wouldn't ask this if I wasn't completely exausted, but the last thing I feel like doing just now is reading up on this when someone can probably answer it in a matter of seconds..... OK, I've an error handling page. Basically, I want to split (that might even be one of the functions I'll have to use) this sort of url: error.php?/pages/login.php?username=name into: /pages/login.php I'm using : header("location: error.php?page=$REQUEST_URI"); When echoing the request_uri back on the error page, it omits the error.php? bit, so I get: login.php?username=name The reason I want to do this is so that I can use a re-login form that will submit to the page the user has badly logged into, so if they logged in to main.php, the request_uri would be something like: /pages/main.php?username=name Which I'd want to rebuild on the error page, into a form, like: <form method="post" action=<? echo "$REQUEST_URI"; /* Minus the suffix the page may include */ ?>"> Username: <input type="text" name="username"><r> etc</form> Can anyone help? Thankees :) James.
An exceptionally easy way to do this would be to pass both $PHP_SELF and $REQUEST_URI. Alternatively, you can use explode(): <?php $array = explode('?',$REQUEST_URI); ?> <form method="post" action=<?php echo $array[0] ?>"> Username: <input type="text" name="username"><r> etc</form> -----Original Message----- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 2:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Finding the? in $REQUEST_URI?page=blah I really wouldn't ask this if I wasn't completely exausted, but the last thing I feel like doing just now is reading up on this when someone can probably answer it in a matter of seconds..... OK, I've an error handling page. Basically, I want to split (that might even be one of the functions I'll have to use) this sort of url: error.php?/pages/login.php?username=name into: /pages/login.php I'm using : header("location: error.php?page=$REQUEST_URI"); When echoing the request_uri back on the error page, it omits the error.php? bit, so I get: login.php?username=name The reason I want to do this is so that I can use a re-login form that will submit to the page the user has badly logged into, so if they logged in to main.php, the request_uri would be something like: /pages/main.php?username=name Which I'd want to rebuild on the error page, into a form, like: <form method="post" action=<? echo "$REQUEST_URI"; /* Minus the suffix the page may include */ ?>"> Username: <input type="text" name="username"><r> etc</form> Can anyone help? Thankees :) James. -- 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]
i'd use split, to split the value up into an array: if this is your url $url = "/pages/error.php?/pages/login.php?user=scott"; and use this code: $thing = split('\?', $url); print $thing[0] ." <BR>\n "; print $thing[1] ." <BR>\n "; print $thing[2] ." <BR>\n "; output will be: /pages/error.php /pages/login.php user=scottx ----- Original Message ----- From: "James, Yz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, February 16, 2001 5:57 PM Subject: [PHP] Finding the? in $REQUEST_URI?page=blah > I really wouldn't ask this if I wasn't completely exausted, but the last > thing I feel like doing just now is reading up on this when someone can > probably answer it in a matter of seconds..... > > OK, I've an error handling page. Basically, I want to split (that might > even be one of the functions I'll have to use) this sort of url: > > error.php?/pages/login.php?username=name > > into: > > /pages/login.php > > I'm using : > > header("location: error.php?page=$REQUEST_URI"); > > When echoing the request_uri back on the error page, it omits the error.php? > bit, so I get: > > login.php?username=name > > The reason I want to do this is so that I can use a re-login form that will > submit to the page the user has badly logged into, so if they logged in to > main.php, the request_uri would be something like: > > /pages/main.php?username=name > > Which I'd want to rebuild on the error page, into a form, like: > > <form method="post" action=<? echo "$REQUEST_URI"; /* Minus the suffix the > page may include */ ?>"> > Username: <input type="text" name="username"><r> > etc</form> > > Can anyone help? > > Thankees :) > > James. > > > > > -- > 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] >
Is the PHP split command the same as that in Perl? ex. ($var_1, $var_2) = split(/:/,$string, 2); will something like that work? On Fri, 16 Feb 2001, ..s.c.o.t.t.. [gts] wrote: > i'd use split, to split the value up into an array: > > if this is your url > $url = "/pages/error.php?/pages/login.php?user=scott"; > > and use this code: > $thing = split('\?', $url); > print $thing[0] ." <BR>\n "; > print $thing[1] ." <BR>\n "; > print $thing[2] ." <BR>\n "; > > output will be: > /pages/error.php > /pages/login.php > user=scottx > > > > ----- Original Message ----- > From: "James, Yz" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, February 16, 2001 5:57 PM > Subject: [PHP] Finding the? in $REQUEST_URI?page=blah > > > > I really wouldn't ask this if I wasn't completely exausted, but the last > > thing I feel like doing just now is reading up on this when someone can > > probably answer it in a matter of seconds..... > > > > OK, I've an error handling page. Basically, I want to split (that might > > even be one of the functions I'll have to use) this sort of url: > > > > error.php?/pages/login.php?username=name > > > > into: > > > > /pages/login.php > > > > I'm using : > > > > header("location: error.php?page=$REQUEST_URI"); > > > > When echoing the request_uri back on the error page, it omits the error.php? > > bit, so I get: > > > > login.php?username=name > > > > The reason I want to do this is so that I can use a re-login form that will > > submit to the page the user has badly logged into, so if they logged in to > > main.php, the request_uri would be something like: > > > > /pages/main.php?username=name > > > > Which I'd want to rebuild on the error page, into a form, like: > > > > <form method="post" action=<? echo "$REQUEST_URI"; /* Minus the suffix the > > page may include */ ?>"> > > Username: <input type="text" name="username"><r> > > etc</form> > > > > Can anyone help? > > > > Thankees :) > > > > James. > > > > > > > > > > -- > > 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] > >
with slight modifications, yes... that will work. 1) PHP doesnt support built-in regexp's (which is a constant sore in the side of any perl programmer) so you'll have to ditch the /:/ for ':' 2) you have to declare lists as list(), unlike the assumed behaviour in perl when it sees () = ... this is how you'd do it in PHP $str = 'C:programs:this:that.exe'; list($one, $two) = split(':', $str); print $one ."<BR>\n"; print $two ."<BR>\n"; not very different, but different enough to be annoying :) > -----Original Message----- > From: John Monfort [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 16:57 > To: ..s.c.o.t.t.. [gts] > Cc: php-general > Subject: Re: [PHP] Finding the? in $REQUEST_URI?page=blah > > > > > Is the PHP split command the same as that in Perl? > > ex. > > ($var_1, $var_2) = split(/:/,$string, 2); > > will something like that work? > > > > > > On Fri, 16 Feb 2001, ..s.c.o.t.t.. [gts] wrote: > > > i'd use split, to split the value up into an array: > > > > if this is your url > > $url = "/pages/error.php?/pages/login.php?user=scott"; > > > > and use this code: > > $thing = split('\?', $url); > > print $thing[0] ." <BR>\n "; > > print $thing[1] ." <BR>\n "; > > print $thing[2] ." <BR>\n "; > > > > output will be: > > /pages/error.php > > /pages/login.php > > user=scottx > > > > > > > > ----- Original Message ----- > > From: "James, Yz" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Friday, February 16, 2001 5:57 PM > > Subject: [PHP] Finding the? in $REQUEST_URI?page=blah > > > > > > > I really wouldn't ask this if I wasn't completely exausted, but the last > > > thing I feel like doing just now is reading up on this when someone can > > > probably answer it in a matter of seconds..... > > > > > > OK, I've an error handling page. Basically, I want to split (that might > > > even be one of the functions I'll have to use) this sort of url: > > > > > > error.php?/pages/login.php?username=name > > > > > > into: > > > > > > /pages/login.php > > > > > > I'm using : > > > > > > header("location: error.php?page=$REQUEST_URI"); > > > > > > When echoing the request_uri back on the error page, it omits the error.php? > > > bit, so I get: > > > > > > login.php?username=name > > > > > > The reason I want to do this is so that I can use a re-login form that will > > > submit to the page the user has badly logged into, so if they logged in to > > > main.php, the request_uri would be something like: > > > > > > /pages/main.php?username=name > > > > > > Which I'd want to rebuild on the error page, into a form, like: > > > > > > <form method="post" action=<? echo "$REQUEST_URI"; /* Minus the suffix the > > > page may include */ ?>"> > > > Username: <input type="text" name="username"><r> > > > etc</form> > > > > > > Can anyone help? > > > > > > Thankees :) > > > > > > James. > > > > > > > > > > > > > > > -- > > > 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] >
If each of the scrolling lines is separated by something regular, like a carriage return, or a line break, tab (etc), you could use explode(); and have the values returned as an array. James. > I have a form that contains a scrolling text box. When I display the > contents of the text box, say in variable $form[mytextbox], it displays > all on one line (or wraps at end of line). As the ending character of > each line will vary, does anyone know of away to split the lines up so > that I can display the text box contents line by line? > > 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] >
In article <[EMAIL PROTECTED]>, "Janet Valade" <[EMAIL PROTECTED]> wrote: if you include a hyphen in a character class, it must be the last entry in the range, otherwise it is interepreted as the range separator. [0-9+.\()-] is what you want (probably have to escape some of the chars above). Jeff > I am using the following statement to check phone numbers. > > if (!ereg("^[0-9\-\+\.\ \)\(]{10,}$",$value)) { > > Can anyone tell me why this works for every character except the -. It > doesn't see the hyphen as a valid part of the phone number, even though > it recognizes the other characters, e.g. + or . > > Janet > >
Dear PHP experts, I am trying to install PHP as a servlet. I have Apache+Tomcat (Apache v1.3.17, PHP 4.0.4pl1, Tomcat 3.2.1) running with mod_jk fine as far as I can tell: I have no problem executing ordinary servlets and jsp. I have merged the web.xml file into examples/web.xml and made a php subdirectory. The problem is, when I try to execute PHP, I get the following error: java.lang.UnsatisfiedLinkError: no php_java (libphp_java.so) in java.library.path [Stack dump here] Upon reload of the page, I get java.lang.UnsatisfiedLinkError: send which I assume is just a byproduct of the larger problem, namely: >From what I understand, what this means is that it's finding net.php.servlet fine, and then from there, it's trying to ldopen libphp_java.so, but it can't find it in the java.library.path. So, I set the LD_LIBRARY_PATH environment variable to the directory containing libphp_java.so, namely /usr/local/lib/php/extensions/no-debug-zts-20001214/ Having done that, when I restart Tomcat, the following happens: java.lang.UnsatisfiedLinkError: /usr/local/lib/php/extensions/no-debug-zts-20001214/libphp_java.so: /usr/local/lib/php/extensions/no-debug-zts-20001214/libphp_java.so: undefined symbol: _zval_ptr_dtor Can anyone help? Basically we have just been fiddling with httpd.conf, tomcat.conf, tomcat.properties, php.ini (I don't think it ever gets that far, but worth a shot), ld.so.conf, trying to get it to do something. I didn't see a java.library.path directive in tomcat.properties. Should there be one there? Or am I totally on the wrong track? If anyone out there can help, such as Sam Ruby for instance ;), I would be MOST appreciative. Me and the sysadmin have been banging our heads against this for days, and I need to show my boss that this really can work, or else he's going to make me give up. Please CC me on the response, since I am not yet subscribed to this list, since I don't think I can handle the traffic. Thanks very much. Clark
On Fri, 16 Feb 2001, Jason Brooke wrote: > > However, there's no necessity to have the cgi version if you already have > > the modular version. All that is needed is to call the appropriate script > No there's not - I think that goes without saying though. > install' - then you can use this awesome tool from the command line without > having to invoke a http request to your webserver usng a third-party tool. And add to this that then you can place the script you want to run out of the web tree, just in case you run something sensitive :) My 2 cents.
Hola: http://www.google.com/intl/en_extra/options/winnetscape.html Its kinda helpful: I modified the above to utilize the www.php.net/some_function Heres the trivial js code: javascript:q=document.getSelection();for(i=0;i<frames.length;i++){q=frames[i ].document.getSelection();if(q)break;}if(!q)void(q=prompt('Enter function to look for at www.php.net.',''));if(q)location.href='http://www.php.net/'+escape(q) Christopher C. M. Allen
On Fri, 16 Feb 2001 17:31:46 -0600, Christopher Allen ([EMAIL PROTECTED]) wrote: >Hola: >http://www.google.com/intl/en_extra/options/winnetscape.html > >Its kinda helpful: I modified the above to utilize the >www.php.net/some_function > >Heres the trivial js code: >javascript:q=document.getSelection();for(i=0;i<frames.length;i++){q=f >rames[i >].document.getSelection();if(q)break;}if(!q)void(q=prompt('Enter >function to >look for at >www.php.net.',''));if(q)location.href='http://www.php.net/'+escape(q) That's cool from your browser, but it's even better from your editor. For EditPlus I do this: Menu Text: IE Command: "D:\Program Files\Internet Explorer\IEXPLORE.EXE" Argument: http://www.php.net/$(CurSel)
this doesn't relate directly to PHP, but it will when I am done. How can I create a file input that reads from a directory on the server instead of the users machine Jerry Lake - [EMAIL PROTECTED] Web Designer Europa Communications - http://www.europa.com Pacifier Online - http://www.pacifier.com
to put it simply, you can't... but you could put an input type of text with a link or a button next to it manually, and then on the onClick of either this button or link open a secondary window running a PHP script that reads a particular directory structure with full navigation support. Then when the user clicks a filename, place that into the input in the first window and close the secondary window. However, this would require JavaScript and a full recursive directory browser script in PHP. I have something similiar to this in a content manager script I've written, but it doesn't check other directories. It picks an image from an /ImageLibrary/ directory, allowing the user to preview an image, upload new images, delete images, rename images, but most importantly pick a filename. Then it populates a field in the content manager screen for saving to a database. Joseph E. Sheble a.k.a. Wizaerd Wizaerd's Realm Canvas, 3D, Graphics, ColdFusion, PHP, and mySQL http://www.wizaerd.com ================================= > -----Original Message----- > From: Jerry Lake [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 4:57 PM > To: [EMAIL PROTECTED] > Subject: [PHP] input type=file > > > this doesn't relate directly to PHP, > but it will when I am done. > > How can I create a file input that > reads from a directory on the server > instead of the users machine > > Jerry Lake - [EMAIL PROTECTED] > Web Designer > Europa Communications - http://www.europa.com > Pacifier Online - http://www.pacifier.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] > > >
so then maybe, if I understand it correctly (which may or may not be true) I could read the contents or a directory and populate a dropdown list...? Jerry Lake - [EMAIL PROTECTED] Web Designer Europa Communications - http://www.europa.com Pacifier Online - http://www.pacifier.com -----Original Message----- From: Joe Sheble (Wizaerd) [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 4:16 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] input type=file to put it simply, you can't... but you could put an input type of text with a link or a button next to it manually, and then on the onClick of either this button or link open a secondary window running a PHP script that reads a particular directory structure with full navigation support. Then when the user clicks a filename, place that into the input in the first window and close the secondary window. However, this would require JavaScript and a full recursive directory browser script in PHP. I have something similiar to this in a content manager script I've written, but it doesn't check other directories. It picks an image from an /ImageLibrary/ directory, allowing the user to preview an image, upload new images, delete images, rename images, but most importantly pick a filename. Then it populates a field in the content manager screen for saving to a database. Joseph E. Sheble a.k.a. Wizaerd Wizaerd's Realm Canvas, 3D, Graphics, ColdFusion, PHP, and mySQL http://www.wizaerd.com ================================= > -----Original Message----- > From: Jerry Lake [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 4:57 PM > To: [EMAIL PROTECTED] > Subject: [PHP] input type=file > > > this doesn't relate directly to PHP, > but it will when I am done. > > How can I create a file input that > reads from a directory on the server > instead of the users machine > > Jerry Lake - [EMAIL PROTECTED] > Web Designer > Europa Communications - http://www.europa.com > Pacifier Online - http://www.pacifier.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
that should be contents of, not contents or... Jerry Lake - [EMAIL PROTECTED] Web Designer Europa Communications - http://www.europa.com Pacifier Online - http://www.pacifier.com -----Original Message----- From: Jerry Lake [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 4:16 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] input type=file so then maybe, if I understand it correctly (which may or may not be true) I could read the contents or a directory and populate a dropdown list...? Jerry Lake - [EMAIL PROTECTED] Web Designer Europa Communications - http://www.europa.com Pacifier Online - http://www.pacifier.com -----Original Message----- From: Joe Sheble (Wizaerd) [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 4:16 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] input type=file to put it simply, you can't... but you could put an input type of text with a link or a button next to it manually, and then on the onClick of either this button or link open a secondary window running a PHP script that reads a particular directory structure with full navigation support. Then when the user clicks a filename, place that into the input in the first window and close the secondary window. However, this would require JavaScript and a full recursive directory browser script in PHP. I have something similiar to this in a content manager script I've written, but it doesn't check other directories. It picks an image from an /ImageLibrary/ directory, allowing the user to preview an image, upload new images, delete images, rename images, but most importantly pick a filename. Then it populates a field in the content manager screen for saving to a database. Joseph E. Sheble a.k.a. Wizaerd Wizaerd's Realm Canvas, 3D, Graphics, ColdFusion, PHP, and mySQL http://www.wizaerd.com ================================= > -----Original Message----- > From: Jerry Lake [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 4:57 PM > To: [EMAIL PROTECTED] > Subject: [PHP] input type=file > > > this doesn't relate directly to PHP, > but it will when I am done. > > How can I create a file input that > reads from a directory on the server > instead of the users machine > > Jerry Lake - [EMAIL PROTECTED] > Web Designer > Europa Communications - http://www.europa.com > Pacifier Online - http://www.pacifier.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- 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]
that would be one option... however, if you're going to let them navigate through different directories, it would be a bit tougher in a dropdown... but if all you need is to display a list of files to them, then that would work great.... Joseph E. Sheble a.k.a. Wizaerd Wizaerd's Realm Canvas, 3D, Graphics, ColdFusion, PHP, and mySQL http://www.wizaerd.com ================================= > -----Original Message----- > From: Jerry Lake [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 5:16 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] input type=file > > > so then maybe, if I understand it correctly > (which may or may not be true) I could read > the contents or a directory and populate a > dropdown list...? > > Jerry Lake - [EMAIL PROTECTED] > Web Designer > Europa Communications - http://www.europa.com > Pacifier Online - http://www.pacifier.com > > > -----Original Message----- > From: Joe Sheble (Wizaerd) [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 4:16 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] input type=file > > > to put it simply, you can't... > > but you could put an input type of text with a link or a button next to it > manually, and then on the onClick of either this button or link open a > secondary window running a PHP script that reads a particular directory > structure with full navigation support. Then when the user clicks a > filename, place that into the input in the first window and close the > secondary window. > > However, this would require JavaScript and a full recursive directory > browser script in PHP. I have something similiar to this in a content > manager script I've written, but it doesn't check other directories. It > picks an image from an /ImageLibrary/ directory, allowing the user to > preview an image, upload new images, delete images, rename > images, but most > importantly pick a filename. Then it populates a field in the content > manager screen for saving to a database. > > Joseph E. Sheble > a.k.a. Wizaerd > Wizaerd's Realm > Canvas, 3D, Graphics, > ColdFusion, PHP, and mySQL > http://www.wizaerd.com > ================================= > > > -----Original Message----- > > From: Jerry Lake [mailto:[EMAIL PROTECTED]] > > Sent: Friday, February 16, 2001 4:57 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] input type=file > > > > > > this doesn't relate directly to PHP, > > but it will when I am done. > > > > How can I create a file input that > > reads from a directory on the server > > instead of the users machine > > > > Jerry Lake - [EMAIL PROTECTED] > > Web Designer > > Europa Communications - http://www.europa.com > > Pacifier Online - http://www.pacifier.com > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > -- > 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] > > >
I have a feeling that after receiving answer to this question I will be able to do everything I want...:) SHOP: Page has three frames: left, right_top and right_down. Left frame: <? echo " <form method=post action=right_top.php target=right_top>"; echo " <input type=hidden name=action value=search_for_phrase>"; echo " <p> "; echo " <input type=text name=phrase>"; echo " <input type=submit name=button value=Search>"; echo " </p>"; echo " </form>"; ?> Right_top frame: (right_top.php) if ($action=="search_for_phrase"){ searching_for_phrase($phrase); exit(); } } function searching_for_phrase($phrase) { ibase_connect('www.gdb','james','james'); $query=ibase_query("select id, name, price from shop where name like '%$phrase%';"); show_records($query); } function showrecords($query) { echo "<TABLE bgcolor=#FBFDB9 BORDER=1 borderColor=#ffffff CELLPADDING=0 CELLSPACING=2 HEIGTH=80><tr>"; echo "<TD ALIGN=CENTER>ID</TD><TD ALIGN=CENTER>Name</TD><TD ALIGN=CENTER>Price</TD></TR>"; while(&record=ibase_fetch_row($tresc_query)) { echo "<tr><td align=center> $record[0] </td>"; id_of_product echo "<td align=center width=150> $record[1] </td>"; name_of_product echo "<td align=center width=150> $record[2] </td>"; price_of_product // echo " <input type=hidden name=id value=$record[1]>"; // echo "<td align=center><input type=submit name=action value='Add'></td></tr>"; ????????????????????????? // echo "<td align=center><A HREF=\"$PHP_SELF ?id_of_product=$record[0]&name_of_product=$wiersz[1]&price_of_product=$wiers z[2]&action='add'\">Add</A></td>";??????????????// ***************How can I transfer variable $id_of_product to right_down frame?????????????????************* Right_down frame: <? if ($action=="add") { adding($id_of_product); exit(); } function adding($id_of_product) { if ($id_of_product!=""){ if (session_is_registered("ses_basket_items")){ $basket_position_counter=0; $double=0; if ($ses_basket_items>0){ foreach ($ses_basket_name as $basket_item){ if ($basket_item==$name_of_product){ $double=1; $basket_position=$basket_position_counter; } $basket_position_counter++; } } if ($double==1){ $oldamount=$ses_basket_amount[$basket_position]; $ses_basket_amount[$basket_position]++; $price_of_product*$ses_basket_amount[$basket_position]; $ses_basket_price[$basket_position]=$price_of_product*$ses_basket_amount[$ba sket_position]; } else $ses_basket_name[]=$name_of_product; $ses_basket_amount[]=1; $ses_basket_price[]=$price_of_product; $ses_basket_items++; } } else $ses_basket_items=1; $ses_basket_name[0]=$name_of_product; $ses_basket_amount[0]=1; $ses_basket_price[0]=$price_of_product; session_register("ses_basket_items"); session_register("ses_basket_name"); session_register("ses_basket_amount"); session_register("ses_basket_price"); } } if ($ses_basket_items>0){ for ($basket_counter=0;$basket_counter<$ses_basket_items;$basket_counter++){ $price=sprintf("%01.2f",$ses_basket_price[$basket_counter]); $amount=$ses_basket_amount[$basket_counter]; $name=$ses_basket_name[$basket_counter]; if ($amount>0){ echo "$amount $name $price"; echo "<BR>"; } } else { $ses_basket_items=0; unset($ses_basket_name); unset($ses_basket_amount); unset($ses_basket_price); } ?> The purpose of this frame is to add items to a basket: - checking if there is product of a certain name in basket- if so increasing amount by one if not adding the name to basket - printing on screen the state of the basket. Please answer my above question...:) I mean: ***************How can I transfer variable $id_of_product to right_down frame?????????????????************* Thanks in advance Adamski
I have an existing database from a flat file that I imported into a MySQL table. Some of the title fields are duplicates - songs with the same name from different song books. So if I want to delete a record by title, I'll end up deleting all songs with that title. Is there a way I can add a unique id field and have it automatically generate a unique number to each record? Hope that made sense. Jeff Oien
just add a field unique_id int auto_increment in the table...u dont have to do anything more...it will start at 1 and every time a new record is added to the table this value will be incremented.... ----- Original Message ----- From: "Jeff Oien" <[EMAIL PROTECTED]> To: "PHP" <[EMAIL PROTECTED]> Sent: Friday, February 16, 2001 7:10 PM Subject: [PHP] MySQL: Add Autoincrement Field? > I have an existing database from a flat file that I > imported into a MySQL table. Some of the title > fields are duplicates - songs with the same name > from different song books. So if I want to delete > a record by title, I'll end up deleting all songs with > that title. Is there a way I can add a unique id field > and have it automatically generate a unique number to > each record? Hope that made sense. > Jeff Oien > > -- > 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] > > > >
Could you tell me how to add a field to an existing database? I'm having trouble finding out how to do it. Thanks. Jeff Oien > just add a field unique_id int auto_increment in the table...u dont have to > do anything more...it will start at 1 and every time a new record is added > to the table this value will be incremented.... > > > I have an existing database from a flat file that I > > imported into a MySQL table. Some of the title > > fields are duplicates - songs with the same name > > from different song books. So if I want to delete > > a record by title, I'll end up deleting all songs with > > that title. Is there a way I can add a unique id field > > and have it automatically generate a unique number to > > each record? Hope that made sense. > > Jeff Oien > > > > -- > > 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] >
alter table $TableName add column $ColumnName NOT NULL AUTO_INCREMENT PRIMARY KEY; Have a nice day! Brian Drexler Precision Web Design ----- Original Message ----- From: Jeff Oien <[EMAIL PROTECTED]> To: PHP <[EMAIL PROTECTED]> Sent: Friday, February 16, 2001 11:30 PM Subject: RE: [PHP] MySQL: Add Autoincrement Field? > Could you tell me how to add a field to an existing > database? I'm having trouble finding out how to do it. > Thanks. > Jeff Oien > > > just add a field unique_id int auto_increment in the table...u dont have to > > do anything more...it will start at 1 and every time a new record is added > > to the table this value will be incremented.... > > > > > I have an existing database from a flat file that I > > > imported into a MySQL table. Some of the title > > > fields are duplicates - songs with the same name > > > from different song books. So if I want to delete > > > a record by title, I'll end up deleting all songs with > > > that title. Is there a way I can add a unique id field > > > and have it automatically generate a unique number to > > > each record? Hope that made sense. > > > Jeff Oien > > > > > > -- > > > 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]
Dave Goodrich wrote: > The only reason I have a Mac on my desk is for Bbedit. Hoping they > port to OSX and allow it to run on my FBSD box. Isnt BBedit originally from BeOS? This way, you could at least run it on your x86-Box. regards Wagner -- Three may keep a secret, if two of them are dead.
I have been writing this project in PHP4 but had to save it for PHP3 an apache server. http://www.sed.is/sereign_145.php3 When I saved it on an apache server (I have W2K - where it's 100% ok!) as php3 I get these errors: Warning: Wrong parameter count for round() in <sniped>/sereign_145.php3 on line 152 Warning: Wrong parameter count for round() in <sniped>/sereign_145.php3 on line 161 According to the manuals this function should work like in both PHP3 and 4... Can anyone point me to a solution? Regards, Sumarlidi Einar Dadason SED - Graphic Design ------------------------------------------ Phone: (+354) 4615501 Mobile: (+354) 8960376 Fax: (+354) 4615503 E-mail: [EMAIL PROTECTED] Homepage: www.sed.is <- New Homepage! ------------------------------------------
Hello, Hey I can't remeber how to do it but I'm sure one of you will. How do I strip the \n from a variable? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
You want to totally remove \n? $something = ereg_replace("\n"," ",$something); That should do it. If you mean making \n into BR: $something = ereg_replace("\n","<br>",$something); - Kath ----- Original Message ----- From: "Brandon Orther" <[EMAIL PROTECTED]> To: "PHP User Group" <[EMAIL PROTECTED]> Sent: Friday, February 16, 2001 9:38 PM Subject: [PHP] Quick hellp, How do I stip new lines? > Hello, > > Hey I can't remeber how to do it but I'm sure one of you will. How do I > strip the \n from a variable? > > > > Thank you, > > -------------------------------------------- > Brandon Orther > WebIntellects Design/Development Manager > [EMAIL PROTECTED] > 800-994-6364 > www.webintellects.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] >
Hi Kath, @ 9:41:34 PM on 2/16/2001, [EMAIL PROTECTED] wrote: > You want to totally remove \n? > $something = ereg_replace("\n"," ",$something); trim() will suffice. http://www.php.net/manual/en/function.trim.php -Brian
Trim() will in fact only strip whitespace from the beginning or end of the string; if he has \n's anywhere in the middle of the string, trim will do perform the desired operation. Ereg_replace() is unnecessary for a simple search/replace operation; str_replace() will suffice and is faster to some degree. Try: $str = str_replace("\n", '', $str); --Toby Brian Clark wrote: > > Hi Kath, > > @ 9:41:34 PM on 2/16/2001, [EMAIL PROTECTED] wrote: > > > You want to totally remove \n? > > > $something = ereg_replace("\n"," ",$something); > > trim() will suffice. > > http://www.php.net/manual/en/function.trim.php > > -Brian > > -- > 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]
> Trim() will in fact only strip whitespace from the beginning or end of > the string; if he has \n's anywhere in the middle of the string, trim > will do perform the desired operation. CORRECTION : "trim will not perform the desired operation" <snip>
Hello, I am looking for a way to get a dir listing of the current dir my phpscript is in and putting it into an array. Does anyone have a quick way to do this? Thank you, -------------------------------------------- Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com --------------------------------------------
Can PHP execute a refresh to a new page? If so, how? Thanks. Kenneth R Zink II [EMAIL PROTECTED] ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!!
HTML can create a refresh to a new page..... Put this in the header.... <meta HTTP-EQUIV="Refresh" CONTENT="3; URL=http://newurl.com"> 3 is the number of seconds that it is delayed.... Brian Drexler Precision Web Design ----- Original Message ----- From: Kenneth R Zink II <[EMAIL PROTECTED]> To: PHP <[EMAIL PROTECTED]> Sent: Friday, February 16, 2001 10:22 PM Subject: [PHP] Can PHP execute a refresh to a new page? Can PHP execute a refresh to a new page? If so, how? Thanks. Kenneth R Zink II [EMAIL PROTECTED] ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!!
HTTP can also tell a broswer to 'refresh' <? header("Location: http://$SERVER_NAME$PHP_SELF"); ?> -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""Kenneth R Zink II"" <[EMAIL PROTECTED]> wrote in message 014501c09890$cf4322d0$[EMAIL PROTECTED]">news:014501c09890$cf4322d0$[EMAIL PROTECTED]... Can PHP execute a refresh to a new page? If so, how? Thanks. Kenneth R Zink II [EMAIL PROTECTED] ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!!
i've been using the header("...") approach myself, but was curious to see if there's a builtin PHP function that will accomplish the same thing.... im a kind-of new PHP programmer, and havent really been exposed to too much of the language yet, but i found it quite odd that such a function seems to be absent from the core language, since it's a web based language... and moving a browser from one URL to another is quite common among web scripts. > -----Original Message----- > From: Chris Lee [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 20:01 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Can PHP execute a refresh to a new page? > > > HTTP can also tell a broswer to 'refresh' > > <? > header("Location: http://$SERVER_NAME$PHP_SELF"); > ?> > > > -- > > > Chris Lee > Mediawaveonline.com > > em. [EMAIL PROTECTED] > > ph. 250.377.1095 > ph. 250.376.2690 > fx. 250.554.1120 > > > ""Kenneth R Zink II"" <[EMAIL PROTECTED]> wrote in message > 014501c09890$cf4322d0$[EMAIL PROTECTED]">news:014501c09890$cf4322d0$[EMAIL PROTECTED]... > Can PHP execute a refresh to a new page? > > If so, how? > > Thanks. > > Kenneth R Zink II [EMAIL PROTECTED] ICQ# 5095094 > '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! > http://www.s-series.org/htm/windstorm/project-windstorm.htm > '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! > http://www.s-series.org/htm/firestorm/firestorm.htm > Racing by the Grace of God!! > > > > > -- > 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] >
You can set your error reporting in your php.ini file or set error_reporting() in your scripts to be very sensitive where it will tell you such things as variables that weren't defined properly. Look into http://www.php.net/manual/en/features.error-handling.php Michael Joe Sheble aka Wizaerd wrote: > Is there anything that evaluates PHP code and checks for optimization? Not > like the Zend Optimizer, but one that checks for things such as variables > that were defined but never used, repeated variables, unnecessary > statements or constructs? Basically a code cleaner such as C, C++, Java, > etc all have? > > Joseph E. Sheble > [EMAIL PROTECTED] > ======================== > Wizaerd's Realm > http://www.wizaerd.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]
Using PHP3/MySQL, is there a way I can select only the newest record from a MySQL table. I have a datetime field and an Auto_incremented field. Anyone got any ideas??? Brian Drexler
there are two ways that come to mind of doing this if you're using some kind of auto-incrementing field (not necessarily AUTO_INCREMENT, but any field that increases [or decreases] with time) this will select the entire row, but limit the query to only return 1 result (and depending on how your order, this result could be the highest/lowest value of the field): (to get highest value of field id) SELECT * FROM mytable ORDER BY id ASC LIMIT 1; (to get lowest value of field id) SELECT * FROM mytable ORDER BY id DESC LIMIT 1; PS: there's probably a more efficient way to do it, but this is what came to mind at the moment... > -----Original Message----- > From: Brian Drexler [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 20:22 > To: Php-General > Subject: [PHP] Can I select only the newest record? > > > Using PHP3/MySQL, is there a way I can select only the newest record from a > MySQL table. I have a datetime field and an Auto_incremented field. Anyone > got any ideas??? > > Brian Drexler >
would anyone answer my following question? i want to ask whether i should install "phplib" in php v3 before i use session. whether it only can work with mySQL? thank you very much!
I haven't seen this issue discussed, sorry if I missed it: My question is why are the PHP database functions so unportable? Is there a reason why they have to be specific to, say MySQL. It seems to me (even though I am an amatuer to this stuff) that the code should be much more easily portable from one db to another? Do most coders add an abstraction layer themselves? Or maybe people just don't port PHP code much and so don't worry about it? Mainly curious.... Dave
This topic is covered a lot. Right now there are two major DB abstraction packages, Manuel Lemos' Metabase ( http://phpclasses.UpperDesign.com/browse.html/package/20 ) and the one that is distrubuted with PHP located in your distributions PEAR directory. Try both, see which one works better for you. Michael Dave Haggerty wrote: > I haven't seen this issue discussed, sorry if I missed it: > > My question is why are the PHP database functions so unportable? Is there a > reason why they have to be specific to, say MySQL. It seems to me (even > though I am an amatuer to this stuff) that the code should be much more > easily portable from one db to another? > > Do most coders add an abstraction layer themselves? Or maybe people just > don't port PHP code much and so don't worry about it? > > Mainly curious.... > > Dave > > -- > 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]
Try taking a look at the ADODB class written by the people at www.phpeverywhere.com (net?) We are using this code. it supports all major functions of 9 different databases.... and is very solid. -----Original Message----- From: Dave Haggerty [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 10:55 PM To: [EMAIL PROTECTED] Subject: [PHP] Database Code Portability I haven't seen this issue discussed, sorry if I missed it: My question is why are the PHP database functions so unportable? Is there a reason why they have to be specific to, say MySQL. It seems to me (even though I am an amatuer to this stuff) that the code should be much more easily portable from one db to another? Do most coders add an abstraction layer themselves? Or maybe people just don't port PHP code much and so don't worry about it? Mainly curious.... Dave -- 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]
A simple to it solution is PHP Library (PHPLIB) phplib.netuse.de, or the ADODB class which Dallas was referring to you. Using these not only makes a db more portable to you but it also easier to do connections and queries from your software. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -----Original Message----- From: Dallas Kropka [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 4:19 PM To: Dave Haggerty; [EMAIL PROTECTED] Subject: RE: [PHP] Database Code Portability Try taking a look at the ADODB class written by the people at www.phpeverywhere.com (net?) We are using this code. it supports all major functions of 9 different databases.... and is very solid. -----Original Message----- From: Dave Haggerty [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 10:55 PM To: [EMAIL PROTECTED] Subject: [PHP] Database Code Portability I haven't seen this issue discussed, sorry if I missed it: My question is why are the PHP database functions so unportable? Is there a reason why they have to be specific to, say MySQL. It seems to me (even though I am an amatuer to this stuff) that the code should be much more easily portable from one db to another? Do most coders add an abstraction layer themselves? Or maybe people just don't port PHP code much and so don't worry about it? Mainly curious.... Dave -- 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]
How do i make a php and MySQL search engine?
it's such a complex question and answer that i really think you need to ponder some more fundamental design concepts before you ask for advice on actually coding the thing... such as what type of database layout fits the type of information you will be storing/searching/retrieving, how you want to categorize the information in your database, how the interface will look and operate (do you want to allow boolean expressions, or just search for any occurence of any word in the search field) to get a very simple searcher thing working, it's not very hard (ive done it in perl/MySQL for a site that had about 20 static HTML pages and some news stories in a database table) and it took me about half a day however, you have to know what you want to accomplish beforehand or else you'll bang your head against the wall quite often during development :) if you're going for an exremely simple searcher with few features and not too much flexibility, i'd reccomend creating a keyword lookup table that simply relates keywords to the thing they refer to (HTML page, PHP page, etc...) the table might look a bit like this, if you had two pages and a total of two keywords: key | page ------|------------ "foo" | "firewall.html" "bar" | "vpn.html" "bar" | "firewall.html" then, when people entered either "foo" or "bar" (or "foo bar") into your search field, the resulting query would be a list of pages that were associated with either (or both) of those keywords. "foo" = "firewall.html" "bar" = "vpn.html" "foo bar" = "firewall.html" and "vpn.html" > -----Original Message----- > From: Brandon Feldhahn [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 16, 2001 23:07 > To: [EMAIL PROTECTED] > Subject: [PHP] search > > > How do i make a php and MySQL search engine? > >
hai friends since two days i am trying to download the installer of PHP and as the file in the site got affected with virus. our network firewall is not allowing to install it here in my Pc. can any of you help me in sending the installer of PHP as attachments to run my PHP programs my mail-id is [EMAIL PROTECTED] Thanks in advance satish > > > -- > 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]
how would i make somthing in a IF statement that would take somone to the members page when they get the login correct
make a function which validates users. Then where ever you want to restrict access just call that function before other things .. and it will do the trick where ever you need .. no if statements needed. HTH Jaskirat At 11:47 PM 2/16/01 -0800, Brandon Feldhahn wrote: >how would i make somthing in a IF statement that would take somone to >the members page when they get the login correct > > >-- >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] >
you could possibly store the name/password as cookies, so that they're available to the PHP script without the user having to type them in more than once per session (or even longer if you set the expire date properly) i know that cookies are horribly insecure, but for purposes of a very simple validation routine, cookies are sufficient) if ( !validate_user($ck_name,$ck_pw) ) { print "you are not logged in, please go log in"; } else { print "you are logged in"; } function validate_user($ck_name, $ck_pw) { //make whatever calls you need to the database //to see if this name/pw combination are valid. //return 1 if good, return 0 if bad } > -----Original Message----- > From: jaskirat [mailto:[EMAIL PROTECTED]] > Sent: Saturday, February 17, 2001 00:30 > To: Brandon Feldhahn; [EMAIL PROTECTED] > Subject: Re: [PHP] location > > > make a function which validates users. > > Then where ever you want to restrict access just call that function before > other things .. and it will > do the trick where ever you need .. no if statements needed. > > HTH > > Jaskirat > > At 11:47 PM 2/16/01 -0800, Brandon Feldhahn wrote: > >how would i make somthing in a IF statement that would take somone to > >the members page when they get the login correct > > > > > >-- > >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] >
Since this thread is running I would like to know the gurus' opinons on the similar following situation Suppose there is a variable like this $var = "This is a variable "; Now I want to strip off white spaces on the end without losing them in the middle of the sentence .. I had figured that there is a no direct way of doing it and some thing like this works $var = trim (ereg_replace(" ","",$var)); the first argument to ereg_replace is "two spaces" so that single spaces between the words are not removed then trim to remove any space on the end which may still remain. But I feel its still not a fool proof solution because there may be two spaces in between words some where also which will then be clubbed together. Any body has a better idea. Jaskirat At 09:51 PM 2/16/01 -0500, you wrote: >> Trim() will in fact only strip whitespace from the beginning or end of >> the string; if he has \n's anywhere in the middle of the string, trim >> will do perform the desired operation. > >CORRECTION : "trim will not perform the desired operation" > ><snip> > >-- >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] >
well, there are two solutions, 1) for variables with only whitespace to be trimmed 2) variables with whitespace and \n to be trimmed 1) solution: the way i'd do it too is regexp... very similar to your solution (you're on the right track, but just needed to take that final step) $var = "This is a variable "; print ".". ereg_replace('( +)$','',$var) ."."; this will print ".This is a variable." the regexp replaces all whitespace at the end with nothing. "$" means to match at the end, and "( +)" means to match one or more spaces 2) solution: for text with mixed linebreaks and spaces, i cannot seem to find a single regexp that'll compile, so i came up with a bad emulation of perl's s//g (global replace) by using a while loop to keep checking if there's any more crap that needs to get cut off the end... $var = "This is text with linebreaks and spaces "; while (ereg("(\n| )$", $var)) { $var = ereg_replace("(\n+| +)$",'',$var); } print "$var<BR>\n"; prints: "This is text with linebreaks and spaces" (with no further linebreaks *or* spaces after the word "spaces") PS: if anyone out there is more familiar with PHP/regexps than i am, could you please send me an email explaining how to get global pattern matching (ala perl's s///g command) in PHP?? i cannot seem to find any switches for ereg that make it match global > -----Original Message----- > From: jaskirat [mailto:[EMAIL PROTECTED]] > Sent: Saturday, February 17, 2001 00:17 > To: [EMAIL PROTECTED] > Subject: [PHP] more on trimming > > > Since this thread is running I would like to know the gurus' opinons on the > similar following situation > > Suppose there is a variable like this > > $var = "This is a variable "; > > Now I want to strip off white spaces on the end without losing them in the > middle of the sentence .. > > > I had figured that there is a no direct way of doing it and some thing like > this > works > $var = trim (ereg_replace(" ","",$var)); > > the first argument to ereg_replace is "two spaces" so that single spaces > between the words are not removed > then trim to remove any space on the end which may still remain. > > But I feel its still not a fool proof solution because there may be two > spaces in between words some where also > which will then be clubbed together. > > Any body has a better idea. > > Jaskirat >
Take a look at: http://www.php.net/manual/en/function.chop.php almost identical to perl's chomp(). At 13:46 17/02/01 +0530, jaskirat wrote: >Since this thread is running I would like to know the gurus' opinons on the >similar following situation > >Suppose there is a variable like this > >$var = "This is a variable "; > >Now I want to strip off white spaces on the end without losing them in the >middle of the sentence .. -------------------- Tel: 6653-297502 Email: [EMAIL PROTECTED] www.mangorains.com -------------------
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] ("..s.c.o.t.t..") wrote: > PS: if anyone out there is more familiar with PHP/regexps than i am, > could you please send me an email explaining how to get global > pattern matching (ala perl's s///g command) in PHP?? > i cannot seem to find any switches for ereg that make it match global Use the Perl Compatible Regular Expressions (PCRE), like preg_replace. Not only will you find the syntax very familiar, but the PRCE functions are also faster than their ereg equivalents. -- CC