Re: [PHP] **** Converting dynamic webpages into static HTML pages
When running PHP as a static binary, how does it handle text (HTML code) that falls outsize of the tags. Is the text ignored or outputted? Outputted. This can be very handy. One thing I use it for is customizing configuration files where only a small percentage of the overall text needs to be modified. Using in the text makes it very powerful. Now, my client has requested that I give him the ability to generate a static version of the catalog so that he can burn it onto a CD for distribution at trade shows. He wants the CD to be a snapshot of the catalog. Furthermore, he wants to be able to generate this "snapshot" frequently so that pricing info on the CD will be current. To accommodate this, the process for generating the snapshot must be easy and intuitive. If you are lucky, and the web site has links that will get you to all the products without searching or other based activity, just point wget -kr at the site, and you will end up with a directory containing flat HTML files for all the database generated pages in the site. Be sure the destination directory is in the same path as you want it to appear from the root directory of the CD. You won't be able to put it in the root directory. If you don't have good links in the program, you can use -i input_file to name all the pages you need to grab. Try >man wget for details. I haven't tried making this something that can be accessed from a CD using file:// based URLs, but I have been able to grab entire web sites to be hosted with Apache. You may need to use sed or something to clean up the tags. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Method for displaying Downline
At 06:47 PM 11/29/02 -0800, Daren Cotter wrote: Must you send three separate requests to the list? One is enough. You might find some useful information here: http://marc.theaimsgroup.com/?l=php-general&m=95423103630080&w=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Method for displaying Downline
IT IS CONSIDERED VERY RUDE TO SPAM THE LIST WITH REPEATED MESSAGES ONE IS ENOUGH!! Yes, I am shouting. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why all the returned emails from this list?
At 11:16 PM 12/1/02 -0800, Troy May wrote: I'm getting nailed with a bunch of returned emails like this: [EMAIL PROTECTED] - no such user here. There is no user by that name at this server. : Message contains [1] file attachments What's going on? Each one has a different address, but the terminalgmb.ru part is the same for each one. I believe you are the victim of one of the new viruses. (klez?) Someone with your name in their address book has the virus, and you are the lucky one it chose to use for the From: address on all the mails it is sending out. Don't open that attachemnt!!! Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date
> Hi, > > please could someone tell me how i can return a month in text from an int > ie > > getMonth(12) > How about: $Months = array( , 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ); echo $Months[12]; // Dec Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formating numbers & date
At 04:58 PM 12/4/02 -0700, Jeff Bluemel wrote: I'm displaying a date that I get from a informix database query - the date format is as follows; 2002-12-04 23:21:49 I want it to display as 12/4/2002 11:21:49 PM $Hour = substr( $Date, 11, 2 ); if( $Hour ) > 12 { $Hour = $Hour - 12; $AMPM = 'PM'; } else { $AMPM = 'AM'; } echo substr( $Date, 5, 2 ), '/', substr( $Date, 8, 2 ), '/', substr( $Date, 0, 4 ), ' ', $Hour, substr( $Date, 13, 6 ), $AMPM; You may need to adjust the numbers in the substrs... Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] formating numbers & date
At 11:51 AM 12/5/02 +1100, Justin French wrote: on 05/12/02 11:37 AM, Rick Widmer ([EMAIL PROTECTED]) wrote: > $Hour = substr( $Date, 11, 2 ); > if( $Hour ) > 12 { > $Hour = $Hour - 12; > $AMPM = 'PM'; > } > > else { > $AMPM = 'AM'; > } > > echo substr( $Date, 5, 2 ), '/', substr( $Date, 8, 2 ), '/', > substr( $Date, 0, 4 ), ' ', $Hour, substr( $Date, 13, 6 ), $AMPM; Isn't this a little simpler? There's always more than one way to do something I guess :) Yes, it is simpler to code, but it also takes almost twice as long to run. 1000 iterations with strtotime: 0.2296 seconds 1000 iterations with substr:0.1308 seconds Doesn't matter much if you only do it once, but it can add up in a loop. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Middle Number
At 09:45 PM 12/6/02 -0500, Stephen wrote: How can you find the meadian (or middle number) of a list of numbers? If there is an even amount of numbers, how would I still find it? load the list into an array, in numeric order... then: $List = array( 1,2,3,4,5,6 ); $Middle = ( count( $List ) - 1 ) / 2; $median = ( $List[ floor( $Middle ) ] + $List[ ceil( $Middle ) ] ) / 2; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Middle Number
At 07:05 PM 12/7/02 -0500, Stephen wrote: Wouldn't this only work for an even ammount of numbers? Like 1, 2, 3, 4 has 4 numbers... Did you try it? I'd hate to think I've done more work to solve your problem than you have... Even: $List = array( 1,2,3,4,5,6 ); $Middle = ( count( $List ) - 1 ) / 2; 2.5 =( 6 - 1 ) / 2 $median = ( $List[ floor( $Middle ) ] + $List[ ceil( $Middle ) ] ) / 2; ( $List[ 2 ]+ $List[ 3 ] ) / 2 3.5= 3 +4 /2 Odd: $List = array( 1,2,3,4,5 ); $Middle = ( count( $List ) - 1 ) / 2; 2 =( 5 - 1 ) / 2 $median = ( $List[ floor( $Middle ) ] + $List[ ceil( $Middle ) ] ) / 2; ( $List[ 2 ]+ $List[ 2 ] ) / 2 3 = (3 +3 ) / 2 It looks like it works to me. For details see: http://mathforum.org/library/drmath/view/57598.html > > > > > At 09:45 PM 12/6/02 -0500, Stephen wrote: > >How can you find the meadian (or middle number) of a list of numbers? If > >there is an even amount of numbers, how would I still find it? > > > load the list into an array, in numeric order... > > then: > > $List = array( 1,2,3,4,5,6 ); > > $Middle = ( count( $List ) - 1 ) / 2; > > $median = ( $List[ floor( $Middle ) ] + $List[ ceil( $Middle ) ] ) / 2; > -- 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] Finding Mode
At 07:12 PM 12/7/02 -0500, Stephen wrote: Another math question... How would I find the mode (number that repeats most often) of an array? Then, if there isn't a number that repeats most often, tell the user that. For each entry in the array, count the number of times a value occurs: while( list( , $Value ) = each( $MyArray )) { $NumberHits[ $Value ] ++; } sort $NumberHits keeping the key/value pairs together. You can find a sort function that will do it here: http://www.php.net/manual/en/ref.array.php The first or last entry in the sorted array is the mode. If all the entries have the same number of hits there is no mode. I'm not sure what the mode of (1, 1, 2, 5, 9, 19, 19) would be, but I'm suspect a good definition of mode will tell what to do if more than one value ties for having the most hits. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String to an Array
At 11:15 AM 12/8/02 +1100, Justin French wrote: I *think* either: OR Works -- you'll have to experiment, but I believe the second way is correct, and will echo the first (0th) character in the string. This depends on PHP version. In the bad old days you had to use $str[0]. Sometime since PHP4 came out they added the preferred $str{0} option, which is the only one that should be used in new code. Extracting characters from a string with [] is depreciated, and may stop working someday. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] key pairs
At 04:44 PM 12/17/02 -0500, 1LT John W. Holmes wrote: What I was thinking is that you have one table with Order_ID Name Address Flag -> Here you flag this as SHIP_TO or BILL_TO etc... That layout would be better than: Order_ID Ship_name Ship_address Bill_name Bill_address etc... Which is what I got from you last email. Does anyone agree? Not only do I agree, so do the people who came up with the rules of proper database normilization. Here are a few of the top results on a Google search for database normalization. http://www.phpbuilder.com/columns/barry2731.php3?page=1 Watch how he handles URLs. http://www.devshed.com/Server_Side/MySQL/Normal http://www.sqlmag.com/Articles/Index.cfm?ArticleID=4887&pg=1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is __FILE__ still current or is there something newer?
At 03:05 PM 12/22/02 +, z z wrote: __FILE__ is useful to know the current script's path __FILE__ is a 'constant' defined by the Zend Engine that tells you the name of the current file. If you are in an Include the name of the included file is returned, if you are in the main file its name is returned. This is commonly used in creating error messages. > What is the cleanest and self-contained way to do a > relative include from an included file which might > not be in the same directory as its parent? Put the files in a directory named in the include_path such that you don't have to mess with any kind of path information within the programs. That's what it is there for. If you have to move the include files which would you rather do: a) change the include_path in php.ini, httpd.conf, or .htaccess. b) edit every file in the project to change the path. I have a group of common include files most of my sites use, and another group of files for each domain. The include path for each web sites is set in the webserver configuration, and looks like this: ... php_value include_path /web/lib:/web/hosts/www.somedomain.com/lib:. You can group files into directories under the include_path to keep related include files together. include( 'category/program.inc' ); will search every directory in the include path for a subdirectory named 'category' containing a file 'program.inc' to include. Very handy! Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Plotting Data Graphics
At 03:06 AM 12/23/02 -0200, Alexandre Soares wrote: Hi All, Where I can get more information about a free library to plot 2d and 3d data information, http://www.aditus.nu/jpgraph/ Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with Include
At 08:04 AM 12/24/02 +0300, sport4ever wrote: maybe there is something wrong with php.ini notice that I faced with this problem just after I upgraded to (PHP 4.2.1), (Apache2), everything was great before! The last I heard PHP + Apache2 is pretty much experimental, and not recommended for production servers. Unless you plan on working to debug the combination of programs, you should be using Apache 1.3 if you want to use PHP. There are a few combinations of versions that work together, but unless you are willing to put a lot of extra effort and study into using Apache 2, stick with 1.3 until the PHP developers announce Apache 2 support. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beginner examples?
At 09:02 PM 12/23/02 -0800, Chris Rehm wrote: John W. Holmes wrote: http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=php+ mysql+tutorial ---John W. Holmes... The Internet is a wealth of resources, but some of them aren't as good as others. If people here have had great success from some sites, I'd like to be able to pass on those recommendations. Both of the tutorials that got me going with PHP & MySQL appear on the first page of the Google search John sent you. Those are Devshed and Webmonkey, but that was long ago, there may be better choices now. One thing to look for is a discussion of the "Register Globals" change and how it affects PHP programming. Older tutorials may have a problem with how they access form varibles. > Did I make a valid suggestion? Yes. PHP + MySQL are a very good way to solve the problem you posed. Certainly my first choice. I wouldn't send an email on every entry though. It is a waste. The entries are stored in the database, and you can look through them any time you want. Just build a password protected web page. Picking a winner might be as easy as: SELECT * FROM Entries ORDER BY RAND() LIMIT 1 This picks one record from the Entries table at random. You may want to send your self an email with the results, as this is truly random. May as well let the computers do the work... Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Photos and logos in MySQL + PHP
At 09:40 AM 12/27/02 +0800, Denis L. Menezes wrote: Hello friends, I am making a website for our school. My requirement is that when any student searched for a particular club, the logo of the club abd the chairperson's phot should automatically be shown dynamically on the top of the page. For this to be done, I have three questions, if any of you could please help me : 1. Can I place these photos and logos in the MySQL database, If so, what field type? You can, but you don't want to. Just put the images in a directory and maybe the names in the database. In this case, I'd probably name the images based on the auto_increment field in the table they are related to. 2. How can I make the admin page upload the photos and logos to the database? http://www.php.net/manual/en/features.file-upload.php 3. How do I display these photos dynamically on the output webpage? First build the names in variables... $LogoName = "/images/logos/$ClubID.png"; $PhotoName = "/images/photos/$ClubID.png"; then later when you are painting the page. Don't forget to include Width, Height and Alt tags in the tags. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI delay
At 03:55 AM 12/27/02 -0500, Maciek Ruckgaber Bielecki wrote: has anyone an idea of how can i do some kind of decent delay (instead of some shell_exec doing pings) :-P Have you tried sleep()? http://www.php.net/manual/en/function.sleep.php Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 4.3.0 released
At 08:40 PM 12/27/02 -0700, The Doctor wrote: Is it just my or are there problems with static Aapche 1.3.27 compiles? I don't know if it is _just_ you, but my static install compiled and is running just fine. SuSE 8.0 php 4.3.0 Apache 1.3.27 Mod_SSL 2.8.12-1.3.27 OpenSSL 0.9.6h ming 0.2a pdflib 4.0.3 ./configure --with-apache=../apache --with-mysql --with-pgsql=/usr --enable-cli --enable-calendar --enable-debug=no --with-config-file=/web/conf --with-PEAR --with-jpeg-dir=/usr/local --with-phg-dir=/usr/local --with-zlib-dir=/usr/local --with-gd=/usr --enable-gd-native-ttf --with-freetype=/usr/include/freetype2 --with-pdflib=/usr/local --with-ming --enable-magic-quotes --with-mm=../mm --with-pspell Script started on Fri Dec 27 20:34:45 2002 nl2k.ca//usr/source/php-4.3.0$ cat configphp configure --prefix=/usr/contrib --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man --with-low-memory --with-elf --with-x --with-mysql --with-zlib --enable-track-vars --enable-debug --enable-versioning --with-config-file-path=/usr/local/lib --with-iconv=/usr --with-openssl=/usr/contrib --enable-ftp --with-gd=/usr --enable-imap --with-bz2 --with-apache=/usr/source/apache_1.3.27_nonSSL/ --with-pgsql=/usr/contrib/pgsql --enable-gd-native-ttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --with-xpm-dir=/usr/X11/lib -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] Re: [PHP] PHP 4.3.0 released
At 11:29 AM 12/28/02 -0700, The Doctor wrote: On Sat, Dec 28, 2002 at 04:04:14AM -0700, Rick Widmer wrote: > At 08:40 PM 12/27/02 -0700, The Doctor wrote: > ./configure --with-apache=../apache --with-mysql --with-pgsql=/usr > --enable-cli --enable-calendar --enable-debug=no > --with-config-file=/web/conf --with-PEAR --with-jpeg-dir=/usr/local > --with-phg-dir=/usr/local --with-zlib-dir=/usr/local --with-gd=/usr > --enable-gd-native-ttf --with-freetype=/usr/include/freetype2 > --with-pdflib=/usr/local --with-ming --enable-magic-quotes --with-mm=../mm > --with-pspell vs. > >configure --prefix=/usr/contrib --localstatedir=/var > >--infodir=/usr/share/info --mandir=/usr/share/man --with-low-memory > >--with-elf --with-x --with-mysql --with-zlib --enable-track-vars > >--enable-debug --enable-versioning --with-config-file-path=/usr/local/lib > >--with-iconv=/usr --with-openssl=/usr/contrib --enable-ftp --with-gd=/usr > >--enable-imap --with-bz2 > >--with-apache=/usr/source/apache_1.3.27_nonSSL/ > >--with-pgsql=/usr/contrib/pgsql --enable-gd-native-ttf > >--with-jpeg-dir=/usr --with-png-dir=/usr > >--with-freetype-dir=/usr --with-xpm-dir=/usr/X11/lib What I have that you do not: cli - create command line interface executable program. calendar - fancy tricks with dates. pear - a library of handy functions gd-native-ttf pdflib - create pdf files ming - create swf files magic-quotes - eliminates a lot of addslashes() mm - I'm not sure pspell - spelling checker I don't think anything I added would make any difference. Things that look wrong to me: --with-low-memory, --with-elf and --with-x are not listed as valid options in ./configure --help, and look scary to me. Get rid of them. You used enable-zlib, but the correct statement is with-zlib or with-zlib-dir. --enable-track-vars - is enabled by default and ignored for a couple of php versions now. --enable-versioning - is only needed when you want to run more than one PHP module version at the same time. The next thing to try... xpm-dir, bz2, imap, iconv are the modules you are using that I am not. Try compiling without them and see what happens. I don't see where any of these _should_ affect things, but I've gotten in trouble before using options I did not need... --prefix - --with-apache specifies where the resulting files are placed, so prefix is not relevant to static install. localstatedir, infodir, mandir - not relevant to a static install because a php module does not use any of the directories specified by these. Rick -- 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
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
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
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
Re: [PHP] Date problem
At 05:23 PM 12/31/02 +0800, Denis L. Menezes wrote: Hello friends. Is there a routine in PHP I can use to find if today's date fits between the commencing date and the ending date? SELECT * FROM Table WHERE NOW() >= StartDate AND NOW() <= EndDate Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php 4.3.0 and Mail() function
At 10:11 AM 12/31/02 -0500, Carl Bélanger wrote: I just upgraded to php 4.3.0 and all by bulletin board are now returning error about the mail function: Fatal error: Call to undefined function: mail() in /var/wwwx/htdocs/forum/private.php on line 687 What could be missing? ./configure looks for sendmail if it is not found the mail function is not compiled in, resulting in the undefined function call. Mine is in /usr/sbin/sendmail. Grep the results of ./configure for 'sendmail' to see what happened. ./configure ... > tempfile grep sendmail tempfile Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: loading a db table into a php array from mysql
At 02:57 PM 12/31/02 -0500, David T-G wrote: ...and then Tularis said... % % Usually, % using mysql to handle your tables is *way* faster than letting php % handle it. Yes, do as much as you can in the database. The people who wrote it spent a lot of time trying to optimize it. % % In your case, you could just do a complex join I think. That would give Ahhh... A new term. Back to the books for me! Here is a query from one of my projects... $R1 = $DB->Query( "SELECT ScheduleID, CourseName, DepartmentName, " . " TimeStart, TimeStop, BuildingName, " . " BuildingNumber, RoomName, RoomNumber, " . " a.GradeLevel AS MinGrade, " . " b.GradeLevel AS MaxGrade " . "FROM Schedule " . "LEFT JOIN Courses USING( CourseID ) " . "LEFT JOIN Departments " . " ON Schedule.DepartmentID = Departments.DepartmentID " . "LEFT JOIN Periods " . " ON Schedule.PeriodID = Periods.PeriodID " . "LEFT JOIN Rooms " . " ON Schedule.RoomID = Rooms.RoomID " . "LEFT JOIN Buildings USING( BuildingID ) " . "LEFT JOIN Levels a " . " ON a.LevelID = MinLevel " . "LEFT JOIN Levels b " . " ON b.LevelID = MaxLevel " . "WHERE YearID = '$CurrYearID' " . " AND TeacherID = '{$_SESSION[ 'CurrentUserID' ]}' " . "ORDER BY TimeStart " ); This combines data from seven different tables, and pulls two different values out of one of the tables (Levels) to create a single result set. In many cases you can collect all the data you need in a single query. Every field in the Schedule table is a key to another table that has to be looked up and translated to something people will understand. Note the two different ways of connecting tables with LEFT JOIN. USING( fieldname ) connects the table being joined, with the table listed right before it, using the same fieldname in both. The ON syntax allows you to use differently named fields, and/or a different table. Courses has two fields (MinLevel, MaxLevel) that contain the highest and lowest grade that is allowed to take the course. Look closely at how the table aliases (a and b) are used to join two different fields to the same table. (Levels) The table structures are listed below. Rick CREATE TABLE Buildings ( BuildingID bigint(20) NOT NULL auto_increment, BuildingName varchar(20) default NULL, BuildingNumber varchar(20) default NULL, NumRooms int(11) default NULL, FirstYear bigint(20) default NULL, LastYear bigint(20) default NULL, PRIMARY KEY (BuildingID), KEY BuildingName (BuildingName) ) TYPE=MyISAM; CREATE TABLE Courses ( CourseID bigint(20) NOT NULL auto_increment, DepartmentID bigint(20) NOT NULL default '0', CurriculumID bigint(20) NOT NULL default '0', CourseName varchar(20) default NULL, MinLevel bigint(20) NOT NULL default '0', MaxLevel bigint(20) NOT NULL default '0', BeginYear bigint(20) default NULL, EndYear bigint(20) default NULL, PRIMARY KEY (CourseID), KEY DepartmentID (DepartmentID), KEY CurriculumID (CurriculumID) ) TYPE=MyISAM; CREATE TABLE Departments ( DepartmentID bigint(20) NOT NULL auto_increment, DepartmentHead bigint(20) default NULL, DepartmentName varchar(30) default NULL, MinGrade int(11) default NULL, MaxGrade int(11) default NULL, DepartmentOrder decimal(4,2) default NULL, PRIMARY KEY (DepartmentID) ) TYPE=MyISAM; CREATE TABLE Levels ( LevelId bigint(20) NOT NULL auto_increment, DepartmentID bigint(20) NOT NULL default '0', LevelName varchar(30) default NULL, GradeLevel int(11) default NULL, PRIMARY KEY (LevelId) ) TYPE=MyISAM; CREATE TABLE Periods ( PeriodID bigint(20) NOT NULL auto_increment, PeriodGroupID bigint(20) default NULL, TimeStart time default NULL, TimeStop time default NULL, Days set('Sun','Mon','Tue','Wed','Thu','Fri','Sat') default NULL, RollReqd char(2) default NULL, PRIMARY KEY (PeriodID), KEY DepartmentID (PeriodGroupID) ) TYPE=MyISAM; CREATE TABLE Rooms ( RoomID bigint(20) NOT NULL auto_increment, BuildingID bigint(20) NOT NULL default '0', RoomName varchar(20) default NULL, RoomNumber varchar(20) default NULL, PRIMARY KEY (RoomID), KEY BuildingID (BuildingID) ) TYPE=MyISAM; CREATE TABLE Schedule ( ScheduleID bigint(20) NOT NULL auto_increment, YearID bigint(20) NOT NULL default '0', DepartmentID bigint(20) NOT NULL default '0', PeriodID bigint(20) NOT NULL default '0', RoomID bigint(20) NOT NULL default '0', CourseID bigint(20) NOT NULL default '0', TeacherID bigint(20) NOT NULL default '0', PRIMARY KEY (ScheduleID), KEY YearID (YearID), KEY DepartmentID (DepartmentID), KEY PeriodID (PeriodID), KEY
Re: [PHP] use included GD of external
At 03:13 AM 1/1/03 +0100, Richard Pijnenburg wrote: Hi list, What is better to use? The included GD library or the external ( Boutell.com ) GD library? Unless you have to use the external library because other things are sharing it, just use the GD that comes with PHP. We are talking about 4.3.0, right? Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php 4.3.0 and Mail() function
At 02:07 AM 1/2/03 +0800, Jason Wong wrote: On Thursday 02 January 2003 01:26, Carl Bélanger wrote: > Exactly!! > > "checking for sendmail... no" > > I've browsed the configure's help and I can't find an option to specify > the path to sendmail (which is not at a regular place as we run qmail). > Is the a "--with-sendmail-path" option or something like that? I don't believe there is one. At the very least you can: touch /usr/sbin/sendmail which creates an empty file where ./configure expects to find sendmail. qmail comes with a wrapper called sendmail which emulates sendmail. I'm not sure where php's configure expects to find sendmail but you can try copying/linking the wrapper to /usr/lib and/or /usr/sbin. This is best: ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail Now any program expecting to find sendmail in the default location will find the Qmail wrapper instead, and will work. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: loading a db table into a php array from mysql
% different ways of connecting tables with LEFT JOIN. USING( fieldname ) % connects the table being joined, with the table listed right before it, % using the same fieldname in both. The ON syntax allows you to use % differently named fields, and/or a different table. I still don't get what a left or right or outer or inner join is... When looking up values in a second table, LEFT JOIN has two properties that make it my choice: o It lets me specify exactly how the tables are linked together. o It returns results for the first table even if there are no entries in the second table. For example, if one of my classes did not yet have a room assigned, the rest of the data will still be returned. > I've read the mysql docs for the syntax and some examples, but this is > a place where I'll need to go to outside tutorials. Do you know of > any (on the web) which will give me the background? http://www.devshed.com/Server_Side/MySQL/Join/page5.html http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=sql+join+tutorial -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using mail() for mailist list app
At 06:33 PM 1/1/03 -0500, Michael J. Pawlowsky wrote: Personally I simply get the e-mail addresses spit out to me from the database and then I input them into a application made just for bulk mailingt. You can also easily write a quick perl or shell script to send it out from a file of names and this way you can "nice" the process so as not to bog down the machine. PHP now offers a command line SAPI that lets you write these programs with PHP. Leave the names in the database, and use PHP's mail() to send the messages. It works very well. I've been using PHP at the command line for quite a while now. 4.3.0 is the first version that creates the CLI version of PHP by default. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: loading a db table into a php array from mysql
At 06:32 AM 1/1/03 -0500, David T-G wrote: I still don't get what a left or right or outer or inner join is... The reason I chose LEFT JOIN are: o You get better control over how the query is executed. o Values from the first table are returned even if there is no associated entry in the second table. For eaxample if no building or room was set on an entry in my previous query, the rest of the data will still be returned. Do you know of any (on the web) which will give me the background? http://www.devshed.com/Server_Side/MySQL/Join/page1.html http://www.devshed.com/Server_Side/MySQL/Normal http://www.devshed.com/Server_Side/MySQL/SQLJoins/page1.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Testing
At 05:25 PM 1/2/03 -0800, Jim Lucas wrote: DocumentRoot /some/path/public_html php_admin_value engine On try php_admin_value php_engine on|off Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 servers for mail implementation
At 07:11 PM 1/2/03 -0800, Roger Thomas wrote: dear all, i have 2 servers that were *given* to me to setup and implement webmail solution for our client. i have done some groundwork in terms of the backend applications that are needed to do this. This doesn't have much to do with PHP. In fact it can probably be done without PHP. The ideal setup depends on your situation. How many domans? How many users? How much email? If you have multiple domains, I suggest you look at http://inter7.com/freesoftware/ They have a complete package to manage multiple virtual domains on a Qmail server using only one system user. I've been using it for a couple years, with good luck. There is an active development effort If I was going to setup two machines as mail servers, I would put half the users on each, with all the programs running on both. Then I would setup MX records so that each server backed up the other, collecting email for later delivery if the other server is down.This way if one of the machines goes down, half your users still get mail, and the messages for the other half are queued on the remaining server. Be sure to keep a backup copy of one machine's configuration on the other. You should have everything you need to re-build a dead server on the other machine. If you put the user mailboxes and mail queue on separate hard drives you can pop that drive from one machine to another very quickly. You can run Apache on the mail server to manage email accounts, and for webmail, but keep all non-mail related web services off of it. You don't want all the web developers logging on to the mail server. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP memory usage
At 01:25 AM 1/3/03 -0200, Fernando Serboncini wrote: function a(myclass c) { return c; } would create another copy of "c" in memory. Things get a bit larger when you go with linked-list like structures in classes, where you have to take really good care to don't duplicate data. If you're not taking care, then maybe 5MB is normal. Not really. PHP has its own method of handling variables which does not make a copy of data unless it has to. See: http://www.zend.com/zend/art/ref-count.php This may be the most important paragraph in the article: Note that PHP 4 is not like C: passing variables by reference is not necessarily faster than passing them by value. Indeed, in PHP 4 it is usually better to pass a variable by value, except if the function changes the passed value or if a reference is being passed. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Defaults in drop down list...
At 11:54 AM 1/6/03 -0600, Steven Kallstrom wrote: Alabama Alaska Arizona . $stateselected['$state'] is an array that stores the state that was selected on the prior form. is there an easier way, to have a default state picked out of this drop down list.??? Write a function that paints selects: $States = array( 'AL' => 'Alabama', ... function PaintSelect( $Name, $Values, $Selected ) { echo "\n"; reset( $Values ); while( list( $Index, $Value ) = each( $Values )) { $Selected = ( $Selected == $Index ) ? ' SELECTED' : ''; echo " $Value\n' } echo "\n"; } Then call lt like this ... State: Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER content
At 12:00 PM 1/8/03 +0100, Fritzek wrote: Hi folks, I've seen a lot phpinfo() on different platforms, different PHP versions with different web servers. Always the content of $_SERVER is different. i.e PHP4.3.0 on win32 with Apache2 doesn't show PATH_TRANSLATED and HTTP_REFERER. someone knows how to get a consitent content of $_SERVER? Or where and how can I configure my system to see the above? There isn't anything PHP can do about this, all it can do is return what the server sends. Browsers, firewalls and proxies can all decide to hide information from you. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] apache + mod_php question
At 05:16 AM 1/9/03 +1000, Timothy Hitchens \(HiTCHO\) wrote: use: apachectl graceful It will reload the config's and allow operation to continue!! Yes, in many cases this is the best option. The only time I've found it will not work is when you are adding or changing SSL certificates. For all other changes graceful is much better choice because Apache will not lose any connections. Anything that comes in after the graceful gets handled based on the new configuration. Things that are already running will complete using the old configuration. The important thing, your machine never ignores requests. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Encoders and GPL License
At 04:45 PM 1/17/03 -0800, [-^-!-%- wrote: Since PHP itself is open source, then wouldn't that prohibit a developer from encoding any PHP product? Please correct me, if I'm wrong. I'm just curious. GPL isn't the only way to license open source. PHP is not GPL for just that reason. See the LICENSE file in your PHP source directory. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: How to add new user to the domain
At 09:35 PM 7/23/02 -0500, Richard Lynch wrote: > >Any one please let me know how to use PHP to add new user to a domain for > >using mail (sendmail). Remember what Richard said... mucking around with real users is DANGEROUS! I solved the problem with Qmail, vchkpw and qmailadmin. No coding on my part at all, just install a few packages. http://inter7.com/freesoftware/ http://www.qmail.org Some people have hundreds of domains and tens of thousands of users on a small cluster of servers. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Security Advisory: Vulnerability in PHP versions 4.2.0
At 10:22 AM 7/24/02 -0400, Scott Fletcher wrote: >It work very nicely The whole process take 30 to 45 minutes for just >one server. I wonder how does someone did 12 computers in 10 minutes. >Cool! For me the key to upgrading many servers is to compile once then copy the resulting files to all my other servers. I also compile Apache + mod_ssl + PHP static into one file so usually all I have to do is copy the httpd file to the other machines. The machines need similar CPUs and identical library versions, but that isn't too hard to do. With Linux it is legal to copy in the new httpd file then apachectl restart to update the server. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help reg. create user and allocate space
At 04:55 AM 7/29/02 -0500, Richard Lynch wrote: > >I am using PHP-4.1.1, postgresql on Linux. > > > >I want the following functionality, I dont know how to implement it. > > > >Each time a new user registeres, I want to create mail account by the name > >he specifies and allocate him some space of the server, say 2mb. If this is on Linux, BSD or some UNIX, take a look at Qmail + Vpopmail and use a virtual domain so at least your email users aren't assigned shell accounts on the server. http://www.qmail.org http://www.inter7.com Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inserting info into db
At 01:56 PM 7/29/02 +, Tyler Durdin wrote: >I have a DB that will take answers to an 82 question survey, but i have >the survey divided into 4 html pages(forms) of 20 or so question per page. >The people taking the survey are not required to fill out every question >on the survey. i was wondering how i can insert the data into the db this >way. For example, >the first html page goes to question #24 the next starts at 25 an goes to >47. How can i enter 25 to 47 into the db and keep it all in numerical >order when 1-24 are entered first? One more question, does anyone have any >recommendations on how i can make it so the users can take page one of the >survey and then come back and finish pages 2 (or something similar to this >where they finish one of the pages and come back to finish the others >later) later? Thanks in advance. If I was doing it, I would probably INSERT a mostly empty record in the database when they start the survey. It would just have the info to identify the person. Then on each page of the survey you can UPDATE the fields for that page. If you want to allow them to make changes it should be pretty easy. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: threads in Apache 1.3
At 08:04 PM 9/5/02 -0500, Richard Lynch wrote: > >I use persistant database connections and I wonder, if one connection is > >always in use by one page or by more? > >Each thread will end up having a connection. > >Actually, it will have a connection for *each* username/password combination >used to connect, if you have multiple MySQL users in mysql_pconnect(...) >More Apache children ==> More connections >More MySQL username/passwords ==> More connections > >I assume a very large ISP with hundreds of customers has to: > >A) Give them all a common/shared username/password, *OR* >B) Throw in a *LOT* of RAM to handle all the connections C) Ban persistant connections. They are great if you only have one site on a server, but too costly when there are many different username/passwords to the various databases. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: replacing mail()
>"Liam Mackenzie" <[EMAIL PROTECTED]> wrote in message >002a01c25f00$54a01050$0b00a8c0@enigma">news:002a01c25f00$54a01050$0b00a8c0@enigma... > I've spent over 6 months trying to get sendmail to work to my liking, >don't > talk to me about sendmail! > :-P I know the feeling. I use qmail now. > > > > eXtremail does the job real good ;-) > > www.extremail.com > > > > Is there any way of EASILY rewriting PHP's mail() function? No. Qmail provides a sendmail wrapper that replaces the sendmail program and injects mail onto the qmail queue. I just replaced the /sbin/sendmail program with a link to /var/qmail/bin/sendmail and all programs on the server, including PHP send mail through it. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Efficiency
At 04:41 PM 9/18/02 -0400, Support @ Fourthrealm.com wrote: >Which is more efficient? Considering that the difference in efficiency is so small, a more important question is which is clearer to the programmer? I prefer b, except that I allow short tags and use the magic print/echo function: thusly... $result = mysql_query( ... ); ?> Title PHP by itself is a fantastic template language! If you aren't doing anything else in a script, mysql_free_result is not needed in a script like this because the result set will be cleaned up by PHP when the script ends. Rick >a) a sql loop where everything is displayed/formatted using echo stmts, >like this: > >$result = mysql_query("SELECT * FROM news WHERE active=1"); >while ($row = mysql_fetch_object($result)) { > echo "$row->title "; >} >mysql_free_result($result); > >?> > > >OR >b) a sql loop where you break in and out of php tags as needed: > >$result = mysql_query("SELECT * FROM news WHERE active=1"); >while ($row = mysql_fetch_object($result)) { >?> > > title"; ?> > > >} >mysql_free_result($result); > >?> > > >Obviously, these are really simplified examples. Typically the html code >gets much more complicated. > > >Peter > > >- - - - - - - - - - - - - - - - - - - - - >Fourth Realm Solutions >[EMAIL PROTECTED] >http://www.fourthrealm.com >Tel: 519-739-1652 >- - - - - - - - - - - - - - - - - - - - - > > >-- >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] Why isn't there much info on apache2?
At 11:35 AM 9/20/02 -0400, pierre.samson wrote: >Well, I'm in no hurry, so I'll try to make it work. >It just seemed to me that with ssl and mpm's incorporated it worth the >upgrade. From today's Apache week newsletter: "the Apache 2.0 interface is still undergoing steady change, " Don't expect to see a stable PHP for Apache 2 until the interfaces stop changing with almost every version. There is great work being done on PHP for Apache 2, but it seems to need to be updated with every new version of Apache, and they are coming out fast and furious. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache 1.3.26 + PHP 4.2.3
At 01:54 PM 10/1/02 +0200, Erwin wrote: >James Mackie wrote: > > Since I installed apache from source and not an RPM I do not have an > > rc file that the service command would use. I start apache in the > > rc.local file. -USR1 should be the 'NICE' way to reload the > > configuration files as per the apache documentation and has worked > > for many versions. Its just with PHP 4.2.3 that it stops working. > >Is "apachectl graceful" an option? >apachectl resided in the apache installation dir. From apachectl... graceful) if [ $RUNNING -eq 0 ]; then ... ... else if $HTTPD -t >/dev/null 2>&1; then if kill -USR1 $PID; then ^ I don't think apachectl will help, since it uses kill -USR1 to do a graceful restart. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
At 09:25 AM 10/15/02 -0500, Chris Boget wrote: >Let me preface this by saying that I know the benefits of using >XML It seems to me most of the benefits of XML actually go to the hardware and network suppliers. They get to sell you bigger storage for the bloated data, faster processors for the mindless transformations and bigger pipes to transfer all the extra markup in an XML file. XML has its place in simplifying data exchange (if both parties can find or agree on a common schema) and things like the PHP documentation where there is a real need to present one source document several different ways. Why waste space in a database with XML. The database already is one of the most efficient ways to store the data. So no XML for storage. Unless you have more than one way you need to present the data on your web pages you are wasting both your time, and processor time trying to add XML into the mix. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & XML
At 09:25 AM 10/15/02 -0500, Chris Boget wrote: > Do you realize more benifit for the back end > processes when using XML that makes any additional time it takes > to display a page to the user worth it? Just ask the user if they really want to wait longer for something they can't even see, just so you can use the latest buzzword in describing your site. I'm sure they'll say NO! It is never worth anything that makes it take longer to display a page to the user. Sorry I missed this in the last message... it is important. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Enum table entry
At 11:48 PM 10/18/02 -0500, Shiloh Madsen wrote: For instance, a series of checkboxes with items such as abjuration, conjuration, divination, and others, which will all have a numeric value which gets plugged into the enum field. for instance, if a user selected abjuration, and divination, it would be plugged into sql as 1, 3 Assuming your field is: school enum( 'abjuration', 'conjuration', 'divination', ... ), The database will return, 'abjuration,divination' in the example listed above, and it will expect the same kind of string when setting the field in an UPDATE or INSERT query. (or however enum data is input into its column). That being the case how do i utilize php to get this to work? what kind of form elements etc... The problem im seeing with checkboxes are that they are discreet and dont group together, so i cant get all the data to go into one column in mysql. Hopefully i havent horribly confused the issue and some kind soul out there can tell me how to send this data across. As a double nice thing...how would you write it to pull the data back out...ie, convert 1, 3 to show abjuration, divination? Thanks for the help in advance. To get the data in/out of the database you can do something like this: Start with an array of possible choices, because you are going to have to act on each possible choice. $SchoolChoices = array( 'Abjuration', 'Conjuration', 'Divination', ... ); To setup the variables from the table for display. Note the value from the database is in the string $School. reset( $SchoolChoices ); while( list( , $Choice ) = each( $SchoolChoices )) { $VarName = 'School' . $Choice; $$VarName = ereg( $Choice, $School ) ? 'CHECKED' : ''; } Now you can send the form displayed below with the values from the database. "> "> "> ... === After the user enters the form, you can decode the fields and put the data into a string for storage in the database with: reset( $SchoolChoices ); $School = ''; while( list( , $Choice ) = each( $SchoolChoices )) { if( 'on' == $_get( "School$Choice" )) { $School .= ',' . $Choice; } } $School = substr( $School, 1 ); Now you can INSERT/UPDATE the database with $School to set the enum field. You can create the checkbox fields from $SchoolChoices with the following: reset( $SchoolChoices ); while( list( , $Choice ) = each( $SchoolChoices )) { $VarName = 'School' . $Choice; echo ""; } For extra credit, figure out how you can create the $SchoolChoices array from the output of the following query: DESCRIBE TableName School; (Yes you can send this to mysql_query, and get the possible values of the enum.) Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Most current non-beta version, and bcc
At 02:38 PM 11/7/02 -0600, Jill S wrote: so again I'll ask - Are the 4.2.3 downloads at the top of the page at: http://www.php.net/downloads/ "beta versions" or non-"beta" versions? 4.2.3 is currently the latest stable released version of PHP. Yes, that means NOT BETA. Anything that makes it to the downloads page is stable code. 4.3.0 should be out soon, but is not yet considered stable. It has also passed the BETA state and is in its second pre-release final testing. If you want to get it you have to look at snaps.php.net or the CVS server. Code from these sources is under active development and at any given time may not even compile. (Not that it happens often.) I can understand why a hosting provider might not want to run them. On the other hand I switched to PHP4 at Beta 2 and never looked back. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Includes vs. Functions
At 09:20 PM 7/17/02 -0500, Michael Sims wrote: >$superglobals = array("var1", "var2", "var3", "var4", "var5", "..."); > >Now inside the function you can do this: > >function somefunction ($somevar) { > > global $superglobals; > foreach($superglobals as $varname) { > global $$varname; //resolves to $var1, $var2, $var3, etc. > } > > //Other stuff here > >} You're working too hard! function somefunction( $somevar ) { global $suberglobals; extract( $superglobals ); //Other stuff here } Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP-DB] Fatal error: Call to undefined function: pg_connect() in .....
At 11:02 PM 7/18/02 -0300, you wrote: >Is PostgreSQL started with the -i switch? (I think that's the one; it >exposes it to tcp/ip connections.) Check your PGSQL docs to be certain. This is not the problem. >Have you run a page with phpinfo? Is PostgreSQL support compiled into your >installation of PHP? This is a file consisting of >, named phpinfo.php. Again, I'm doing this from memory but >I'm pretty certain of the function name. phpinfo() is correct, but not needed. "Call to undefined function" means that PHP was not compiled with this function. Your best bet is to trash the RPM and compile PHP and possibly Apache from the distribution tarball. You can bang you head against various combinations of RPMs for weeks and never find the right combination, or spend a couple hours collecting the requirements and learning to compile the source. Once I got it down I can compile OpenSSL, Apache, ModSSL PHP and all the goodies that go along with it in about 45 minutes, and I don't even have to be there for most of it. I've got a script that compiles it with all the options I chose. I just collect the latest versions, check for new options I might want to use, plug the new version numbers into the top of the script, run it and go find something else to do while it runs. Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] logging page views, which method is better????
And the answer about merging logs for webalizer is: > Is there a way to create a combined report showing hits to a number of > separate servers all handling the same web sites. > > I am guessing all you have to do is feed it each of the log files in > turn, and make sure you don't duplicate them. I think it requires not > using incremental mode, but I hope you know for sure. I am in the > process of recommending it on the php-general mailing list. Q: I have multiple load-balanced servers (or I'm using DNS round-robin to accoplish the same thing) and I want to generate one webalizer report for the whole farm, but each server generates its own log file. When I run webalizer on each of the logfiles in turn, it ignores a lot of the records because it thinks they're out of order! A: You need to merge all of the logfiles together so that webalizer sees the records in chronological order. One good way to do that on the fly is with mergelog (http://mergelog.sourceforge.net/), a quick common logfile sorter. An example: mergelog .log .log .log | webalizer -- Bradford L. Barrett [EMAIL PROTECTED] A free electron in a sea of neutrons DoD#1750 KD4NAW The only thing Micro$oft has done for society, is make people believe that computers are inherently unreliable. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]