[PHP] HTML module problem under Linux/APache2.0
Im' sorry but I discovered a problem when I try to send an HTML module to a PHP file. Watch the example below: module.html: Module welcome.php: Welcome $user"; ?> Under Microsoft XP's IIS with Php4 modules installled ther isn't any problem but under Linux with Apache 2.0 and Php 4 modules installed, doesn't appear nothing. TO NOTE: Php's modules under this last system (linux/Apache2.0) run correctly and other scripts have been execute correctly. Thank you for any help Tiziano Crimella - Switzerland -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML module problem under Linux/APache2.0
No idea what you mean html module, but it looks like a register_globals problem. Tiziano Crimella wrote: Im' sorry but I discovered a problem when I try to send an HTML module to a PHP file. Watch the example below: module.html: Module welcome.php: Welcome Print "Welcome $user"; ?> Under Microsoft XP's IIS with Php4 modules installled ther isn't any problem but under Linux with Apache 2.0 and Php 4 modules installed, doesn't appear nothing. TO NOTE: Php's modules under this last system (linux/Apache2.0) run correctly and other scripts have been execute correctly. Thank you for any help Tiziano Crimella - Switzerland -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML module problem under Linux/APache2.0
I mean that if you use the following code into welcome.php file: Welcome $user"; ?> You can pass directly this line: http://domain/welcome.php?user=nameofuser into the address bar and the nameofuser specified as variable User, must be visible in the following example: "Welcome UserName" bye Tiziano Crimella "Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > No idea what you mean html module, but it looks like a register_globals > problem. > > Tiziano Crimella wrote: > > >Im' sorry but I discovered a problem when I try to send an HTML module to a > >PHP file. Watch the example below: > > > >module.html: > >--- - > > > > > > > > > >Module > > > > > > > > > > > > > > > > > > > > > > > > > >welcome.php: > >--- - > > > > > > > >Welcome > > > > > > > > > > >Print "Welcome $user"; > >?> > > > > > > > >Under Microsoft XP's IIS with Php4 modules installled ther isn't any problem > >but under Linux with Apache 2.0 and Php 4 modules installed, doesn't appear > >nothing. > > > >TO NOTE: Php's modules under this last system (linux/Apache2.0) run > >correctly and other scripts have been execute correctly. > > > >Thank you for any help > > > >Tiziano Crimella - Switzerland > > > > > > > > > > > > > > > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML module problem under Linux/APache2.0
No idea what you mean html module, but it looks like a register_globals problem. I completely agree. But for the sake of beating a dead horse. The value you are looking for in this instance is located in the appropriate global arrays($_GET,$_POST,$_SERVER, etc, etc) So basically, you could do the following (in your welcome.php file). $user = $_GET['user']; HTH, Jason k Larson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Auto_incerement value
Hi all, This is a fast question. Does anyone remembers how to obtain the ID auto assigned after an INSERT statement under MySQL? Thanks in advanced, Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto_incerement value
http://www.php.net/manual/en/function.mysql-insert-id.php Cesar Aracena wrote: Hi all, This is a fast question. Does anyone remembers how to obtain the ID auto assigned after an INSERT statement under MySQL? Thanks in advanced, Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto_incerement value
At 06:41 AM 12/30/02 -0300, Cesar Aracena wrote: Hi all, This is a fast question. Does anyone remembers how to obtain the ID auto assigned after an INSERT statement under MySQL? http://www.php.net/manual/en/function.mysql-insert-id.php Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Serializing a DOM object
Consider the following: page1.php test\n"; $retval = serialize( domxml_open_mem( $xml )); return $retval; } ?> page2.php http://somepage.php' ); $xml = $soapclient->call( 'test', $parameters ); $xml = unserialize( $xml ); $xml->dump_mem(); ?> In the test function, if I just serialize the $xml, return it and then call xmldoc_open_mem on the unserialized return string, it works fine. But it doesn't like it if I do the above. I'm getting the error: Warning: dump_mem() [function.dump-mem]: Underlying object missing or of invalid type Warning: dump_mem() [function.dump-mem]: Cannot fetch DOM object Why isn't the serialization of the DOM object not working that way? thnx, Chris
[PHP] PHP & PostgreSQL
I'm switching from a MySQL environment to PGSQL and I'm going through and trying to learn the differences between the two. I've come across some issues that I can't seem to find the answers to in the docs or on the web. I'm hoping someone can help me out. * MySQL has a function to reset the result set so that it can be iterated through again - mysql_data_seek(). I don't see that there is a similar function for PGSQL. Is that true? If so, in order to reset the result set you have to perform the query again? Isn't that a waste of resources? * For PGSQL, you can get the database name, the field name even the *host name* but you can't get the table name from a particular query? Any info would be greatly appreciated! Chris
Re: [PHP] PHP & PostgreSQL
On Monday 30 December 2002 18:13, Boget, Chris wrote: > I'm switching from a MySQL environment to PGSQL and I'm > going through and trying to learn the differences between the > two. I've come across some issues that I can't seem to find the > answers to in the docs or on the web. I'm hoping someone can > help me out. > > * MySQL has a function to reset the result set so that it can be > iterated through again - mysql_data_seek(). I don't see that there > is a similar function for PGSQL. Is that true? If so, in order to > reset the result set you have to perform the query again? Isn't > that a waste of resources? pg_result_seek() should perform a similar function. In most cases you wouldn't need to use that because if you're going to be using the results more than once you could store them in an array. > * For PGSQL, you can get the database name, the field name > even the *host name* but you can't get the table name from a > particular query? Not sure what you're getting at here. Surely for any particular query, _you_ would know what table(s) is/are being used? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* In Hollywood, all marriages are happy. It's trying to live together afterwards that causes the problems. -- Shelley Winters */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Zerofill
Hi all, Sorry to bother you all, but I need something I haven't used in quite a long time. Dows anyone remembers the PHP function to fill a number with zeros until it reaches a desired length? Thanks in advance, Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zerofill
How about: http://www.php.net/manual/en/function.str-pad.php HTH, Jason k Larson Cesar Aracena wrote: Hi all, Sorry to bother you all, but I need something I haven't used in quite a long time. Dows anyone remembers the PHP function to fill a number with zeros until it reaches a desired length? Thanks in advance, Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP & PostgreSQL
> pg_result_seek() should perform a similar function. In most cases > you wouldn't need to use that because if you're going to be using > the results more than once you could store them in an array. Sometimes yes, sometimes no. But a valid point nonetheless. > > * For PGSQL, you can get the database name, the field name > > even the *host name* but you can't get the table name from a > > particular query? > Not sure what you're getting at here. Surely for any particular > query, _you_ would know what table(s) is/are being used? That's not necessarily true. Certainly not if you are using an abstraction layer to access the database. Take PEAR for example. When instantiation on object, you give it the relevant connection information (user, pw, host and perhaps a dbname that may or may not be the dbname that gets queried later on). So sure, you can access those member variables (except maybe dbname; I don't think that gets stored) which is also information you can get programatically using built in functions. But let's say you pass a query to the query() method that doesn't use the dbname that you used when instantiating the object. That's certainly valid. But now, there's no way (ok, there's a way but it isn't necessarily accurate) to get the dbname for the query that was just run... apart from requiring the programmer to pass the dbname as another paramter to the query() method You can do this in mysql. I just don't know why you can't do this in pgsql. Chris
Re: [PHP] PHP & PostgreSQL
On Monday 30 December 2002 18:41, Boget, Chris wrote: > > > * For PGSQL, you can get the database name, the field name > > > even the *host name* but you can't get the table name from a > > > particular query? > > > > Not sure what you're getting at here. Surely for any particular > > query, _you_ would know what table(s) is/are being used? > > That's not necessarily true. Certainly not if you are using an > abstraction layer to access the database. Take PEAR for example. > When instantiation on object, you give it the relevant connection > information (user, pw, host and perhaps a dbname that may or may > not be the dbname that gets queried later on). So sure, you can > access those member variables (except maybe dbname; I don't think > that gets stored) which is also information you can get > programatically using built in functions. But let's say you pass > a query to the query() method that doesn't use the dbname that > you used when instantiating the object. That's certainly valid. > But now, there's no way (ok, there's a way but it isn't necessarily > accurate) to get the dbname for the query that was just run... apart from > requiring the programmer to pass the dbname as another paramter > to the query() method You can do this in mysql. I just don't know > why you can't do this in pgsql. Sorry, you've lost me. In your OP you say you wanted the "table name", but now you're talking about the "dbname"? For dbname, you can use (oddly enough) pg_dbname(). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* [Babe] Ruth made a big mistake when he gave up pitching. -- Tris Speaker, 1921 */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
At 06:20 PM 12/30/02 +0800, Jason Wong wrote: On Monday 30 December 2002 18:13, Boget, Chris wrote: > I'm switching from a MySQL environment to PGSQL and I'm > going through and trying to learn the differences between the > two. The things that bothered me the most: o Pg doesn't have DATE_FORMAT(), or the types SET and ENUM. o Changing database structure is harder. With PG, I usually found it easier to dump, edit, then reload the database to make changes I did in MySQL with ALTER TABLE. o The command line program's exit command starts with a \. It took me a long time to find that... The command line interface for pg is much better. o Large result sets are returned in less, and the command editor feels better. o There are lots of cool things you can look at with the \ commands in the command line program.try \help o You can see the source code of the queries that make up the \ commands. I don't remember exactly how, but it is either in \help or the man page. > * MySQL has a function to reset the result set so that it can be > iterated through again - mysql_data_seek(). pg_fetch_array() has a third parameter that specifies which record to return. In most cases you wouldn't need to use that because if you're going to be using the results more than once you could store them in an array. I disagree... You have easy access to the entire result set, in any order, with either database. You are wasting time and memory making another copy of the data. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] usort crashes
A quite anusual problem - and I can't figure it out.. My script, using the usort-function works properly on my local php-environment (PHP 4.0.6) but not on my server, running php 4.1.2! I've read in a documentation, that php since 4.1.0 doesn't accept zero as return-value of the compare-function. But that value never occurs in my script! There are no error messages, the server just stops interpreting my script after 7 calls of the compare function - no farther commands are recognized! The max. execution-time isn't exceeded; i've tested that. If I replace usort, and use a bubblesort function instead, everythings works fine.. I use: > for ($a = 0; $a < count($zeile); $a++) > > for ($b = $a; $b < count($zeile); $b++) > > $c = sortieren($zeile[$a], $zeile[$b]); > if ($c < 0){ $temp = $zeile[$a]; $zeile[$a] = $zeile[$b]; $zeile[$b] = $temp; } > } } It's a strange problem, isn't it? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP & PostgreSQL
At 04:41 AM 12/30/02 -0600, Boget, Chris wrote: You can do this in mysql. I just don't know why you can't do this in pgsql. The basic answer to why the interfaces to the databases differ is because the PHP interfaces reflects the C interface provided by the database authors. Most PHP extensions are just wrappers that allow you to call existing libraries. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
On Monday 30 December 2002 19:11, Rick Widmer wrote: > At 06:20 PM 12/30/02 +0800, Jason Wong wrote: > >On Monday 30 December 2002 18:13, Boget, Chris wrote: > > > I'm switching from a MySQL environment to PGSQL and I'm > > > going through and trying to learn the differences between the > > > two. > > The things that bothered me the most: > > o Pg doesn't have DATE_FORMAT(), pg's date functions are pretty abysmal compared to mysql's. > or the types SET and ENUM. These aren't standard and handling these in PHP does require a bit more code. So you're probably better off using an extra table instead. > o Changing database structure is harder. With PG, I usually found it >easier to dump, edit, then reload the database to make changes I did >in MySQL with ALTER TABLE. pg's ALTER TABLE doesn't really let you alter much at all which makes prototyping a pain. > o The command line program's exit command starts with a \. It took me >a long time to find that... Use CTRL-d, it's a very commonly used "exit command" which gets you out of almost anything -- mysql, psql, ftp, telnet, ssh etc. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Ambiguity: Telling the truth when you don't mean to. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Zerofill
http://www.php.net/manual/en/function.str-pad.php or use sprintf, e.g. $formatted = sprintf("%012.2f", $value); pads $value up to 12 digits to the left with zero's. -Original Message- From: Cesar Aracena [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 12:22 PM To: [EMAIL PROTECTED] Subject: [PHP] Zerofill Hi all, Sorry to bother you all, but I need something I haven't used in quite a long time. Dows anyone remembers the PHP function to fill a number with zeros until it reaches a desired length? Thanks in advance, Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP & PostgreSQL
> Sorry, you've lost me. In your OP you say you wanted the > "table name", but now you're talking about the "dbname"? > For dbname, you can use (oddly enough) pg_dbname(). Eeep, I'm ever so sorry. That's what I get for responding at 4:30a when trying to battle insomnia. Yes, I am looking for the table name, not dbname. My apologies. Chris
[PHP] Text repeating problem
Hi all, First of all, apologies if this is a question that has already been asked and answered, but a quick search of the archives didn't turn up anything - perhaps because it's hard to think of good keywords... I'm experiencing a bizarre problem with PHP 4.2.2 and Apache 2.0.40 - both the versions that shipped with Red Hat 8.0. I don't know what's causing it and it may not actually be PHP's 'fault' at all, but I'm hoping that some kind soul here will be able to help me out! I have several PHP web applications which have large text boxes (Wiki sites etc.). Usually, they work fine, but sometimes, if a large-ish amount of text is entered, the server seems to receive a mangled mess which includes the full text but with a second copy of part of it inserted somewhere at the end. You can edit the page again, remove the extra content and save, but it'll just get added back... I originally suspected this must be a problem with the PHP scripts themselves, but now find that it happens with several different independent things so can't be that simple. Furthermore, it worked happily on my previous setup with Apache 1.3 and a slightly older PHP. Also, image and other file uploads seem to be deeply broken: it'll accept and store an image, but on then trying to view it I find that the file size is much bigger and most of the picture has just become plain grey... this may or may not be related/the same problem, but I would imagine that if the same thing happened to binaries as does to text it might have an effect like this... Anyone seen this before? Any suggestions/things to try? It's driving me mad... Thanks very much, Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] install problem
Hello ! I have problem with php-4.3.0 i can not install it on my 3 different rh7.0 servers. ./configure --prefix=/usr --with-config-file-path=/etc --disable-debug --enable-pic --enable-shared --enable-inline-optimization --with-apxs=/usr/sbin/apxs --with-exec-dir=/usr/bin --with-regex=system --with-gettext --with-gd --with-jpeg-dir=/usr --with-png --with-zlib --with-zlib-dir=/usr/local/lib --with-gdbm --enable-debugger --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-yp --enable-ftp --enable-wddx --with-mysql --without-oracle --without-oci8 --with-xml Errors: multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm -ldl -lnsl -lcrypt -o sapi/cli/php libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam': /root/http_stuff/php/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of `tempnam' is dangerous, better use `mkstemp' functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm -ldl -lnsl -lcrypt -o sapi/cli/php libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam': /root/http_stuff/php/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of `tempnam' is dangerous, better use `mkstemp' functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo main/internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm -ldl -lnsl -lcrypt -o sapi/cli/php libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam': /root/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of `tempnam' is dangerous, better use `mkstemp' -- Best regards, gnu_is_not_unix --- Konto bez opłat i prowizji? TAK! eKONTO w mBanku! < http://pf.wp.pl/mbank.html > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help-regarding installation
hi all, i jus can't get php to work.i've installed apache web server in windows 2000 platform and tried to run a php script which is in d:/work/sample.php.but the browser prints out a http:404 error saying that the page cannot be displayed. in the httpd.conf file, i 've given the scriptAlias as ScriptAlias d:/work/ to be treated as /first/ so, when i jus type in http:/localhost/ i get the screen one usually gets when the apache is sucessfully installed.and when i type in http://localhost/first/, those files under the d:/work/ directory get succesfully listed.but the problem starts when i click on those scripts. please help Thank you. Celia __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
Due to writing this email *way* too early in the morning, I got everything mixed up and didn't say what I meant. The below is what I really meant. > Not sure what you're getting at here. Surely for any particular > query, _you_ would know what table(s) is/are being used? That's not necessarily true. Certainly not if you are using an abstraction layer to access the database. Take PEAR for example. When instantiation on object, you give it the relevant connection information. When you pass a query to the query() there's no way (ok, there's a way but it isn't necessarily accurate) to get the table name for the query that was just run... apart from requiring the programmer to pass the table name as another paramter to the query() method You can do this in mysql using the mysql_tablename() function. I just don't know why you can't do this in pgsql. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function misfunction
I'm trying to redo a db lookup into a function. The function is placed in a class called tracking and declared thus: function setCurrentDevGroup($devID) { // start original routine $query = "SELECT dev_group FROM tracking WHERE (computer = $devID)"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $resulttable = $sth->fetchrow_hash(); $lookuptable = $resulttable["dev_group"]; return($lookuptable); } //end original routine } This is called from the code as: $tracking->setCurrentDevGroup($this->ComputerID); // $this->ComputerID is // known as eg 5. In the page which relies on the value of setCurrentDevGroup I get: Call to a member function on a non-object in /www/htdocs/dev/include/irm.inc on line 2857 Line 2857 is the one starting "$tracking->" above. Obviously I'm doing something wrong here. What? Cheers, Martin S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multi Language support
Hello, I have a multi-lingual site and was wondering if anyone knew of a PHP function to detetct a browser's preferred laguages. I know I can parse it in the _SEREVR var [HTTP_ACCEPT_LANGUAGE] => fr, fr-ca;q=0.75, en-us;q=0.50, en;q=0.25 But I was just wondering if somewhere PHP already had a function. Something like: var array get_lang(); where array would be: "fr"=>0.75 "fr-ca"=>0.75 "en-us"=>0.50 "en"=>0.25 Also I'm guessing that q=? is a score of some sort. With highest score being the preferred one? Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
On Mon, 30 Dec 2002 04:11:02 -0700, you wrote: >The things that bothered me the most: > >o Pg doesn't have DATE_FORMAT() to_char() accomplishes the same thing, for example: select to_char(lastlogin, 'FMMM-DD- FMHH:MI AM') as lastloginf from users; >, or the types SET and ENUM. I'm not sure what SET is, never used it, but ENUM is totally unnecessary in Postgres because it supports foreign keys. If you want a particular field to only allow ENUM('red', 'blue', 'green') then create a lookup table, insert these values into it, and then set up a foreign key. This is more standard anyway, and if you need to update the set there is no need to touch the database schema. >o Changing database structure is harder. With PG, I usually found it > easier to dump, edit, then reload the database to make changes I did > in MySQL with ALTER TABLE. True, changing schema is a major PITA with Postgres. My only real complaint about it, in fact... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
> >o Pg doesn't have DATE_FORMAT() > to_char() accomplishes the same thing, for example: > select to_char(lastlogin, 'FMMM-DD- FMHH:MI AM') as lastloginf > from users; Unless I missed something, that function doesn't work with unix timestamps. Is there anythin internal to PG that allows you to convert to and from unix timestamps? >, or the types SET and ENUM. > >o Changing database structure is harder. With PG, I usually found it > > easier to dump, edit, then reload the database to make changes I did > > in MySQL with ALTER TABLE. > True, changing schema is a major PITA with Postgres. My only real > complaint about it, in fact... That's how I did it and it was, indeed, a pain in the butt... But there was some good that came out of it. When I created the MySQL tables, I didn't have foreign keys (wasn't using InnoDB), constraints or anything like that so in recreating the tables, I was able to implement those things to make life easier down the road when reworking the code and the logic. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function misfunction
On Mon, 30 Dec 2002 14:48:13 +0100, you wrote: >function setCurrentDevGroup($devID) >{ >// start original routine >$query = "SELECT dev_group FROM tracking WHERE (computer = > > > > > > > > > > > > >$devID)"; >$sth = $adb->prepare($query); [...] > Call to a member function on a non-object in >/www/htdocs/dev/include/irm.inc on line 2857 Just a guess, but where did $adb inside your function come from? It doesn't appear that you've instantiated it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
On Mon, 30 Dec 2002 07:57:04 -0600, you wrote: >> >o Pg doesn't have DATE_FORMAT() >> to_char() accomplishes the same thing, for example: >> select to_char(lastlogin, 'FMMM-DD- FMHH:MI AM') as lastloginf >> from users; > >Unless I missed something, that function doesn't work with unix timestamps. >Is there anythin internal to PG that allows you to convert to and from unix >timestamps? To convert TO a unix timestamp: select date_part('epoch', lastlogin) as lastloginf; or select extract(epoch from lastlogin) as lastloginf; To convert FROM a unix timestamp: select to_char(timestamp 'epoch' + unix_timestamp, 'FMMM-DD- FMHH:MI AM'); >That's how I did it and it was, indeed, a pain in the butt... But there was >some good that came out of it. When I created the MySQL tables, I didn't >have foreign keys (wasn't using InnoDB), constraints or anything like that >so in recreating the tables, I was able to implement those things to make >life easier down the road when reworking the code and the logic. And there is the major benefit of using Postgres...not to mention sub-selects, views, unions, etc. Once you get used to these things it's very hard to give them up. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] install problem
I don't see any errors there, just a couple of rather harmless warnings. On Mon, 30 Dec 2002, [EMAIL PROTECTED] wrote: > Hello ! > > I have problem with php-4.3.0 i can not install it on my 3 different rh7.0 servers. > > ./configure --prefix=/usr --with-config-file-path=/etc --disable-debug > --enable-pic --enable-shared --enable-inline-optimization --with-apxs=/usr/sbin/apxs > --with-exec-dir=/usr/bin --with-regex=system --with-gettext --with-gd > --with-jpeg-dir=/usr --with-png --with-zlib --with-zlib-dir=/usr/local/lib > --with-gdbm --enable-debugger --enable-magic-quotes --enable-safe-mode > --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars > --enable-yp --enable-ftp --enable-wddx --with-mysql > --without-oracle --without-oci8 --with-xml > > Errors: > > multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo >main/internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm >-ldl -lnsl -lcrypt -o sapi/cli/php > libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. > libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. > ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam': > /root/http_stuff/php/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of >`tempnam' is dangerous, better use `mkstemp' > > functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo >Zend/zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo >main/internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm >-ldl -lnsl -lcrypt -o sapi/cli/php > libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. > libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. > ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam': > /root/http_stuff/php/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of >`tempnam' is dangerous, better use `mkstemp' > > functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo >Zend/zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo >main/internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm >-ldl -lnsl -lcrypt -o sapi/cli/php > libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. > libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. > ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam': > /root/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of `tempnam' is >dangerous, better use `mkstemp' > > -- > Best regards, > gnu_is_not_unix > > --- > Konto bez op³at i prowizji? > TAK! eKONTO w mBanku! < http://pf.wp.pl/mbank.html > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] creating a .doc file in php
I am creating a 'vacation' scheduling webpage for my company. Currently, when we want a day off, we fill out a document in word and send it to our supervisor. The page I am working on will have a calendar that displays who is off when. I would like for the employees to click on a date, enter their information and then when the info is saved to the db, I would like to have the .doc automatically created with the info and sent to their supervisor. Is this possible?? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
On Monday 30 December 2002 21:33, Chris Boget wrote: > Due to writing this email *way* too early in the morning, I got > everything mixed up and didn't say what I meant. The below > is what I really meant. > > > Not sure what you're getting at here. Surely for any particular > > query, _you_ would know what table(s) is/are being used? > > That's not necessarily true. Certainly not if you are using an > abstraction layer to access the database. Take PEAR for > example. When instantiation on object, you give it the relevant > connection information. When you pass a query to the query() > there's no way (ok, there's a way but it isn't necessarily accurate) > to get the table name for the query that was just run... apart from > requiring the programmer to pass the table name as another > paramter to the query() method You can do this in mysql using > the mysql_tablename() function. > I just don't know why you can't do this in pgsql. Either you're confused or I'm confused :) mysql_tablename() is used in conjunction with mysql_list_tables() to get the names of the tables defined in the specified database. It cannot "get the table name for the query that was just run...". And another thing, you _know_ the query "that was just run", and presumably the tables used is part of the query itself, so why would you need another function to tell you should already know? Can you give an example of what you're trying to do? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Q: How did you get into artificial intelligence? A: Seemed logical -- I didn't have any real intelligence. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating a .doc file in php
My guess is that your best bet is creating either an HTML or RTF documents, both of which are readable by MS Word. RTF is well documented and it should be fairly easy to work with--you can save a template with placeholders and simply replace them, since it's entirely text-based. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! --- Begin Message --- I am creating a 'vacation' scheduling webpage for my company. Currently, when we want a day off, we fill out a document in word and send it to our supervisor. The page I am working on will have a calendar that displays who is off when. I would like for the employees to click on a date, enter their information and then when the info is saved to the db, I would like to have the .doc automatically created with the info and sent to their supervisor. Is this possible?? Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
> To convert TO a unix timestamp: > To convert FROM a unix timestamp: Excellent. Thank you very much for the info! > And there is the major benefit of using Postgres... Why do you think I decided to move to Postgres? :P > not to mention sub-selects, views, unions, etc. Indeed. And I'm going to take every advantage in using them in my code. I figure when all is said and done, the scripts will run so much faster because it won't have to be doing those things programatically. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Text repeating problem
> Anyone seen this before? Any suggestions/things to try? It's driving > me mad... I would strongly suggest using Apache 1.3.x instead of Apache 2. Apache2+PHP simply is nowhere near stable. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] include "problem" -- how to use an external 'template' file and still use PHP variables?
I have a similar question/problem. However, I want to use an external "email template" as it were, so that the sales guys can edit it as they like and simply shuffle the three variables around that they need $username, $password, $code (either with or without the tags). I don't want them mucking around in my code and potentially screwing it up. Not to mention having a huge 'email' text in between those HTMLMESSAGE markers is ugly as hell and ends up making the color-coding in HomeSite all kinds of whack at the end of it. I tried to use: $message = << in the customer_email.php the field is blank (like it's being parsed but doesn't have a value for it or something), instead of being converted to their actual PHP values. I also tried to put the "global" keyword in the customer_email.php file at the top. Is there no way to accomplish this? > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > > > Use a here-doc: > > echo << [$data] $titulo ($user) $intro $texto > (comentarios=$contador) > EOB; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
On Monday 30 December 2002 21:57, Chris Boget wrote: > > >o Pg doesn't have DATE_FORMAT() > > > > to_char() accomplishes the same thing, for example: > > select to_char(lastlogin, 'FMMM-DD- FMHH:MI AM') as lastloginf > > from users; > > Unless I missed something, that function doesn't work with unix timestamps. No, it only works on pg's date/time formats. > Is there anythin internal to PG that allows you to convert to and from unix > timestamps? Best to store date/time in pg's format rather than unix timestamp. If you've got legacy data which are stored as unix timestamps then you can do one of the following: 1) Do a one time conversion from unix timestamp to pg date/time 2) Manipulate the dates in PHP instead 3) Write your own function in pg to convert them on the fly -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Griffin's Thought: When you starve with a tiger, the tiger starves last. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function misfunction
On Monday 30 December 2002 22:07, Michael Sims wrote: > On Mon, 30 Dec 2002 14:48:13 +0100, you wrote: > >function setCurrentDevGroup($devID) > >{ > >// start original routine > >$query = "SELECT dev_group FROM tracking WHERE (computer = > > $devID)"; $sth = > > $adb->prepare($query); > > [...] > > > Call to a member function on a non-object in > >/www/htdocs/dev/include/irm.inc on line 2857 > > Just a guess, but where did $adb inside your function come from? It > doesn't appear that you've instantiated it. Specifically, if it's instantiated elsewhere in your code and it's in the global scope then you need to declare it as global within your function: function setCurrentDevGroup($devID) { global $adb; /// rest of function } -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Maybe we could paint GOLDIE HAWN a rich PRUSSIAN BLUE -- */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & PostgreSQL
> Either you're confused or I'm confused :) It's me. This just hasn't been a good week for me. :p One time I'll get it right! > mysql_tablename() is used in conjunction with mysql_list_tables() to get the > names of the tables defined in the specified database. It cannot "get the > table name for the query that was just run...". You are right. The function I was thinking of was mysql_field_table() I knew I should have consulted the documentation and not relied on my memory. :p > And another thing, you _know_ the query "that was just run", and presumably > the tables used is part of the query itself, That's not true in all cases. > so why would you need another function to tell you should already know? Can you > give an example of what you're trying to do? Sure. And this is what prompted my message initially. PEAR's sql2xml only works with mysql because there's no way to get the table name programatically. When you are using an abstraction such as this, unless you pass another argument to the primary function, you have to go through hoops within the abstraction just to pull it out of the query. The code for sql2xml can be found here: http://pear.php.net/package-info.php?pacid=18 Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] importing array from flash, how does PHP handle it?
Hi, I am sending information from Flash to PHP and ideally I just want to send an array. Would php treat the info as an array or a string? If it is the latter, is there a way that I can convert the information into an array? In Flash you can use the .split action but I'm not too sure of the PHP 4 equivalent. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] creating a .doc file in php
Thanks Marco, So I would just create the .rtf file with php, then store it on the server and attach it to the e-mail? Thanks, Eddie -Original Message- From: Marco Tabini [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 9:17 AM To: Edward Peloke Cc: [EMAIL PROTECTED] Subject: Re: [PHP] creating a .doc file in php My guess is that your best bet is creating either an HTML or RTF documents, both of which are readable by MS Word. RTF is well documented and it should be fairly easy to work with--you can save a template with placeholders and simply replace them, since it's entirely text-based. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 30 Dec 2002 15:34:19 -0000 Issue 1793
php-general Digest 30 Dec 2002 15:34:19 - Issue 1793 Topics (messages 129623 through 129672): Re: Dropping Tables 129623 by: Steve Buehler Re: imap_set_quota function 129624 by: Michael Sims Re: PHP 4.3 unable to load php_domxml.dll in WinXP Apache 2.0.43 129625 by: Davy Obdam Re: Problem with REQUIRE in PHP 4.3.0 129626 by: Bc. Radek Krejca Clear file or write to file erasing all old content 129627 by: Noodle Snacks 129628 by: jason perkins 129629 by: Noodle Snacks PHP and XML parser (expat) 129630 by: Lasse Tarp HTML module problem under Linux/APache2.0 129631 by: Tiziano Crimella 129632 by: Leif K-Brooks 129633 by: Tiziano Crimella 129634 by: Jason k Larson Auto_incerement value 129635 by: Cesar Aracena 129636 by: Jason k Larson 129637 by: Rick Widmer Serializing a DOM object 129638 by: Boget, Chris PHP & PostgreSQL 129639 by: Boget, Chris 129640 by: Jason Wong 129643 by: Boget, Chris 129644 by: Jason Wong 129645 by: Rick Widmer 129647 by: Rick Widmer 129648 by: Jason Wong 129650 by: Boget, Chris 129654 by: Boget, Chris 129657 by: Michael Sims 129658 by: Boget, Chris 129660 by: Michael Sims 129663 by: Jason Wong 129665 by: Boget, Chris 129668 by: Jason Wong 129670 by: Boget, Chris Zerofill 129641 by: Cesar Aracena 129642 by: Jason k Larson 129649 by: Rudolf Visagie usort crashes 129646 by: CeeGee Text repeating problem 129651 by: Simon Hay 129666 by: Rasmus Lerdorf install problem 129652 by: gnu_is_not_unix.wp.pl 129661 by: Rasmus Lerdorf help-regarding installation 129653 by: celia rexselin function misfunction 129655 by: Martin S 129659 by: Michael Sims 129669 by: Jason Wong Multi Language support 129656 by: Michael J. Pawlowsky creating a .doc file in php 129662 by: Edward Peloke 129664 by: Marco Tabini 129672 by: Edward Peloke Re: include "problem" -- how to use an external 'template' file and still use PHP variables? 129667 by: Daevid Vincent importing array from flash, how does PHP handle it? 129671 by: Gav 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] -- --- Begin Message --- Thank You so much John and Michael. SHOW TABLES LIKE 'a%' worked like a charm and was exactly what I was looking for. I guess my searches were using the wrong keywords. Kind of figures. Some of my searches were turning up 1000's of results. How do you know whether it's an "active" a* table or not? Will you be dropping a table that someone is actually using? I will be shutting down the script at a certain time each day to run some things like this for maintenance. So none of these should be active and if they are, it won't hurt anything. The customer can just wait until the maintenance time is over. Approximately 10 mintues. At 10:21 PM 12/29/2002 -0500, you wrote: > Basically just do a a php script the sends the sql "show tables"; > > Then do a strchr() to see if "a" is the first letter in the resuts and if > so do a delete table. > > Just yo play safe do a dump of your db first. Or even better, use SHOW TABLES LIKE 'a%' to just get the a* tables and drop each one. How do you know whether it's an "active" a* table or not? Will you be dropping a table that someone is actually using? ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ow3 --- End Message --- --- Begin Message --- On Sun, 29 Dec 2002 18:26:01 -0800 (PST), you wrote: >"This function requires the imap_stream to have been opened as the mail >administrator account. It will not work if opened as any other user. [...] >my question is, where do i set this admin called 'mailadmin' with password >'password'. do i set it in courier/uw for example? Yes, you need to give imap_set_quota() a username and password of an account that has administrator privileges on your IMAP server. If you were using Cyrus IMAP you'd use an account that's specified in the "admins" section of /etc/imapd.conf. I don't know how this is handled in Courier or UW, but I assume the mechanisms are similar. I suggest checking
RE: [PHP] importing array from flash, how does PHP handle it?
As an array. However, you can test this in the page that receives the post with fallowing code: foreach($_POST as $val => $key) { echo $val." => ".$key.""; } Regards, Sumarlidi E. Dadason SED - Graphic Design _ E-mail: [EMAIL PROTECTED] website: www.sed.is -Original Message- From: Gav [mailto:[EMAIL PROTECTED]] Sent: 30. desember 2002 15:08 To: [EMAIL PROTECTED] Subject: [PHP] importing array from flash, how does PHP handle it? Hi, I am sending information from Flash to PHP and ideally I just want to send an array. Would php treat the info as an array or a string? If it is the latter, is there a way that I can convert the information into an array? In Flash you can use the .split action but I'm not too sure of the PHP 4 equivalent. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] creating a .doc file in php
Yep. There should be a few SMTP/Email composing classes that can help you with the attachment part. Just remember to delete your temp file once you're done and you should be fine. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! --- Begin Message --- Thanks Marco, So I would just create the .rtf file with php, then store it on the server and attach it to the e-mail? Thanks, Eddie -Original Message- From: Marco Tabini [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 9:17 AM To: Edward Peloke Cc: [EMAIL PROTECTED] Subject: Re: [PHP] creating a .doc file in php My guess is that your best bet is creating either an HTML or RTF documents, both of which are readable by MS Word. RTF is well documented and it should be fairly easy to work with--you can save a template with placeholders and simply replace them, since it's entirely text-based. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] creating a .doc file in php
thanks, I will give it a shot! Thanks, Eddie -Original Message- From: Marco Tabini [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 10:26 AM To: Edward Peloke Cc: [EMAIL PROTECTED] Subject: RE: [PHP] creating a .doc file in php Yep. There should be a few SMTP/Email composing classes that can help you with the attachment part. Just remember to delete your temp file once you're done and you should be fine. Cheers, Marco -- php|architect - The Monthly Magazine for PHP Professionals Come check us out on the web at http://www.phparch.com! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Alternatives for Meta Refresh
I'm writing a PHP chat script and I'm rather stumped on this. I either want the chat window to refresh when there's a new message or refresh every few seconds but not with meta refresh, rather something with less noise (the infamous IE clicking sound) and/or something faster. The only thing I can think of is the header function. Any ideas? Thanks,Stephen Cratonhttp://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Round robin script revisited..
I was trying to find a script to do round robin pairings for a sports schedule generator.. I was able to come across one in Perl, and am in the process of trying to convert it to PHP, but since my perl knowledge is a bit (well, a lot) lacking, I was hoping someone could help.. Perl script: http://www.perlmonks.org/index.pl?parent=90132&title=Round%20Robin%20Schedul ing&lastnode_id=90132&displaytype=display&type=superdoc&node=Comment%20on The part I'm having trouble with: for(1..($size-$even)) { my @this_week; # push the weeks worth of games onto @games foreach my $sched_ref (@stripes) { push (@this_week, [$teams[$sched_ref->[0]], $teams[$sched_ref- +>[1]]]); } push(@games, \@this_week); I'm not sure how to rewrite that in PHP and be pushing the correct array elements into the games array .. If anyone can help me out or point me in the right direction, I'd appreciate it. Thanks, Chad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php+html help
Hello friends, I have the following php output line that works fine : Print "Organisation name : ".$row[OrgName]."\n".""; However, I want this line to be in bold, red and size=5. I tried the following code but fails. Can someone please tell me what is wrong? Print "Organisation name : .$row[OrgName]."\n".""; Thanks Denis
[PHP] send page with https and php sessions problem
I have problem with sending pages directly(by Send->Page by E-mail...) from browser(ie6) with Outlook 2002. It tells:"The current document type can not be sent as mail.Would you like to send a Short cut instead?". The pages use php sessions and https with 128 bit encryption. I found that it is caused by the combination of https and php session. Is there a solution? Thanks in advance. Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php+html help
Print "Organisation name : .$row[OrgName]."\n".""; - Original Message - From: "Denis L. Menezes" <[EMAIL PROTECTED]> To: "PHP general list" <[EMAIL PROTECTED]> Sent: Monday, December 30, 2002 11:10 AM Subject: [PHP] php+html help Hello friends, I have the following php output line that works fine : Print "Organisation name : ".$row[OrgName]."\n".""; However, I want this line to be in bold, red and size=5. I tried the following code but fails. Can someone please tell me what is wrong? Print "Organisation name : .$row[OrgName]."\n".""; Thanks Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function misfunction
Besides what Michael and jason said, you seem not have the $tracking initialized (it is not an object). You need to call $tracking=new tracking(); somewhere in your code. Martin S wrote: I'm trying to redo a db lookup into a function. The function is placed in a class called tracking and declared thus: function setCurrentDevGroup($devID) { // start original routine $query = "SELECT dev_group FROM tracking WHERE (computer = $devID)"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $resulttable = $sth->fetchrow_hash(); $lookuptable = $resulttable["dev_group"]; return($lookuptable); } //end original routine } This is called from the code as: $tracking->setCurrentDevGroup($this->ComputerID); // $this->ComputerID is // known as eg 5. In the page which relies on the value of setCurrentDevGroup I get: Call to a member function on a non-object in /www/htdocs/dev/include/irm.inc on line 2857 Line 2857 is the one starting "$tracking->" above. Obviously I'm doing something wrong here. What? Cheers, Martin S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Warning?
Hi everyone, I'm using Dreamweaver to create an insert page and after the record is inserted I receive this error: Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site8/fst/var/www/html/admin_gs/products_insert.php:2) in /home/virtual/site8/fst/var/www/html/admin_gs/products_insert.php on line 62 Line 58 - 62 is as follows: if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); This same code works in my update page without an error. If you can help, thank you Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php+html help
still you forgot " ;-) Print "Organisation name : ".$row[OrgName]."\n"; R'twick Niceorgaw wrote: Print "Organisation name : size=\"5\">.$row[OrgName]."\n".""; - Original Message - From: "Denis L. Menezes" <[EMAIL PROTECTED]> To: "PHP general list" <[EMAIL PROTECTED]> Sent: Monday, December 30, 2002 11:10 AM Subject: [PHP] php+html help Hello friends, I have the following php output line that works fine : Print "Organisation name : ".$row[OrgName]."\n".""; However, I want this line to be in bold, red and size=5. I tried the following code but fails. Can someone please tell me what is wrong? Print "Organisation name : size="5">.$row[OrgName]."\n".""; Thanks Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Warning?
You can't have any text output to the browser before a redirect. Make sure you have nothing abouve line 58 echoing out text (specifically whatever is in line 2, judging by your error) .. I believe I've had the problem when I've included a file where the 1st line was blank, so you may want to check that as well.. Chad -Original Message- From: Doug Coning [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 12:25 PM To: php general Subject: [PHP] Warning? Hi everyone, I'm using Dreamweaver to create an insert page and after the record is inserted I receive this error: Warning: Cannot add header information - headers already sent by (output started at /home/virtual/site8/fst/var/www/html/admin_gs/products_insert.php:2) in /home/virtual/site8/fst/var/www/html/admin_gs/products_insert.php on line 62 Line 58 - 62 is as follows: if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); This same code works in my update page without an error. If you can help, thank you Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Warning?
Never mind. http://www.agner.org/messageboards/docs/read-me.txt says that if there is a space before the http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multi-lingual Language Support in PHP
Keywords: Multiple, Language, PHP, $HTTP_ACCEPT_LANGUAGE I'm just shooting this one up here for the Archives. Since I could not find a built in PHP function to access the preferred languages on a user I came up with this. The original version acted as a http server in that you needed to have a different file for evey language (ie. index.php.en, index.php.fr, index.php.de). I find that's a complicated way to work since if you need to update code you will have to do it in several files. I prefer simply if (phpLang_current == 'fr') { print "Ceci est francais"; } else ( // default to english print "This is english"; } If it's a large block of text you can have seperate include text files as in. if (phpLang_current == 'fr') { include("mytext.fr"); } else ( // default to english include("mytext.en"); } So in case anyone else ever needs this... Here it is... http://www.gnu.org/copyleft/gpl.html | // +--+ // | Original release available on phpHeaven: | // |http://www.phpheaven.net/rubrique7.html?var_recherche=phpLang | // | | // | Authors: Nicolas Hoizey <[EMAIL PROTECTED]> | // | Loïc Chapeaux <[EMAIL PROTECTED]> | // +--+ // parameter to add in url if(!defined('phpLang_urlParam')) define('phpLang_urlParam', 'lang'); // path to image files if(!defined('phpLang_images')) define('phpLang_images', '/flags/'); // indicates if it should put a cookie if(!defined('phpLang_useCookie')) define('phpLang_useCookie', true); // list of available languages, order it as you need $phpLang_languages = array( "en([-_][[:alpha:]]{2})?|english" => array('en', 'english'), "fr([-_][[:alpha:]]{2})?|french"=> array('fr', 'french'), ); $HTTP_ACCEPT_LANGUAGE = getenv('HTTP_ACCEPT_LANGUAGE'); $HTTP_USER_AGENT = getenv('HTTP_USER_AGENT'); // language code detection function phpLang_detectLanguage($str, $from) { $ext = ''; reset($GLOBALS['phpLang_languages']); while($ext == '' && list($key, $name) = each($GLOBALS['phpLang_languages'])) { if (($from == 1 && eregi("^".$key."$",$str)) || ($from == 2 && eregi("(\(|\[|;[[:space:]])".$key."(;|\]|\))",$str))) { $ext = $name[0]; } } return $ext; } // finds the appropriate language file if (isset($HTTP_GET_VARS[phpLang_urlParam])) { // a language as been chosen by the user define('phpLang_current', $HTTP_GET_VARS[phpLang_urlParam]); } if (!defined('phpLang_current') && phpLang_useCookie && isset($HTTP_COOKIE_VARS['phpLangCookie'])) { // a language as been found in a cookie previously set define('phpLang_current', $HTTP_COOKIE_VARS['phpLangCookie']); } if (!defined('phpLang_current') && isset($HTTP_ACCEPT_LANGUAGE) && trim($HTTP_ACCEPT_LANGUAGE) != '') { // looks at the languages accepted by the browser $accepted = explode(',', $HTTP_ACCEPT_LANGUAGE); while(!defined('phpLang_current') && list($key, $name) = each($accepted)) { $code = explode(';', $name); $ext = phpLang_detectLanguage($code[0], 1); if(file_exists(phpLang_localizedFileName($ext))) { define('phpLang_current', $ext); } } } if (!defined('phpLang_current') && isset($HTTP_USER_AGENT) && trim($HTTP_USER_AGENT) != '') { // looks at the browser's identification $ext = phpLang_detectLanguage($HTTP_USER_AGENT, 2); define('phpLang_current', $ext); } if(!defined('phpLang_current')) { // if no language yet found, chose the first existing in site's list reset($phpLang_languages); while(!defined('phpLang_current') && list($key, $name) = each($phpLang_languages)) { define('phpLang_current', $name[0]); } } // detection done, cookie update if(defined('phpLang_current')) { if(phpLang_useCookie) { // set a cookie expiring in one year for current language setcookie('phpLangCookie', phpLang_current, time() + 60*60*24*365, "/", "rconline.ca"); } // defines a string to add at the end of each link define('phpLang_link', phpLang_urlParam.'='.phpLang_current); } else { // no language found define('phpLang_current', ''); define('phpLang_link', phpLang_urlParam.'='); } // function that adds the flags with links for existing files // give as first parameter the HTML stri
Re: [PHP] Serializing a DOM object
> In the test function, if I just serialize the $xml, return it and then call > xmldoc_open_mem on the unserialized return string, it works fine. > But it doesn't like it if I do the above. I'm getting the error: > > Warning: dump_mem() [function.dump-mem]: Underlying object missing > or of invalid type > Warning: dump_mem() [function.dump-mem]: Cannot fetch DOM object > > Why isn't the serialization of the DOM object not working that way? I just had a thought... Is it because the DOM structure of the XML document is stored only in the memory for the page? And the pointer to that memory isn't transferred when the DOM object is serialized, stored and retrieved? Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Continued story on : PHP includes without access to the default directory//Tom Rogers//
Hi, original messagethread on dec 6, 2002, but still have following question on same/continued subject by Tom Rogers:(see below) Like you say it works (with the correction) "." for which my thanks, but: if one my includes is a menu.php where there are links inside, how should these work from rootdirectory and from subdirectories. for rootfilelinks they now just say f.i. index.php, but when called from inside a subdirectories they are supposed to say /index.php. Any solutions for this one?? thanks Martin =Original Posting=== Saturday, December 7, 2002, 7:15:38 AM, you wrote: >> ini_set G> ("include_path","/path/to/local/includes:"ini_get("include_path")); >> >> Then no matter what directory you are in you can just include("filename"); >> >> -- >> regards, >> Tom >> G> Thank you. This should work, but I have one question about the format of G> that. this way I can make sure I do things right (getting a parse error G> right now) G> what did you mean by "include_path"? G> /path/to/local/includes is just the path to the default includes folder? G> and is include_path just the path to the includes folder that I use. And G> with this, do I use the URL, or the file path (what I get whenever I get G> errors) G> and thank you again Looks like I forgot a '.' in there :) "/path/to/local/includes:" is the path to your new includes, we do that first so that is the first place it will look . The ':' is used to add in another path which we use ini_get() to retrieve the system wide include file from php.ini. You may drop this and the ':' if you don't need it. so if you are setup like this for example /home/username/public_html/...web directory /home/username/includes/..your include directory the line would be ini_set("include_path","/home/username/includes:".ini_get("include_path")); -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Great solution, but... another question
Like you say it works (with the correction) "." for which my thanks, but: if one my includes is a menu.php where there are links inside, how should these work from rootdirectory and from subdirectories. for rootfilelinks they now just say f.i. index.php, but when called from inside a subdirectories they are supposed to say /index.php. Any solutions for this one?? thanks Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Continued story on : PHP includes without access to the default directory//Tom Rogers//
Just use absolute paths. If your webserver is looking at the root directory, /index.phtml and index.phtml are the same file Matt - Original Message - From: WMB <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 30, 2002 12:03 PM Subject: [PHP] Continued story on : PHP includes without access to the default directory//Tom Rogers// > Hi, original messagethread on dec 6, 2002, but still have following question > on same/continued subject by Tom Rogers:(see below) > > Like you say it works (with the correction) "." for which my thanks, but: > > if one my includes is a menu.php where there are links inside, how should > these work from rootdirectory and from subdirectories. > for rootfilelinks they now just say f.i. index.php, but when called from > inside a subdirectories they are supposed to say /index.php. > > Any solutions for this one?? > thanks > Martin > =Original Posting=== > Saturday, December 7, 2002, 7:15:38 AM, you wrote: > > >> ini_set > G> ("include_path","/path/to/local/includes:"ini_get("include_path")); > >> > >> Then no matter what directory you are in you can just > include("filename"); > >> > >> -- > >> regards, > >> Tom > >> > > G> Thank you. This should work, but I have one question about the format of > G> that. this way I can make sure I do things right (getting a parse error > G> right now) > > G> what did you mean by "include_path"? > G> /path/to/local/includes is just the path to the default includes folder? > G> and is include_path just the path to the includes folder that I use. And > G> with this, do I use the URL, or the file path (what I get whenever I get > G> errors) > > G> and thank you again > Looks like I forgot a '.' in there :) > "/path/to/local/includes:" is the path to your new includes, we do that > first so > that is the first place it will look . The ':' is used to add in another > path > which we use ini_get() to retrieve the system wide include file from > php.ini. > You may drop this and the ':' if you don't need it. > > so if you are setup like this for example > > /home/username/public_html/...web directory > /home/username/includes/..your include directory > > the line would be > > ini_set("include_path","/home/username/includes:".ini_get("include_path")); > > -- > regards, > Tom > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function misfunction
Jason Wong wrote: > On Monday 30 December 2002 22:07, Michael Sims wrote: >> On Mon, 30 Dec 2002 14:48:13 +0100, you wrote: >> >function setCurrentDevGroup($devID) >> >{ >> >// start original routine >> >$query = "SELECT dev_group FROM tracking WHERE (computer >> >= >> > $devID)"; $sth >> > = >> > $adb->prepare($query); >> >> [...] >> >> > Call to a member function on a non-object in >> >/www/htdocs/dev/include/irm.inc on line 2857 >> >> Just a guess, but where did $adb inside your function come from? It >> doesn't appear that you've instantiated it. > > Specifically, if it's instantiated elsewhere in your code and it's in the > global scope then you need to declare it as global within your function: > > function setCurrentDevGroup($devID) { >global $adb; >/// rest of function > } Yes, that was it. And also that I had misplaced the function in my gigantic include file. Now it does what it is supposed to do, almost. function setCurrentDevGroup($devID) { $query = "SELECT dev_group FROM tracking WHERE (computer = $devID)"; $sth = $adb->prepare($query); if($sth) { $res = $sth->execute(); $resulttable = $sth->fetchrow_hash(); $lookuptable = $resulttable["dev_group"]; //I do get a value for lookuptable here, eg printers. return($lookuptable); } } But the value of $lookuptable isn't used in switch ($lookuptable) { case "computers": $query = "SELECT name FROM computers WHERE (ID = $this->ComputerID)"; break; case "printers": $query = "SELECT name FROM printers WHERE (ID = $this->ComputerID)"; break; } (And yes I suppose you could write that as "SELECT name from $lookuptable WHERE "; What am I missing now? /Martin S. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SELECTing a row by maximum value
Hi, What would be a query to select a single record from a number of records in a table, depending on which one has the biggest value in an integer field? e.g something like: MYTABLE id ifield 1100 2200 3150 SELECT * FROM MYTABLE WHERE id=$id and MAX(ifield) should return id=2, ifield=200 (but this doesn't work, of course) Many thanks, Richard
RE: [PHP] Round robin script revisited..
Ok, after some more fiddling, I'm really close to getting this to work. The script seems to correctly generate a schedule if an odd number of teams are specified: Given an array of 5 teams, A through E, the following pairs are generated: Round 1 - A/E, B/D Round 2 - D/E, A/C Round 3 - C/D, B/E Round 4 - B/C, A/D Round 5 - A/B, C/E Looks good.. each team gets a bye, each team plays each other. With an even number of teams however, some pairings are repeated, and I'm sure this is a bug I created when translating the code from perl to PHP. The PHP code I have is below, the link to the perl source is (http://www.perlmonks.org/index.pl?parent=90132&title=Round%20Robin%20Schedu ling&lastnode_id=90132&displaytype=display&type=superdoc&node=Comment%20on), and the set of pairings I get with 6 teams, A through F is below. 6 teams, A/F Round 1 - A/E, B/D, C/F Round 2 - F/D, A/C, B/E Round 3 - E/C, F/B, A/D Round 4 - D/B, E/A, F/C (dupe of round 1) Round 5 - C/A, D/F, E/B (dupe of round 2) PHP code: Array Order: "; // for ($z = 0; $z < sizeof($teamarray); $z++) { // echo $teamarray[$z]; // } /* if ($even) { array_push($teamarray, $last_team); } */ } // echo ''; print_r($games); ?> -Original Message- From: Chad Day [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 10:57 AM To: php general Subject: [PHP] Round robin script revisited.. I was trying to find a script to do round robin pairings for a sports schedule generator.. I was able to come across one in Perl, and am in the process of trying to convert it to PHP, but since my perl knowledge is a bit (well, a lot) lacking, I was hoping someone could help.. Perl script: http://www.perlmonks.org/index.pl?parent=90132&title=Round%20Robin%20Schedul ing&lastnode_id=90132&displaytype=display&type=superdoc&node=Comment%20on The part I'm having trouble with: for(1..($size-$even)) { my @this_week; # push the weeks worth of games onto @games foreach my $sched_ref (@stripes) { push (@this_week, [$teams[$sched_ref->[0]], $teams[$sched_ref- +>[1]]]); } push(@games, \@this_week); I'm not sure how to rewrite that in PHP and be pushing the correct array elements into the games array .. If anyone can help me out or point me in the right direction, I'd appreciate it. Thanks, Chad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] install problem - cd ... and compilation aborts
.. and compilation aborts. ps. i forgot to tell You - sorry ! greetz gnu is not unix Copy of first message: I have problem with php-4.3.0 i can not install it on my 3 different rh7.0 servers. ./configure --prefix=/usr --with-config-file-path=/etc --disable-debug --enable-pic --enable-shared --enable-inline-optimization --with-apxs=/usr/sbin/apxs --with-exec-dir=/usr/bin --with-regex=system --with-gettext --with-gd --with-jpeg-dir=/usr --with-png --with-zlib --with-zlib-dir=/usr/local/lib --with-gdbm --enable-debugger --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-yp --enable-ftp --enable-wddx --with-mysql --without-oracle --without-oci8 --with-xml Errors: multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo main/ internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm - ldl -lnsl -lcrypt -o sapi/cli/php libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam': /root/http_stuff/php/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of `tempnam' is dangerous, better use `mkstemp' functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/ zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo main/ internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm - ldl -lnsl -lcrypt -o sapi/cli/php libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam': /root/http_stuff/php/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of `tempnam' is dangerous, better use `mkstemp' functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo Zend/ zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo main/ internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm - ldl -lnsl -lcrypt -o sapi/cli/php libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. libtool: link: warning: library `/usr/lib/libgdbm.la' was moved. ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam': /root/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of `tempnam' is dangerous, better use `mkstemp' --- LUKAS e-Konto PRO. Wysokie oprocentowanie, 1000 darmowych bankomatów, internet, telefon, placówki. Załóż konto http://lukasbank.pl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Round robin script revisited..
Nevermind, I found the bug. End of the code should be: # Now rotate the @teams array # Save the last team as the pivot for the polygon if ($even) { $last_team_save = array_pop($teamarray); } $last_team = array_pop($teamarray); array_unshift($teamarray, $last_team); if ($even) { array_push($teamarray, $last_team_save); } Hope this helps anyone else who needs it. Chad -Original Message- From: Chad Day [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 2:03 PM To: php general Subject: RE: [PHP] Round robin script revisited.. Ok, after some more fiddling, I'm really close to getting this to work. The script seems to correctly generate a schedule if an odd number of teams are specified: Given an array of 5 teams, A through E, the following pairs are generated: Round 1 - A/E, B/D Round 2 - D/E, A/C Round 3 - C/D, B/E Round 4 - B/C, A/D Round 5 - A/B, C/E Looks good.. each team gets a bye, each team plays each other. With an even number of teams however, some pairings are repeated, and I'm sure this is a bug I created when translating the code from perl to PHP. The PHP code I have is below, the link to the perl source is (http://www.perlmonks.org/index.pl?parent=90132&title=Round%20Robin%20Schedu ling&lastnode_id=90132&displaytype=display&type=superdoc&node=Comment%20on), and the set of pairings I get with 6 teams, A through F is below. 6 teams, A/F Round 1 - A/E, B/D, C/F Round 2 - F/D, A/C, B/E Round 3 - E/C, F/B, A/D Round 4 - D/B, E/A, F/C (dupe of round 1) Round 5 - C/A, D/F, E/B (dupe of round 2) PHP code: Array Order: "; // for ($z = 0; $z < sizeof($teamarray); $z++) { // echo $teamarray[$z]; // } /* if ($even) { array_push($teamarray, $last_team); } */ } // echo ''; print_r($games); ?> -Original Message- From: Chad Day [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 10:57 AM To: php general Subject: [PHP] Round robin script revisited.. I was trying to find a script to do round robin pairings for a sports schedule generator.. I was able to come across one in Perl, and am in the process of trying to convert it to PHP, but since my perl knowledge is a bit (well, a lot) lacking, I was hoping someone could help.. Perl script: http://www.perlmonks.org/index.pl?parent=90132&title=Round%20Robin%20Schedul ing&lastnode_id=90132&displaytype=display&type=superdoc&node=Comment%20on The part I'm having trouble with: for(1..($size-$even)) { my @this_week; # push the weeks worth of games onto @games foreach my $sched_ref (@stripes) { push (@this_week, [$teams[$sched_ref->[0]], $teams[$sched_ref- +>[1]]]); } push(@games, \@this_week); I'm not sure how to rewrite that in PHP and be pushing the correct array elements into the games array .. If anyone can help me out or point me in the right direction, I'd appreciate it. Thanks, Chad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SELECTing a row by maximum value
TRY: SELECT id,Max(ifield) from MYTABLE. What I don't understand is why you specify id=$id in the where clause. If you already specify the id as let say 1 then the max for that id will be 100 from your example below. "Richard Fox" <[EMAIL PROTECTED]> wrote in message 003901c2b034$0c563740$0700a8c0@mygroup">news:003901c2b034$0c563740$0700a8c0@mygroup... Hi, What would be a query to select a single record from a number of records in a table, depending on which one has the biggest value in an integer field? e.g something like: MYTABLE id ifield 1100 2200 3150 SELECT * FROM MYTABLE WHERE id=$id and MAX(ifield) should return id=2, ifield=200 (but this doesn't work, of course) Many thanks, Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem including a file
I have an include line in all the php files i write something like --> include('connection.inc'); The include path is d:\includes. (win nt 4, php 3.0.11) It worked fine before but today failed to open the include file. Does anyone has a clue about what could cause this problem? Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SELECTing a row by maximum value
You cannot mix grouping columns without a group by clause. This would work: SELECT * FROM MYTABLE order by ifield desc limit 1 Elna Moorhouse wrote: TRY: SELECT id,Max(ifield) from MYTABLE. What I don't understand is why you specify id=$id in the where clause. If you already specify the id as let say 1 then the max for that id will be 100 from your example below. "Richard Fox" <[EMAIL PROTECTED]> wrote in message 003901c2b034$0c563740$0700a8c0@mygroup">news:003901c2b034$0c563740$0700a8c0@mygroup... Hi, What would be a query to select a single record from a number of records in a table, depending on which one has the biggest value in an integer field? e.g something like: MYTABLE id ifield 1100 2200 3150 SELECT * FROM MYTABLE WHERE id=$id and MAX(ifield) should return id=2, ifield=200 (but this doesn't work, of course) Many thanks, Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.3 JPG Support. Whats needed?
Hello, I'm trying to upgrade to php4.3 on a cobalt raq4 I have 4.1.2 with gd 1.6, but would like to use gd 2.0 Compiled 4.3 from source, everything seems to be fine except the JPG Support. http://www.kende.com/phpinfo.php './configure' '--prefix=/usr' '--with-apxs=/usr/sbin/apxs' '--with-gd' '--with-gettext=/usr' '--enable-safe-mode' '--with-config-file-path=/etc/httpd' '--with-exec-dir=/usr/bin' '--with-zlib' '--with-mysql' '--enable-magic-quotes' '--with-regex=system' '--with-ttf' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-track-vars' '--enable-wddx=shared' '--enable-mm=shared' '--enable-xml' '--enable-ftp' '--disable-debug' '--with-libdir=/usr/lib' '--with-ldap' '--with-imap-ssl' '--with-pdflib=shared' Can you tell me what's required for JPG Support? ./configure ?? Thanks :) Andras Kende -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem including a file
- Original Message - From: "Omar" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 30, 2002 1:32 PM Subject: [PHP] problem including a file > I have an include line in all the php files i write > something like --> include('connection.inc'); > The include path is d:\includes. (win nt 4, php 3.0.11) It worked fine > before but today failed to open the include file. > Does anyone has a clue about what could cause this problem? > Thank you. > Hello Omar, What error did you recieve? Tyler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: fOpen in append mode on a FTP Server
To see the error in action go to http://www.moorhouse.co.za/test.php Please help! Thanks "Elna Moorhouse" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... What I want to do is very simple, I have a txt file on a ftp server, that contains the number of visits to my site. I manage to open the file with "fopen($filename,"r+"), but the information is not written to the file. I know that on a ftp server one can only open a file with fopen for read OR write, so I have changed the fOpen to "fopen($filename,"a") or fopen($filename,"w") . This does not work as I am getting a warning message that the file already exist and fopen fails. My ISP did not compile PHP with FTP enabled, so I can not use an FTP session to delete the file before attempting to write to the file. Is there any other way of deleting the file, without using an FTP session. Below is an extract from my code, if it will help: ftp://myuser:[EMAIL PROTECTED]/folder/Counter.txt";; $sOutput = "12345" $file = fopen ($sFileName, 'r+'); if (!$file) { echo "Unable to open hitcounter file - File is temporary unavailable\n"; return $result; } $written = fwrite($file, $sOutput); if ($written <= 0) { echo "Unable to write hitcounter, file is temporary unavailable\n"; fclose($file); return $result; } fclose($file); ?> With mode = r+, I get a $written as 22, but it is not written to the file With mode = a or w, fopen fails. I have been trying to get this resolved for some time now and can not get it to work. I am a novice PHP writer, please help!
[PHP] PHP scripts resulting in stderr ?
Hi, This is more of a unix/linux question. but i guess somebody will be able to help me here. Can a command-line PHP script result in a stderr output in any circumstances, or does it only generate only stdout ? One can use 2>&1 to redirect stderr to stdout, will this work with PHP command-line scripts too ? Thx gamin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SELECTing a row by maximum value
Sorry, I forgot to add the group by clause. Both will work fine. "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You cannot mix grouping columns without a group by clause. This would work: > > SELECT * FROM MYTABLE order by ifield desc limit 1 > > > > Elna Moorhouse wrote: > > >TRY: > >SELECT id,Max(ifield) from MYTABLE. > > > >What I don't understand is why you specify id=$id in the where clause. If > >you already specify the id as let say 1 then the max for that id will be 100 > >from your example below. > > > > > >"Richard Fox" <[EMAIL PROTECTED]> wrote in message > >003901c2b034$0c563740$0700a8c0@mygroup">news:003901c2b034$0c563740$0700a8c0@mygroup... > >Hi, > > > >What would be a query to select a single record from a number of records in > >a table, depending on which one has the biggest value in an integer field? > > > >e.g something like: > > > >MYTABLE > > > >id ifield > >1100 > >2200 > >3150 > > > >SELECT * FROM MYTABLE WHERE id=$id and MAX(ifield) > > > >should return id=2, ifield=200 > > > >(but this doesn't work, of course) > > > >Many thanks, > > > >Richard > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiple forms
Hi all, I have an update page that has a form in it. However, I want to add another form in the same page. My current form acts upon itself (i.e. Action = the same page). If I set up another form to do the same, how would my PHP determine with action submit button was acted upon? Currently, for the single form here is how it knows a form was submitted: if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) { How would I test which form submitted the action? Thanks and if I didn't make myself clear, I apologize. Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple forms
- Original Message - From: "Doug Coning" <[EMAIL PROTECTED]> To: "php-general" <[EMAIL PROTECTED]> Sent: Monday, December 30, 2002 3:26 PM Subject: [PHP] Multiple forms > Hi all, > > I have an update page that has a form in it. > > However, I want to add another form in the same page. My current form acts > upon itself (i.e. Action = the same page). If I set up another form to do > the same, how would my PHP determine with action submit button was acted > upon? > > Currently, for the single form here is how it knows a form was submitted: > > if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] > == "form1")) { > > How would I test which form submitted the action? > > Thanks and if I didn't make myself clear, I apologize. > > Doug > Hi Doug, I handle it like this (I think): Then, to process your form: I haven't done this in a while though, so this may not work for you. Good luck, Tyler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple forms
You should be able to insert a hidden field in your form and that check against that in your PHP script to determine which (if any) of your form was submitted: in your script: --- Begin Message --- Hi all, I have an update page that has a form in it. However, I want to add another form in the same page. My current form acts upon itself (i.e. Action = the same page). If I set up another form to do the same, how would my PHP determine with action submit button was acted upon? Currently, for the single form here is how it knows a form was submitted: if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) { How would I test which form submitted the action? Thanks and if I didn't make myself clear, I apologize. Doug -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Multiple forms
> I have an update page that has a form in it. > > However, I want to add another form in the same page. My current form > acts > upon itself (i.e. Action = the same page). If I set up another form to do > the same, how would my PHP determine with action submit button was acted > upon? > > Currently, for the single form here is how it knows a form was submitted: > > if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] > == "form1")) { > > How would I test which form submitted the action? > > Thanks and if I didn't make myself clear, I apologize. Just name each submit button something different. The program could check for $_POST['MM_update'] to process the first form, or $_POST['MM_update2'] to update the second. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple forms
On Mon, 30 Dec 2002, Doug Coning wrote: > However, I want to add another form in the same page. My current form acts > upon itself (i.e. Action = the same page). If I set up another form to do > the same, how would my PHP determine with action submit button was acted > upon? Give your submit buttons names and values, then you can check the button element's value as submitted and made available in $_POST. i.e. - In your HTML (notice the button /names/ are the same) : And in your PHP: if( $_POST['submitButton'] == "form1" ){ // do something for form 1; } elseif( $_POST['submitButton'] == "form2" ){ // do something for form 2; } else { // some tardnugget is playing games with your form ;) } There are several variations on this ... hope this one helps. g.luck, ~Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] rtf....I knew it couldn't be this easy
Ok, I took a word document, saved it as an rtf then opened the document in a text editor so that I could see all the rtf code. I then added this code to my script $fp=fopen("documents\off.rtf",w); $outputstring=""; fwrite($fp, $outputstring); For the outputstring, I simply cut and paste the rtf code. I do not get any errors but when I open the new file I created, there are blank lines between each line of rtf code and when it is opened in word, it shows all the rtf code. Is there something else I should doI knew it couldn't be this easy. I tried escaping all the characters in the string such as /,;,{ but that didn't work either. Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Design Discussions
I found that http://designdiscussions.com is backonline with a new url. They use to have a pretty nice PHP forum going. They need a mod for their PHP forum too... bill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP scripts resulting in stderr ?
I think i did not make question clear. What i mean by 'any circumstances' is not using fopen('php://stderr', 'w') or STDERR (ver >= 4.3.0) but getting something in stderr when some function call like fopen(), mysql_connect(), ftp_connect() fails. I tried these calls and they dont result in any stderr messages. Thx gamin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: rtf....I knew it couldn't be this easy
"Edward Peloke" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Ok, > > I took a word document, saved it as an rtf then opened the document in a > text editor so that I could see all the rtf code. I then added this code to > my script > $fp=fopen("documents\off.rtf",w); > $outputstring=""; > fwrite($fp, $outputstring); > > For the outputstring, I simply cut and paste the rtf code. I do not get any > errors but when I open the new file I created, there are blank lines between > each line of rtf code and when it is opened in word, it shows all the rtf > code. Is there something else I should doI knew it couldn't be this > easy. > > I tried escaping all the characters in the string such as /,;,{ but that > didn't work either. Try opening the file in binary mode. Look at fopen() HTH gamin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: rtf....I knew it couldn't be this easy
Thanks, I tried it and don't get a blank line but it still shows all the code when opened in word. Forgive how lengthy it is but here is the actual code: I tried escaping the special characters in the string but that doesn't help either. Thanks, Eddie -Original Message- From: gamin [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 4:11 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: rtfI knew it couldn't be this easy "Edward Peloke" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Ok, > > I took a word document, saved it as an rtf then opened the document in a > text editor so that I could see all the rtf code. I then added this code to > my script > $fp=fopen("documents\off.rtf",w); > $outputstring=""; > fwrite($fp, $outputstring); > > For the outputstring, I simply cut and paste the rtf code. I do not get any > errors but when I open the new file I created, there are blank lines between > each line of rtf code and when it is opened in word, it shows all the rtf > code. Is there something else I should doI knew it couldn't be this > easy. > > I tried escaping all the characters in the string such as /,;,{ but that > didn't work either. Try opening the file in binary mode. Look at fopen() HTH gamin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file uploads >800K with php into a BLOB field
i'm having trouble with using php to upload files to be used as resources over the web via php and a backend db. i don't prefer to store them on the filesystem, but i guess thats an ultimate solution. either way, my code works, in theory, and literally. but not on file above 799KB. why? got me. I removed the php upload limit to 2GB. how about mysql? or maybe internet explorer is the one having trouble. seems IE is getting impatient with files over 2MB, it never comes back to the page it POSTs to, just gives that generic error screen. my code follows... set_time_limit(20*60); $filehandle = fopen( $_FILES['thefile']['tmp_name'], "rb"); $filedata = fread($filehandle, filesize($_FILES['thefile']['tmp_name'])); $filedata = addslashes($filedata); $name = $_FILES['thefile']['name']; $size = filesize($_FILES['thefile']['tmp_name']); $mime = $_FILES['thefile']['type']; $desc = $_POST['desc']; print "Uploaded: $nameFile Size: $size"; $query = "INSERT INTO `resources` (`name`,`mime`,`size`,`desc`,`file`) values ('$name','$mime','$size','$desc','$filedata');"; if(!$result = mysql_query($query)) { print 'Query to database failed.'; $myerr=mysql_error(); print "$myerr "; } -- Mike Brancato -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with CHMOD
I'm running the CHMOD function and I get this error: Warning: chmod() [function.chmod]: Permission denied in c:\inetpub\wwwroot\chatness2\admin\save.php on line 13 I'm running IIS 5 which may be causing it. Here's my code: chmod($file, 0666); $file = $HTTP_GET_VARS['file'].".html"; Please help!! Thanks,Stephen Cratonhttp://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with CHMOD
On Monday, December 30, 2002, at 04:34 PM, Stephen wrote: I'm running the CHMOD function and I get this error: Warning: chmod() [function.chmod]: Permission denied in c:\inetpub\wwwroot\chatness2\admin\save.php on line 13 I'm running IIS 5 which may be causing it. Here's my code: chmod($file, 0666); $file = $HTTP_GET_VARS['file'].".html"; Hm. It looks like you're trying to chmod a variable that hasn't been defined yet. Try switching your statements, so that you have: $file = $HTTP_GET_VARS['file'].".html"; chmod($file, 0666); And let us know what happens. -- Chris Garaffa <[EMAIL PROTECTED]> http://moondrop.heli0s.net -- coming whenever heli0s pays his bill If you give someone a program, you will frustrate them for one day. If you teach someone how to program, you'll frustrate them for a lifetime.
Re: [PHP] Problem with CHMOD
Actually, it is like that. I just copied one part, forgot you'd probably want the file variable and pasted that but accidently below. I read this: $file = $HTTP_GET_VARS['file'].".html"; chmod($file, 0666); - Original Message - From: "Chris Garaffa" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 30, 2002 4:48 PM Subject: Re: [PHP] Problem with CHMOD On Monday, December 30, 2002, at 04:34 PM, Stephen wrote: > I'm running the CHMOD function and I get this error: > > Warning: chmod() [function.chmod]: Permission denied in > c:\inetpub\wwwroot\chatness2\admin\save.php on line 13 > I'm running IIS 5 which may be causing it. Here's my code: > > chmod($file, 0666); > $file = $HTTP_GET_VARS['file'].".html"; Hm. It looks like you're trying to chmod a variable that hasn't been defined yet. Try switching your statements, so that you have: $file = $HTTP_GET_VARS['file'].".html"; chmod($file, 0666); And let us know what happens. -- Chris Garaffa <[EMAIL PROTECTED]> http://moondrop.heli0s.net -- coming whenever heli0s pays his bill If you give someone a program, you will frustrate them for one day. If you teach someone how to program, you'll frustrate them for a lifetime. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ascii(10) changed to ascii(13) when uploading
Just a heads-up. I was having problems doing a MySql infile insert with a flat file uploaded from an html form. I discovered that ascii character 10 (new line \n,\r) is being changed to ascii character 13 (charriage return) when it is uploaded. MySql didn't recognize the ascii-13 character as a new line and as a result tried to write the remaining data into the last cell of my table. Also, a quick question. Since PHP can only handle single MySql queries is it better to write data for large insert operations to a temp file and then do an infile insert? easy, loop _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Look Back 2002
Hello! We are almost at the end of 2002, and it seemed appropriate to look back on the development issues of the past year. So starts the first PHP Look Back! You can find it @ http://www.derickrethans.nl/20021230.php, and if you have any comments,feel free to post them with the link at the bottom of the page. Have fun reading! Derick -- - Derick Rethans http://derickrethans.nl/ JDI Media Solutions http://www.jdimedia.nl/ PHP Magazine - PHP Magazine for Professionals http://php-mag.net/ - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] PHP Look Back 2002
A friend of mine had an uncle who taught dancing to middle-aged couples. One day he visited some lessons and noticed that all the couples were fussing, stepping on each other's feet and arguing. When he asked, "what gives?" his uncle told him, "if you're not fighting, you're not dancing." (It may help to imagine this said with a yiddish accent). Damn me if this doesn't describe the PHP community. Thanks for reminding us to keep our sense of humor, Derick. ;) Leon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multi-lingual Language Support in PHP
there's a nice article in this months (Feb. 2003!!!) PC world (UK) (www.pcw.co.uk) on this. see www.nigelwhitfield.com for details. Best Wishes & Happy New Year Paul Roberts [EMAIL PROTECTED] - Original Message - From: "Michael J. Pawlowsky" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 30, 2002 4:53 PM Subject: [PHP] Multi-lingual Language Support in PHP Keywords: Multiple, Language, PHP, $HTTP_ACCEPT_LANGUAGE I'm just shooting this one up here for the Archives. Since I could not find a built in PHP function to access the preferred languages on a user I came up with this. The original version acted as a http server in that you needed to have a different file for evey language (ie. index.php.en, index.php.fr, index.php.de). I find that's a complicated way to work since if you need to update code you will have to do it in several files. I prefer simply if (phpLang_current == 'fr') { print "Ceci est francais"; } else ( // default to english print "This is english"; } If it's a large block of text you can have seperate include text files as in. if (phpLang_current == 'fr') { include("mytext.fr"); } else ( // default to english include("mytext.en"); } So in case anyone else ever needs this... Here it is... http://www.gnu.org/copyleft/gpl.html | // +--+ // | Original release available on phpHeaven: | // |http://www.phpheaven.net/rubrique7.html?var_recherche=phpLang | // | | // | Authors: Nicolas Hoizey <[EMAIL PROTECTED]> | // | Loïc Chapeaux <[EMAIL PROTECTED]> | // +--+ // parameter to add in url if(!defined('phpLang_urlParam')) define('phpLang_urlParam', 'lang'); // path to image files if(!defined('phpLang_images')) define('phpLang_images', '/flags/'); // indicates if it should put a cookie if(!defined('phpLang_useCookie')) define('phpLang_useCookie', true); // list of available languages, order it as you need $phpLang_languages = array( "en([-_][[:alpha:]]{2})?|english" => array('en', 'english'), "fr([-_][[:alpha:]]{2})?|french" => array('fr', 'french'), ); $HTTP_ACCEPT_LANGUAGE = getenv('HTTP_ACCEPT_LANGUAGE'); $HTTP_USER_AGENT = getenv('HTTP_USER_AGENT'); // language code detection function phpLang_detectLanguage($str, $from) { $ext = ''; reset($GLOBALS['phpLang_languages']); while($ext == '' && list($key, $name) = each($GLOBALS['phpLang_languages'])) { if (($from == 1 && eregi("^".$key."$",$str)) || ($from == 2 && eregi("(\(|\[|;[[:space:]])".$key."(;|\]|\))",$str))) { $ext = $name[0]; } } return $ext; } // finds the appropriate language file if (isset($HTTP_GET_VARS[phpLang_urlParam])) { // a language as been chosen by the user define('phpLang_current', $HTTP_GET_VARS[phpLang_urlParam]); } if (!defined('phpLang_current') && phpLang_useCookie && isset($HTTP_COOKIE_VARS['phpLangCookie'])) { // a language as been found in a cookie previously set define('phpLang_current', $HTTP_COOKIE_VARS['phpLangCookie']); } if (!defined('phpLang_current') && isset($HTTP_ACCEPT_LANGUAGE) && trim($HTTP_ACCEPT_LANGUAGE) != '') { // looks at the languages accepted by the browser $accepted = explode(',', $HTTP_ACCEPT_LANGUAGE); while(!defined('phpLang_current') && list($key, $name) = each($accepted)) { $code = explode(';', $name); $ext = phpLang_detectLanguage($code[0], 1); if(file_exists(phpLang_localizedFileName($ext))) { define('phpLang_current', $ext); } } } if (!defined('phpLang_current') && isset($HTTP_USER_AGENT) && trim($HTTP_USER_AGENT) != '') { // looks at the browser's identification $ext = phpLang_detectLanguage($HTTP_USER_AGENT, 2); define('phpLang_current', $ext); } if(!defined('phpLang_current')) { // if no language yet found, chose the first existing in site's list reset($phpLang_languages); while(!defined('phpLang_current') && list($key, $name) = each($phpLang_languages)) { define('phpLang_current', $name[0]); } } // detection done, cookie update if(defined('phpLang_current')) { if(phpLang_useCookie) { // set a cookie expiring in one year for current language setcookie('phpLangCookie', phpLang_current, time() + 60*60*24*365, "/", "rconline.ca"); } // defines a string to add at the end of each link define('phpLang_link', phpLang_urlParam.'='.phpLang_current); } else { // no language found define('phpLang_current', ''); define('phpLang_link', phpLang_urlParam.'='); } // function that adds the flags with links for existing files // give as first parameter the HTML string to put between each flag function AddFlags($between = "", $showCurrent = false) { $REQUEST_URI = $_SERVER['REQUEST_URI']; reset($GLOBALS["phpLang_languages"]); $temp = ""; while(list($key, $name) = each($GLO
[PHP] SQL Error
I'm having some troubles. I have an install script which runs a lot of SQL statements to create tables then insert info into them. One of them is an emoticons table. Here's the error I'm getting: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':\)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 or, if I change my code a little, it's this: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 Here's my code which inserts the information: INSERT INTO c_emotes VALUES (':)', 'emotes/smile.gif'); // I also have tried placing a \ infront of the )...no luckINSERT INTO c_emotes VALUES (';)', 'emotes/wink.gif');INSERT INTO c_emotes VALUES (':(', 'emotes/sad.gif');INSERT INTO c_emotes VALUES (':P', 'emotes/tounge.gif');INSERT INTO c_emotes VALUES (':|', 'emotes/blank.gif');INSERT INTO c_emotes VALUES (':-|', 'emotes/blank.gif');INSERT INTO c_emotes VALUES (':-)', 'emotes/smile.gif');INSERT INTO c_emotes VALUES (';-)', 'emotes/wink.gif');INSERT INTO c_emotes VALUES (':-P', 'emotes/tounge.gif');INSERT INTO c_emotes VALUES (':-(', 'emotes/sad.gif'); Anyone see the problem?? Thanks,Stephen Cratonhttp://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SQL Error
I just tried this in MySQL and it inserted no problem INSERT INTO c_emotes VALUES (6, ':-)'); Mike *** REPLY SEPARATOR *** On 30/12/2002 at 7:14 PM Stephen wrote: I'm having some troubles. I have an install script which runs a lot of SQL statements to create tables then insert info into them. One of them is an emoticons table. Here's the error I'm getting: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':\)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 or, if I change my code a little, it's this: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 Here's my code which inserts the information: INSERT INTO c_emotes VALUES (':)', 'emotes/smile.gif'); // I also have tried placing a \ infront of the )...no luck INSERT INTO c_emotes VALUES (';)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':(', 'emotes/sad.gif'); INSERT INTO c_emotes VALUES (':P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-)', 'emotes/smile.gif'); INSERT INTO c_emotes VALUES (';-)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':-P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':-(', 'emotes/sad.gif'); Anyone see the problem?? Thanks, Stephen Craton http://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us
Re: [PHP] PHP & PostgreSQL
At 07:59 AM 12/30/02 -0600, Michael Sims wrote: On Mon, 30 Dec 2002 04:11:02 -0700, you wrote: >, or the types SET and ENUM. I'm not sure what SET is, never used it, Color set( 'red', 'green', 'blue' ) can contain only the following values: NULL;'blue'; 'green'; 'green,blue'; 'red'; 'red,blue'; 'red,green'; 'red,green,blue'; You can enter the color names in any order, but they always come out like this. Only words contained in the set are allowed. You can also look at a set as a number, and do bit manipulation on it. The list of values above are 0 to 7 when used in a numeric context. but ENUM is totally unnecessary in Postgres because it supports foreign keys. The big difference using set and enum is in data storage. If you look on the disk you will find both types are stored in the smallest integer they fit in. Even 'red,green,blue' fits in a single byte each time it is stored. This is more standard anyway, and if you need to update the set there is no need to touch the database schema. I like being able to define some things in the schema. I have widgets in my toolkit that build arrays of checkboxes, radio buttons or drop down lists based on the values allowed in an enum or set. They get used quite a bit, in fact losing these widgets may be the biggest thing keeping me using MySQL. (Harder prototyping is a close second.) Rick. P.S. Thanks for the info on handling dates! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Keeping script running, but returning control to user?
I need a way to keep the script running on the server, but control to the user. I'm doing some lengthy processes on the server, and it seems stupid to keep the user waiting pointlessly. I'm trying to do something like: if(array_key_exists('secondrun',$_GET)){ print "Processing complete!"; exit; } header("Location: http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?secondrun=1"); //Do long processing here ?> but it waits till the long processing is done, and then redirects. Is there another way to do this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Serializing a DOM object
Hi, Tuesday, December 31, 2002, 2:55:39 AM, you wrote: >> In the test function, if I just serialize the $xml, return it and then call >> xmldoc_open_mem on the unserialized return string, it works fine. >> But it doesn't like it if I do the above. I'm getting the error: >> >> Warning: dump_mem() [function.dump-mem]: Underlying object missing >> or of invalid type >> Warning: dump_mem() [function.dump-mem]: Cannot fetch DOM object >> >> Why isn't the serialization of the DOM object not working that way? CB> I just had a thought... Is it because the DOM structure of the XML document CB> is stored only in the memory for the page? And the pointer to that memory CB> isn't transferred when the DOM object is serialized, stored and retrieved? CB> Chris Try encoding like this: $retval = base64_encode(serialize( domxml_open_mem( $xml ))); and on the next page: $xml = unserialize(base64_decode($xml)); It works via html but don't know enough about soap -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-DEV] PHP Look Back 2002
Derick Rethans wrote: > > We are almost at the end of 2002, and it seemed appropriate > to look back on the development issues of the past year. So > starts the first PHP Look Back! You can find it @ > http://www.derickrethans.nl/20021230.php, and if > you have any comments,feel free to post them with the link at > the bottom of the page. Awesome and classy. Much like your contribution to PHP. Thanks, and all the best to you in '03. Regards Mike Robinson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] SQL Error
I don't think there's anything wrong with the queries themselves. Are you trying to run them all at once? You're getting an error because MySQL is reaching a semi-colon somewhere and that's causing a parse error... Show how you're trying to run all of these queries. Bottom line, you must do them one at a time with mysql_query, or run them through the command line in a file. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -Original Message- From: Stephen [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 7:15 PM To: PHP List Subject: [PHP] SQL Error I'm having some troubles. I have an install script which runs a lot of SQL statements to create tables then insert info into them. One of them is an emoticons table. Here's the error I'm getting: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':\)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 or, if I change my code a little, it's this: You have an error in your SQL syntax near '; INSERT INTO c_emotes VALUES \(':)', 'emotes/smile.gif'\); INSERT INTO c_emo' at line 4 Here's my code which inserts the information: INSERT INTO c_emotes VALUES (':)', 'emotes/smile.gif'); // I also have tried placing a \ infront of the )...no luck INSERT INTO c_emotes VALUES (';)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':(', 'emotes/sad.gif'); INSERT INTO c_emotes VALUES (':P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-|', 'emotes/blank.gif'); INSERT INTO c_emotes VALUES (':-)', 'emotes/smile.gif'); INSERT INTO c_emotes VALUES (';-)', 'emotes/wink.gif'); INSERT INTO c_emotes VALUES (':-P', 'emotes/tounge.gif'); INSERT INTO c_emotes VALUES (':-(', 'emotes/sad.gif'); Anyone see the problem?? Thanks, Stephen Craton http://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Look Back 2002
> We are almost at the end of 2002, and it seemed appropriate to look back > on the development issues of the past year. So starts the first PHP Look > Back! You can find it @ http://www.derickrethans.nl/20021230.php, and if > you have any comments,feel free to post them with the link at the bottom > of the page. Awesome work. Very good reading... Here's a summary of the PHP General list, if you want it, too. :) January - December: "How come when I have page.php?id=1, the $id variable is no longer created" "How do I store images in a database?" "Try phpclasses.org" That's pretty much it. :) Yeah, I know the register_globals thing hasn't been the whole year, but it feels like it. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php