Re: [PHP] [php] explode that :) !
* Thus wrote John Taylor-Johnston ([EMAIL PROTECTED]): $P1OC1Q1 = 1¶some text or some comment; echo trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶); echo $score[0]./td/tr\n; Do I have to go through all that to get score[0] ? substr($P1OC1Q1, 0, strpos($P1OC1Q1, '¶')-1) That will return every thing to the left of '¶'. and '' if nothing is there without complaining. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] substr ?
Sorry, scrap that: if (substr_count($mystring,¶) 0) John Taylor-Johnston wrote: How can I find out if $mystring includes the character ¶? Thought substr would do it? J -- John Taylor-Johnston - If it's not open-source, it's Murphy's Law. ' ' ' Collège de Sherbrooke: ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke: http://compcanlit.ca/ 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions
Thank you all for your help. I solved the problem using session_save_path(/some/dir/) in php script. But now I have another question. Every time when I'm using .htaccess file and try to connect to my site I get this message: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. When I put in .htaccess file: php_value session.save_path /full/path/to/your/own/tmp/directory as you told me, I get the same message and in my error_log I get this message: [Sun Aug 17 12:31:42 2003] [alert] [client 213.240.5.14] /home2/pena/public_html/.htaccess: Invalid command 'php_value', perhaps mis-spelled or defined by a module not included in the server configuration Thank you again! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions
Thank you all for your help. I solved the problem using session_save_path(/some/dir/) in php script. But now I have another question. Every time when I'm using .htaccess file and try to connect to my site I get this message: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. When I put in .htaccess file: php_value session.save_path /full/path/to/your/own/tmp/directory as you told me, I get the same message and in my error_log I get this message: [Sun Aug 17 12:31:42 2003] [alert] [client 213.240.5.14] /home2/pena/public_html/.htaccess: Invalid command 'php_value', perhaps mis-spelled or defined by a module not included in the server configuration Thank you again! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] explode that :) !
Hi, Sunday, August 17, 2003, 12:58:23 PM, you wrote: JTJ $P1OC1Q1 = 1¶some text or some comment; JTJ echo trtdYour score is: /tdtd; $score=split($P1OC1Q1,¶); echo $score[0]./td/tr\n; JTJ Do I have to go through all that to get score[0] ? JTJ John if the number is always first and an integer: echo trtdYour score is: /tdtd.intval($P1OC1Q1)./td/tr\n; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] indexing a folder
Hi, How can i index a folder that's not on my server? With indexing, i mean getting a list of all files in that folder... Thx a lot Cadish -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 17 Aug 2003 09:15:18 -0000 Issue 2241
php-general Digest 17 Aug 2003 09:15:18 - Issue 2241 Topics (messages 159805 through 159830): Re: redhat 8: upgrade php from 4.2.2 to 4.3.2 159805 by: Jaap van Ganswijk Sessions 159806 by: Peda 159807 by: Jaap van Ganswijk 159809 by: Curt Zirzow 159811 by: Jaap van Ganswijk 159812 by: Wouter van Vliet 159815 by: Curt Zirzow 159816 by: Jason Sheets 159827 by: Peda 159828 by: Peda Re: imagecreatefromjpeg() problems 159808 by: Jaap van Ganswijk Re: better understanding of ereg_replace and other functions 159810 by: Curt Zirzow 159814 by: Jaap van Ganswijk Have I over done this? 159813 by: John Taylor-Johnston [php] explode that :) ! 159817 by: John Taylor-Johnston 159818 by: jabber.raditha.com 159819 by: John Taylor-Johnston 159820 by: Mike Migurski 159821 by: Sævar Öfjörð 159822 by: John Taylor-Johnston 159823 by: John Taylor-Johnston 159825 by: Curt Zirzow 159829 by: Tom Rogers substr ? 159824 by: John Taylor-Johnston 159826 by: John Taylor-Johnston indexing a folder 159830 by: Cadish 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] -- ---BeginMessage--- At 2003-08-15 09:31 -0700, Chris W. Parker wrote: Hello eveyone. I want to upgrade my php install from 4.2.2 to 4.3.2. I'm pretty new to linux so I don't know how to install from source and I haven't been able to find any Redhat 8 rpm's. Can someone please give me instructions as to what I should do? (Maybe links to a site where I can find the correct rpm file or instructions on how to install a new version of php from source.. etc.) I have just upgraded my (Mandrake) system by doing: - Upgrading from Mandrake 9.0 to 9.1 using the CD's that came with the UK Linux Format magazine of june 2003: www.linuxformat.co.uk - Then I installed the Apache Source version 2.0.45 from the CD-ROM that came with PHP Magazine 4.2003 www.php-mag.net and I compiled it, which went very smoothly - Then I installed the PHP Source version 4.3.2 from the same CD-ROM and compiled it. (Which takes more tinkering.) The complete process took a while, especially because I first tried to install from binaries, but it works very well now, including a GD that supports true color images etc. I'm not saying that I think that Mandrake is currently better than RedHat, but when I switched from Redhat (5.2 or 6?) to Mandrake 7.2 (?) some years ago it's installation process was even simpler than that of RedHat (on which it is based). In my experience it's a lot of work to upgrade all the libraries by hand, because they are much too interdependent and hard to locate on the WWW. Some tips: - Install Apache and PHP from source. - Reboot your computer from time to time between installing things and changing .ini and .conf files, just restarting Apache is sometimes not enough it seems. - Put a personal readme file in each directory, describing what you did to get things working. (This will help a lot next time.) BTW. There is a separate mailing list about installing PHP. You'd better ask there and look in it's archive etc. Greetings, Jaap ---End Message--- ---BeginMessage--- Hi!! I have some problem on my site. When I'm using this PHP script: ?php session_start(); session_register( aUser, aAccount ); $aUser = Cidnie; $aAccount = 1016; ? html head titleGetting Started With Sessions: Page 1/title /head body ?php print( Current User: $aUserbr ); print( Current Account: $aAccountbr ); ? brbr a href=listing2.phtmlGo to page 2/a /body /html I'm getting this warning messages: Warning: session_start(): open(/tmp/sess_cbd07ca5b53347ca5003404053754bde, O_RDWR) failed: Permission denied (13) in /home2/pena/public_html/listing1.php on line 2 Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home2/pena/public_html/listing1.php:2) in /home2/pena/public_html/listing1.php on line 2 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home2/pena/public_html/listing1.php:2) in /home2/pena/public_html/listing1.php on line 2 Warning: Unknown(): open(/tmp/sess_cbd07ca5b53347ca5003404053754bde, O_RDWR) failed: Permission denied (13) in Unknown on line 0 Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 It looks like I don't have permission to write in /tmp/ directory. Can I change that permission? Greetings, Peda!!! ---End Message--- ---BeginMessage--- At 2003-08-16 23:28 +0200, Peda wrote: I have
[PHP] first time using exec() - are getting parse error.
Hi, I'm trying to call mysqldump from within a php-script, like this: $backuptime = date(ymdHi); $backupfile = un . $backuptime . .txt; exec(mysqldump --opt -u$dbuser -p$dbpassword $dbdatabase $alltables /web/un/backup/$backupfile); It works fine on my local Win2k, php 4.3.1, but not on my ISP:s Sun Solaris/php 4.3.2 machine I get a parse error. What am I doing wrong? Is there a better way to backup my database? -- anders thoresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] first time using exec() - are getting parse error.
At 12:06 17-8-2003, you wrote: Hi, I'm trying to call mysqldump from within a php-script, like this: $backuptime = date(ymdHi); $backupfile = un . $backuptime . .txt; exec(mysqldump --opt -u$dbuser -p$dbpassword $dbdatabase $alltables /web/un/backup/$backupfile); It works fine on my local Win2k, php 4.3.1, but not on my ISP:s Sun Solaris/php 4.3.2 machine I get a parse error. What am I doing wrong? Is there a better way to backup my database? I made a script to use mysqldump (in my script the result is send as an email attachment, with a debug option so it tells you what may be wrong. In your case, it is possible that mysqldump is not in the path, or even absent. Read the comments in the script. It needs some time to set up, with all the paths and other settings. http://www.hieris.info/over/backup/backup.php.txt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with sessions - IE working after session.use_trans_sid enabled.
Hi, I've had some problems with Internet Explorer not working on the site I'm building at the moment. At my local system it worked, but not on my ISP. After comparing the session settings, only use_trans_sid differed: enabled at my local system, disabled at remote. Before I changed anything IE worked only when accessing the site at my local host, while Opera managed to access it both local and from my ISP. After enabling session.use_trans_sid in my .htaccess on my ISP, Internet Explorer can be used even there. Ok. I've solved my problem, but don't really understand how session.use_trans_sid made the difference? -- anders thoresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mod_php issues with security or stablility?
Hello, I work for a large web hosting company and we currently use php.cgi. We are considering changing to use mod_php. Is anyone aware of any security issues with using mod_php? Are there any stability issues? Theoretically, could a customer write php code that could crash Apache? Any other pros or cons to mod_php vs. php.cgi? We have been using php as a cgi for many years and no one seems to remember why we starting running it as a cgi rather than an Apache module. Thanks, Lane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Any IMAP portal system
Hi! Is there any PHP Portal system (scripts) that have IMAP/SMTP, calendar, notebook and other utilities build in to it alongwith other general portal utilities? Any information would be of great help. Thanks Dasmeet -- Domainwala.com Domain Names from $7.99 at http://www.domainwala.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] first time using exec() - are getting parse error.
anders thoresson wrote: Hi, I'm trying to call mysqldump from within a php-script, like this: $backuptime = date(ymdHi); $backupfile = un . $backuptime . .txt; exec(mysqldump --opt -u$dbuser -p$dbpassword $dbdatabase $alltables /web/un/backup/$backupfile); It works fine on my local Win2k, php 4.3.1, but not on my ISP:s Sun Solaris/php 4.3.2 machine I get a parse error. What am I doing wrong? Is there a better way to backup my database? What is the error you get? Print out the command you're trying to run to make sure it looks right. Remember that commands run as the web server user, so ensure that use has permission to run mysqldump. You may need to provide the complete path to mysqldump. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals - www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] indexing a folder
Cadish wrote: How can i index a folder that's not on my server? With indexing, i mean getting a list of all files in that folder... http://us2.php.net/manual/en/ref.dir.php -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] first time using exec() - are getting parse error.
What is the error you get? Problem solved: it was a combination of permissions and wrong options. -- anders thoresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions
Peda wrote: Thank you all for your help. I solved the problem using session_save_path(/some/dir/) in php script. Just one thing to note: If you set the session save_path in your file using this method or ini_set, then there will not be any automatic garbage collection. You'll have to do that yourself. But now I have another question. Every time when I'm using .htaccess file and try to connect to my site I get this message: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. When I put in .htaccess file: php_value session.save_path /full/path/to/your/own/tmp/directory as you told me, I get the same message and in my error_log I get this message: [Sun Aug 17 12:31:42 2003] [alert] [client 213.240.5.14] /home2/pena/public_html/.htaccess: Invalid command 'php_value', perhaps mis-spelled or defined by a module not included in the server configuration Looks like your ISP will not allow you to set php values in an .htaccess file. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] substr ?
John Taylor-Johnston wrote: Sorry, scrap that: if (substr_count($mystring,) 0) John Taylor-Johnston wrote: How can I find out if $mystring includes the character ? Thought substr would do it? J strpos() would be better... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions
well .. that's odd. I use the same directive multiple times without any problems. The error tells that it thinks the php module which should provide this directive is not available. Odd thing is that you can run PHP scripts, so the PHP module is loaded .. so to speak. Somebody got a clue on this one? Maybe php was compiled without support for this directive .. or smth? Wouter -Oorspronkelijk bericht- Van: Peda [mailto:[EMAIL PROTECTED] Verzonden: zondag 17 augustus 2003 8:57 Aan: [EMAIL PROTECTED] Onderwerp: Re: [PHP] Sessions Thank you all for your help. I solved the problem using session_save_path(/some/dir/) in php script. But now I have another question. Every time when I'm using .htaccess file and try to connect to my site I get this message: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request. When I put in .htaccess file: php_value session.save_path /full/path/to/your/own/tmp/directory as you told me, I get the same message and in my error_log I get this message: [Sun Aug 17 12:31:42 2003] [alert] [client 213.240.5.14] /home2/pena/public_html/.htaccess: Invalid command 'php_value', perhaps mis-spelled or defined by a module not included in the server configuration Thank you again! -- 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] How to connect to DB
Take out the @ so you can see what error is returned. Echo your defines to confirm that you are getting what you expect. Double check that you have the browser set to refresh on every call to a page. Clear your cache. Use the header() function to add code at the top of the page to force a refresh. HTH - Miles At 04:42 PM 8/16/2003 +0530, murugesan wrote: Hello all, I have some existing php pages already. Now I want to change the DB to point to another DB. I have changed the include_path in php.ini file to point to /home/config Also I changed the constant db_name defined in a file in /home/config/con.php to point to new DB. [snip] include con.php @mysql_pconnect(db_host,db_user,db_pass); mysql_select_db (db_name) or die (could not select db); //contents of con.php ?php define('db_host','localhost'); define('db_name','newdb') ; define('db_user','scott') ; define('db_pass','tiger') ; define('db_type','mysql') ; ? Also I restarted the apache. But it is still accessing the old DB. What are all the changes that I have to make. other than these changes. Regards, Murugesan. -- 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] indexing a folder
Thanks, but is this also possible for directories not on my server? Or can i just use these functions? John W. Holmes [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Cadish wrote: How can i index a folder that's not on my server? With indexing, i mean getting a list of all files in that folder... http://us2.php.net/manual/en/ref.dir.php -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod_php issues with security or stablility?
mod_php is the recommended installation for Apache. Thousands of people use mod_php with Apache. When I switched to mod_php from CGI I saw a significant performance increase, also you can not use things like Turck MMCache in CGI mode. In short not that I'm aware of, you might google for it but you should be fine. On cavaeat is with CGI PHP can execute as the owner of the script, with mod_php it executes as the web server. Jason Lane Vance wrote: Hello, I work for a large web hosting company and we currently use php.cgi. We are considering changing to use mod_php. Is anyone aware of any security issues with using mod_php? Are there any stability issues? Theoretically, could a customer write php code that could crash Apache? Any other pros or cons to mod_php vs. php.cgi? We have been using php as a cgi for many years and no one seems to remember why we starting running it as a cgi rather than an Apache module. Thanks, Lane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod_php issues with security or stablility?
Jason Sheets wrote: On cavaeat is with CGI PHP can execute as the owner of the script, with mod_php it executes as the web server. IMHO, the biggest difference between the two as far as security is concerned in favour for CGI. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mod_php issues with security or stablility?
It's mostly just a wild guess .. but when I think about linking php.cgi/mod_php question to Peda's one about sessions, and later being unable to use php_value in a .htaccess file.. Is it likely that Peda's server runs php.cgi instead of mod_php? can somebody confirm this? Wouter -Oorspronkelijk bericht- Van: Gerard Samuel [mailto:[EMAIL PROTECTED] Verzonden: zondag 17 augustus 2003 17:35 Aan: Jason Sheets CC: [EMAIL PROTECTED]; [EMAIL PROTECTED] Onderwerp: Re: [PHP] mod_php issues with security or stablility? Jason Sheets wrote: On cavaeat is with CGI PHP can execute as the owner of the script, with mod_php it executes as the web server. IMHO, the biggest difference between the two as far as security is concerned in favour for CGI. -- 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] Parsing HTTP_USER_AGENT
Hello: What I'm trying to do is parse the HTTP_USER_AGENT into formatted text. Here's an example: PHP gets user's browser and OS through with HTTP_USER_AGENT. The output should only say: You are running on Windows XP and using IE6! How would I parse this. One example would be fine. I know I have to do it for every possibility, right? Is there a way for me to do it so that, it only outputs the major browsers such as Mozilla, Opera, Netscape or IE? Also, what would I do to parse the OS? Finally, here is the project I'm working on: http://members.lycos.co.uk/xtrinity/golucky/image.php I'm trying to make it like Vipersig: http://www.danasoft.com/vipersig.jpg Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] indexing a folder
Cadish wrote: Thanks, but is this also possible for directories not on my server? Or can i just use these functions? Missed that bit, sorry. If the directory is not on your server, then you need to go through FTP. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validate The Last Day of Month with server's clock????
And the reason I quoted 'usual' is that my suggestion is more portable. On Thursday 14 Aug 2003 11:54 am, Ford, Mike [LSS] wrote: On 13 August 2003 20:05, Nicholas Robinson wrote: On Wednesday 13 Aug 2003 8:00 pm, Scott Fletcher wrote: Hi! Here's a trick script. We know that some months have the last day which is 30 while other is 31. As for February, it can be either 28 or 29. So, what's the trick in using the php to find out what is the last day of the month if you want to checked it against the server's clock to find out the last day of the month. Suppose it is this month or 3 months ago or 3 months from now. Anyone know? The 'usual' trick is to set the date to the first day of the month after the one you want and then subtract one day. Actually, the usual trick is to ask mktime() for the 0th day of the following month. One of the examples on the mktime() page of the manual (http://www.php.net/mktime) even illustrates exactly this. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Chris-Re: [PHP] Category and sub-category logic
Hey, Sorry I didnt reply, was having some computer problems. Thanks for the link and the advise, will look into it. Cheers, -Ryan We will slaughter you all! - The Iraqi (Dis)information ministers site http://MrSahaf.com - Original Message - From: Chris W. Parker [EMAIL PROTECTED] To: David Otton [EMAIL PROTECTED]; Ryan A [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Friday, August 15, 2003 2:04 AM Subject: RE: [PHP] Category and sub-category logic David Otton mailto:[EMAIL PROTECTED] on Thursday, August 14, 2003 4:58 PM said: The advantage of doing it this way is that your tree structure is generic and can have many levels. The disadvantage is that you may need many SQL queries to fully traverse the tree (though people rarely want to do this, and sub-selects, clever joins or post-query processing can reduce the overhead). Which is why you should use the Modified Preorder Tree Traversal method instead. With that method you've got one table that defines the categories AND their relationships to each other. Your SQL queries end up looking something like this. SELECT name FROM categories WHERE lft = x AND rgt = y Chris. -- 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] mystical parse error message
does someone know wtf this message means ? Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM i hope my fbsd box isnt haunted or controled by a daemon... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mystical parse error message
Hi Ohmer, T_PAAMAYIM_NEKUDOTAYIM is the incomprehensible name given to the :: operator. However, if you use the tokenizer extension like so: ?php $a = '?php name::thing() ?'; $b = token_get_all($a); echo(token_name($b[3][0])); ? You'll see T_DOUBLE_COLON - a much more descriptive name :). So, look for an accidental double colon, perhaps in a case statement switch (blah) { case something :: } Regards, Greg Ohmer wrote: does someone know wtf this message means ? Parse error: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM i hope my fbsd box isnt haunted or controled by a daemon... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing HTTP_USER_AGENT
Greetinx, on 2003.08.17 07:29, AzN at [EMAIL PROTECTED] wrote: http://www.danasoft.com/vipersig.jpg Says I know kung fu., haha. Strikes me that I'm mistakenly located somewhere in China instead of Japan. ;P hAj http://advancedmeta-metaphorofapagan.net ||| ||| || || || || Seij minus aÇ http://seijminusac.net = '(music of) a negative scalar dimension w/in desolate silence' | | | | | | | gene of Cube http://geneofcube.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Discussion: do you consider null a value or strictly a type?
There has been a recent thread on the internals list as to the meaning and usage of the null datatype. Zeev claims, perhaps rightly so, the following: Zeev wrote: null is not a value, was never meant to be a value, and won't be a value Interestingly though, the PHP documentation at http://www.php.net/manual/en/language.types.null.php indicates the following: The special NULL value represents that a variable has no value. NULL is the only possible value of type NULL. Which is obviously contradictory since it claims to be a variable having no value and yet also claims it is a special value. Also the following snippet from: http://www.php.net/manual/en/language.operators.assignment.php seems to also indicate that null is a value -- namely: The basic assignment operator is =. Your first inclination might be to think of this as equal to. Don't. It really means that the the left operand gets set to the value of the expression on the rights (that is, gets set to). The above reference might not be obvious, but since you can assign the null constant, then it says the left operand gets set to the value of... seemingly indicating that null is a value. Now the point of the discussion is not to indicate who is right or who is wrong -- that would appear to be a ridiculous argument. I am more interested in finding out the practices and experience of PHP developers. I'd like to know how many people treat null as a value, and how many do not. For instance to you ever assign default values of null to instance variables, or local variable, or array entries? I know in practice that I have, and find it quite convenient to represent a default value. Cheers, Rob. -- .-. | Worlds of Carnage - http://www.wocmud.org | :-: | Come visit a world of myth and legend where | | fantastical creatures come to life and the | | stuff of nightmares grasp for your soul.| `-' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Efficient structure
I have multiple types of information to associate to one object. I have data structures that store data structures. What is the best/most efficient way to structure the data? A multi-dimensional array? A container object? Please Advise... /T
[PHP] re: shell_exec
All I want to do is execute a perl script. I do not care about output to browser. I have used shell_exec, system, exec, and backticks with no avail. Here is what i have now in my php page. shell_exec(perl data/addSite.pl . /tmp/error ); I know the perl script executes because a basic print statement in the perl script is outputted to /tmp/error. However anything else in the script not having to do with output is not executed. The perl script is basically supposed to add a file. That is it. The perl script is fine from command line. All paths are correct and like I said I do not care about output to the browser for the user. My questions is why does the perl script execute (and mostly work) but not execute certain pieces of code when executed from my php page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Semi-Newbie question about arrays
I'm trying to create a multidimensional array of values to update a Filemaker db. Edits to existing fields end in numbers (the record ID).I'm having a problem, probably obvious to anyone here in setting up the multidimensional array: $updateEntries = array(); //stores existing db entries $ord = -1; $recNum = 0; foreach ($_POST as $key = $value) { if ($value != ) { $lastPartPos = strrchr($key, '_'); $lastPart = substr($lastPartPos, 1); if (preg_match(/[0-9]+/ , $lastPart)) { //if it's an existing update $lastpartnum = strrpos($key, '_'); $firstnum = substr($key, 0, $lastpartnum); $first = str_replace('_', '.', $firstnum); //restore periods to field name and strip off record ID at end if ($lastPart != $recNum) { $recNum = $lastPart; $ord++; $updateEntries[$ord] = $recNum; } $updateEntries[$ord][] = array($first, $value); //populate nested arrays of each entry etc.. throws: PHP Fatal error: [] operator not supported for strings How do I make $updateEntries[$ord] evaluate as an array? Thanks in advance RG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Nestled 'while's or 'for's or 'foreach's -- I'm lost
Hi, somewhat newbie warning :) I'm trying to take a paged result set and divide it into two chunks for displaying on the page. Basically making something that looks like a typical thumbnail gallery. I'm limiting my result set to 6 records and want to display it as 2 rows of 3 cells with a record in each cell. I've had no trouble getting my result set, paging etc. I'm not having much luck splitting my result into 2 chunks. I've tried nestling 'while' statements with a number of arguments and either end up with no results or a loop that seemingly never ends. That lead me to looking at some other apps which seemed to use a variety of ways to achieve what I want. That lead me to looking at 'for' and 'foreach' in the php manual. And that lead me to being more confused than I was before I started ;) Sometimes there's just too many ways to skin a cat, eh! Below, I've include a rather lengthy bit of pseudo code that represents basically where I'm at now. This particular version returns no results, though I know it's just the nestled while's that are causing this. The results are there. My research makes me think that I should replace the nestled while's with 'foreach's. I was kind of hoping that before I spend a few hours trying to puzzle out how to use the 'foreach's correctly that somebody would venture an opinion as to whether or not that would be the way to go. Thanks in advance for any advice, Verdon -- pseudo code -- ?php $limitPerPage = 6 ; $initStartLimit = 0; if (!isset( $startLimit )) { $startLimit = $initStartLimit ; } $querylimit = limit $startLimit,$limitPerPage ; $nextStartLimit = $startLimit + $limitPerPage ; $previousStartLimit = $startLimit - $limitPerPage ; if ( $sortby != ) { $sorted = order by $sortby ; } $bareQuery = select * from pieces order by rank; $queryall = $bareQuery .$sorted .$querylimit; $resultall = mysql_query ($queryall); $numberall = mysql_numrows ($resultall); if ( $numberall == 0) { echo No Records Found ! ; } else if ( $numberall 0) { $x = 0; echo h2Page of Pieces/h2; while ( $x $numberall ) { // Retreiving data and putting it in local variables for each row $id = mysql_result ($resultall ,$x ,id); $title = mysql_result ($resultall ,$x ,title); $description = mysql_result ($resultall ,$x ,description); $thumb = mysql_result ($resultall ,$x ,thumb); $company = mysql_result ($resultall ,$x ,company); echo table cellspacing=\0\; echo tr; while ($x = 0 $x 4) { echo td; if ($thumb) { echo thumbnail with a link; } else { echo text with a link; } echo br /strong$title/strong; echo br /$company; echo br /$description; echo /td; $x ++; } echo /tr; echo tr; while ($x 3 $x $numberall) { echo td; if ($thumb) { echo thumbnail with a link; } else { echo text with a link; } echo br /strong$title/strong; echo br /$company; echo br /$description; echo /td; $x ++; } echo /tr; echo /table; $x ++; } // end while echo /tablebr /; echo div class=\footLinks\; echo Previous links; echo Next links; echo /div; }// end if numberall 0 ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nestled 'while's or 'for's or 'foreach's -- I'm lost
On Sun, 17 Aug 2003 15:47:04 -0400, you wrote: I'm trying to take a paged result set and divide it into two chunks for displaying on the page. Basically making something that looks like a typical thumbnail gallery. I'm limiting my result set to 6 records and want to display it as 2 rows of 3 cells with a record in each cell. I've had no trouble getting my result set, paging etc. I'm not having much luck splitting my result into 2 chunks. I've tried nestling 'while' statements with a number of arguments and either end up with no results or a loop that seemingly never ends. That lead me to looking at some other apps which seemed to use a variety of ways to achieve what I want. That lead me to looking at 'for' and 'foreach' in the php manual. And that lead me to being more confused than I was before I started ;) Sometimes there's just too many ways to skin a cat, eh! Below, I've include a rather lengthy bit of pseudo code that represents basically where I'm at now. This particular version returns no results, though I know it's just the nestled while's that are causing this. The results are there. My research makes me think that I should replace the nestled while's with 'foreach's. I was kind of hoping that before I spend a few hours trying to puzzle out how to use the 'foreach's correctly that somebody would venture an opinion as to whether or not that would be the way to go. $data = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'); $rowlength = 3; echo (table); for ($i = 0; $i sizeof ($data); $i += $rowlength) { echo (tr); for ($j = 0; $j $rowlength; $j++) { if (isset ($data[$i+$j])) { echo (td{$data[$i+$j]}/td); } else { echo (tdnbsp;/td); } } echo (/tr); } echo (/table); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nestled 'while's or 'for's or 'foreach's -- I'm lost
OK, Difficult to see from your pseudo code EXACTLY what it is that you want to do, but I'll take a stab anyway... Firstly, instead of using your elaborate ways of running through the result set and extracting the variables, use something like this: $sql = whatever; $result = mysql_query($sql); echo 'tabletrtdID/td.../tr while ($myrow = mysql_fetch_assoc($result)) { extract($myrow); //or $id = $myrow[id]; etc. ... //construct your table here echo 'trtd'.$id.'/td.../tr'; ... } echo '/table'; You must also remember that in cases where you do limit queries, and want to continue on the next page, you must remember that your result will NOT contain the next page's data. You will need to do another query with the new limit data. It *looks* like this is what you are in fact attempting in your code, just making sure... In your case, I would say the easiest is to call the page onto itself. Ie, your first query will be $sql = whatever limit 0,6; it will return the (maximum) 6 rows and then, on your next link you should include the data for the next query. Ie, create a link like this: a href=same_page.php?limit=xstart=yNext/a Meaning that you call up the same page that you used to display the first query results, but you pass it different values for the start and limit numbers in the query ( x,y ). To recap, one of you biggest mistakes in the pseudo code below is that you open a the table inside the while and close it as well (which is fine if you want to create a table for each row you display , BUT, you close the table again AFTER the while, that *could* cause the HTML to freak out. So, the reason your app is not working is probably not PHP related, but related to the fact that you are creating erroneous HTML with your PHP. The pseudo code you are using *should* work, although, as I stated above, there are easier and more efficient ways of doing the same thing as per my example... -Original Message- From: Verdon vaillancourt [mailto:[EMAIL PROTECTED] Sent: Sunday, August 17, 2003 9:47 PM To: 'PHP-General' Subject: [PHP] Nestled 'while's or 'for's or 'foreach's -- I'm lost Hi, somewhat newbie warning :) I'm trying to take a paged result set and divide it into two chunks for displaying on the page. Basically making something that looks like a typical thumbnail gallery. I'm limiting my result set to 6 records and want to display it as 2 rows of 3 cells with a record in each cell. I've had no trouble getting my result set, paging etc. I'm not having much luck splitting my result into 2 chunks. I've tried nestling 'while' statements with a number of arguments and either end up with no results or a loop that seemingly never ends. That lead me to looking at some other apps which seemed to use a variety of ways to achieve what I want. That lead me to looking at 'for' and 'foreach' in the php manual. And that lead me to being more confused than I was before I started ;) Sometimes there's just too many ways to skin a cat, eh! Below, I've include a rather lengthy bit of pseudo code that represents basically where I'm at now. This particular version returns no results, though I know it's just the nestled while's that are causing this. The results are there. My research makes me think that I should replace the nestled while's with 'foreach's. I was kind of hoping that before I spend a few hours trying to puzzle out how to use the 'foreach's correctly that somebody would venture an opinion as to whether or not that would be the way to go. Thanks in advance for any advice, Verdon -- pseudo code -- ?php $limitPerPage = 6 ; $initStartLimit = 0; if (!isset( $startLimit )) { $startLimit = $initStartLimit ; } $querylimit = limit $startLimit,$limitPerPage ; $nextStartLimit = $startLimit + $limitPerPage ; $previousStartLimit = $startLimit - $limitPerPage ; if ( $sortby != ) { $sorted = order by $sortby ; } $bareQuery = select * from pieces order by rank; $queryall = $bareQuery .$sorted .$querylimit; $resultall = mysql_query ($queryall); $numberall = mysql_numrows ($resultall); if ( $numberall == 0) { echo No Records Found ! ; } else if ( $numberall 0) { $x = 0; echo h2Page of Pieces/h2; while ( $x $numberall ) { // Retreiving data and putting it in local variables for each row $id = mysql_result ($resultall ,$x ,id); $title = mysql_result ($resultall ,$x ,title); $description = mysql_result ($resultall ,$x ,description); $thumb = mysql_result ($resultall ,$x ,thumb); $company = mysql_result ($resultall ,$x ,company); echo table cellspacing=\0\; echo tr; while ($x = 0 $x 4) { echo td; if ($thumb) { echo thumbnail with a link; } else {
Re: [PHP] Discussion: do you consider null a value or strictly a type?
At 03:20 PM 8/17/2003 -0400, Robert Cummings wrote: There has been a recent thread on the internals list as to the meaning and usage of the null datatype. Zeev claims, perhaps rightly so, the following: Zeev wrote: null is not a value, was never meant to be a value, and won't be a value Interestingly though, the PHP documentation at http://www.php.net/manual/en/language.types.null.php indicates the following: The special NULL value represents that a variable has no value. NULL is the only possible value of type NULL. Which is obviously contradictory since it claims to be a variable having no value and yet also claims it is a special value. Also the following snippet from: http://www.php.net/manual/en/language.operators.assignment.php seems to also indicate that null is a value -- namely: The basic assignment operator is =. Your first inclination might be to think of this as equal to. Don't. It really means that the the left operand gets set to the value of the expression on the rights (that is, gets set to). The above reference might not be obvious, but since you can assign the null constant, then it says the left operand gets set to the value of... seemingly indicating that null is a value. Now the point of the discussion is not to indicate who is right or who is wrong -- that would appear to be a ridiculous argument. I am more interested in finding out the practices and experience of PHP developers. I'd like to know how many people treat null as a value, and how many do not. For instance to you ever assign default values of null to instance variables, or local variable, or array entries? I know in practice that I have, and find it quite convenient to represent a default value. Cheers, Rob. -- Year's ago I was told that NULL means Don't know, and to take it a little further, one could argue that it represents the state of a variable, rather than its contents. Once a concrete value has been assigned, even if it is a space or a zero, the state of the variable is no longer NULL. I also think, in discussing NULLs, that we hit a limit of language - we have to refer to this not knowness as something. Thus a variable set to NULL is not like an empty bucket, more like a bucket with potential, but if you examine it reveals not 's, or 0's, but a benign vacuum. This is not a value, but it is a convenient shorthand to refer to it as such. Now, shall we discuss imaginary numbers? Cheers - Miles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] imagecreatefromjpeg() problems
Hi Jaap! Thanks for your answer, but I checked phpinfo() and it says: JPG Support Enabled Any ideas? The images are photo-like so png would make them too big. Best regards Jan-Kristian Markiewicz Jaap Van Ganswijk [EMAIL PROTECTED] skrev i melding news:[EMAIL PROTECTED] At 2003-08-16 14:35 +0200, J-K wrote: I've made a little script to make thumbnails which worked before the summer, but now I get this errormessage: bFatal error/b: Call to undefined function: imagecreatefromjpeg() in b/usr/local/others/www.stud.users/mark/gfx/create_tn.php/b on line b15/b First I thought they had done something with the servers, because I haven't touched the code. But I checked the GD-version and got this: GD Version: bundled (2.0.12 compatible) Shouldn't version 2.0.12 support imagecreatefromjpeg()? Only when jpeg support has been compiled into the PHP version that is running on your system. It doesn't seem to be. Is there any way I can get around this? Try if png support is enabled. But you'd have to convert your jpeg's I guess and png's are probably much bigger because they are non-lossy (?). But it depends on your images being photo-like and not drawing-like. Otherwise you'll have to ask your system manager to fix the problem. BTW. you shouldn't indent paragraphs in emails, because it makes quoting them very messy, or the person answering your mail has to edit out the indentations (as I have done above). Greetings, Jaap -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 17 Aug 2003 21:17:45 -0000 Issue 2242
php-general Digest 17 Aug 2003 21:17:45 - Issue 2242 Topics (messages 159831 through 159862): first time using exec() - are getting parse error. 159831 by: anders thoresson 159832 by: Chris Hayes 159836 by: John W. Holmes 159838 by: anders thoresson problem with sessions - IE working after session.use_trans_sid enabled. 159833 by: anders thoresson mod_php issues with security or stablility? 159834 by: Lane Vance 159844 by: Jason Sheets 159845 by: Gerard Samuel 159846 by: Wouter van Vliet Any IMAP portal system 159835 by: Dasmeet Re: indexing a folder 159837 by: John W. Holmes 159843 by: Cadish 159848 by: John W. Holmes Re: Sessions 159839 by: John W. Holmes 159841 by: Wouter van Vliet Re: substr ? 159840 by: John W. Holmes Re: How to connect to DB 159842 by: Miles Thompson Parsing HTTP_USER_AGENT 159847 by: AzN 159853 by: hAj Re: Validate The Last Day of Month with server's clock 159849 by: Nicholas Robinson Chris-Re: [PHP] Category and sub-category logic 159850 by: Ryan A mystical parse error message 159851 by: oHmEr 159852 by: Greg Beaver Discussion: do you consider null a value or strictly a type? 159854 by: Robert Cummings 159861 by: Miles Thompson Efficient structure 159855 by: Info.Best-IT Re: shell_exec 159856 by: John Semi-Newbie question about arrays 159857 by: Gremillion Nestled 'while's or 'for's or 'foreach's -- I'm lost 159858 by: Verdon vaillancourt 159859 by: David Otton 159860 by: Petre Agenbag Re: imagecreatefromjpeg() problems 159862 by: J-K 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] -- ---BeginMessage--- Hi, I'm trying to call mysqldump from within a php-script, like this: $backuptime = date(ymdHi); $backupfile = un . $backuptime . .txt; exec(mysqldump --opt -u$dbuser -p$dbpassword $dbdatabase $alltables /web/un/backup/$backupfile); It works fine on my local Win2k, php 4.3.1, but not on my ISP:s Sun Solaris/php 4.3.2 machine I get a parse error. What am I doing wrong? Is there a better way to backup my database? -- anders thoresson ---End Message--- ---BeginMessage--- At 12:06 17-8-2003, you wrote: Hi, I'm trying to call mysqldump from within a php-script, like this: $backuptime = date(ymdHi); $backupfile = un . $backuptime . .txt; exec(mysqldump --opt -u$dbuser -p$dbpassword $dbdatabase $alltables /web/un/backup/$backupfile); It works fine on my local Win2k, php 4.3.1, but not on my ISP:s Sun Solaris/php 4.3.2 machine I get a parse error. What am I doing wrong? Is there a better way to backup my database? I made a script to use mysqldump (in my script the result is send as an email attachment, with a debug option so it tells you what may be wrong. In your case, it is possible that mysqldump is not in the path, or even absent. Read the comments in the script. It needs some time to set up, with all the paths and other settings. http://www.hieris.info/over/backup/backup.php.txt ---End Message--- ---BeginMessage--- anders thoresson wrote: Hi, I'm trying to call mysqldump from within a php-script, like this: $backuptime = date(ymdHi); $backupfile = un . $backuptime . .txt; exec(mysqldump --opt -u$dbuser -p$dbpassword $dbdatabase $alltables /web/un/backup/$backupfile); It works fine on my local Win2k, php 4.3.1, but not on my ISP:s Sun Solaris/php 4.3.2 machine I get a parse error. What am I doing wrong? Is there a better way to backup my database? What is the error you get? Print out the command you're trying to run to make sure it looks right. Remember that commands run as the web server user, so ensure that use has permission to run mysqldump. You may need to provide the complete path to mysqldump. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals - www.phparch.com ---End Message--- ---BeginMessage--- What is the error you get? Problem solved: it was a combination of permissions and wrong options. -- anders thoresson ---End Message--- ---BeginMessage--- Hi, I've had some problems with Internet Explorer not working on the site I'm building at the moment. At my local system it worked, but not on my ISP. After comparing the session settings, only use_trans_sid differed: enabled at my local system, disabled at remote. Before I changed anything IE worked only when accessing the site at my local host, while Opera managed to access it both local and from my ISP. After enabling session.use_trans_sid in my .htaccess on my ISP, Internet Explorer can be used even there. Ok.
Re: [PHP] Discussion: do you consider null a value or strictly a type?
* Thus wrote Robert Cummings ([EMAIL PROTECTED]): Now the point of the discussion is not to indicate who is right or who is wrong -- that would appear to be a ridiculous argument. I am more interested in finding out the practices and experience of PHP developers. I'd like to know how many people treat null as a value, and how many do not. For instance to you ever assign default values of null to instance variables, or local variable, or array entries? I know in practice that I have, and find it quite convenient to represent a default value. I've never used null as a value. Basically I just use '' as a null value, which changes some logic I used vs. other languages. for instance, take these values (or non values): false, 0, '', , null if each is seperaly assigned to a variable the expression always yields the same: if ( $var) { } Which is why, I assume, the === operater was born. Although I've only used that operater maybe once or twice, because I have been used to having my logic not rely on the type of data that is stored. This also leads me to believe that the statement: if ($var === null) {} would be considered illegal or fail no matter what since null is not a value and has no type associated with it. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Efficient structure
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): I have multiple types of information to associate to one object. I have data structures that store data structures. What is the best/most efficient way to structure the data? A multi-dimensional array? A container object? Please Advise... It depends on the application you need to use the object. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] re: shell_exec
* Thus wrote John ([EMAIL PROTECTED]): I know the perl script executes because a basic print statement in the perl script is outputted to /tmp/error. However anything else in the script not having to do with output is not executed. The perl script is basically supposed to add a file. That is it. The perl script is fine from command line. All paths are correct and like I said I do not care about output to the browser for the user. My questions is why does the perl script execute (and mostly work) but not execute certain pieces of code when executed from my php page. The odds are that the perl script is running the code. The problem most likely is permissions. The web server generally (and should be) running as a different user. The user has very little permissions to the file system by default. You'll have to fix the permissions on the directoy that the perl script is trying to modify. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Semi-Newbie question about arrays
* Thus wrote Gremillion ([EMAIL PROTECTED]): $recNum = $lastPart; $ord++; $updateEntries[$ord] = $recNum; } $updateEntries[$ord][] = array($first, $value); //populate nested arrays of each entry etc.. throws: PHP Fatal error: [] operator not supported for strings How do I make $updateEntries[$ord] evaluate as an array? You'll have to add a little more structure to the array. Mabey something like: $updateEntries[$ord]['recNum'] = $recNum; $updateEntries[$ord]['values'] = array($first, $value); or $updateEntries[$ord][$recNum] = array($first, $value); Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Discussion: do you consider null a value or strictly atype?
Curt Zirzow wrote: This also leads me to believe that the statement: if ($var === null) {} would be considered illegal or fail no matter what since null is not a value and has no type associated with it. Of course, it doesn't fail, because null is a value: ?php $a = null; var_dump($a === null); ? Try that. you get true null is a value that represents nothingness, kind of a variable equivalent of the number 0. I know there's been lots of blather about whether null is a value on an intellectual level, but if it wasn't a value, you couldn't assign it to a variable. That's how programming languages work. int is a type, for example. You can't do this: $a = int; You can do: $a = (int) $b; null is not a type. You can do: $a = null; but can't do: $a = (null) $b; You have to use the type unset: $a = (unset) $b; So, null is a value of type unset in the way that PHP has been designed. The odd thing is that unset() can't be used to create a variable of type unset, the way array() is used to create a variable of type array - this is the only inconsistency. ?php $a = null; var_dump(is_null($a)); // doesn't throw a warning unset($a); var_dump(is_null($a)); // throws a warning ? It doesn't matter much what people think about it, PHP has implemented null as a value, and I actually find that quite useful. It helps to represent the difference between 0 and '' and NULL returned from a database query (yes, mysql supports all three), and also is useful in specifying default values for parameters to a function that can also accept boolean false. Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DATE insertion
Hi all, First of all, thanks to everyone who helped me with the checkbox issue. I have an issue here while trying to INSERT INTO a MySQL table a date in a DATE format (-MM-DD). Obviously saying date(Y,m,d) doesn't work. What PHP function should I use? Thanks in advanced, Cesar Aracena www.icaam.com.ar Note: The information inside this message and also in the attached files might be confidential. If you are not the desired receptor or the person responsible of delivering the message, we notify you that it's copy, distribution, keep or illegal use of the information it has it's prohibited. Therefore we ask you to notify the sender by replying this message immediately and then delete it from your computer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Question regarding Syntax
?php echo 'Email: '.'A HREF=mailto:[EMAIL PROTECTED]'.$row_rep_RS['repEmail'].'/A'; ? Obviously this isn't working. What is the proper syntax when you have to use double quotes inside the tag? Thx Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Nestled 'while's or 'for's or 'foreach's -- I'm lost
* Thus wrote Verdon vaillancourt ([EMAIL PROTECTED]): Hi, somewhat newbie warning :) I'm trying to take a paged result set and divide it into two chunks for displaying on the page. Basically making something that looks like a typical thumbnail gallery. I'm limiting my result set to 6 records and want to display it as 2 rows of 3 cells with a record in each cell. I've had no trouble getting my result set, paging etc. I'm not having much luck This can easily be done using the mod operator (%): $cols_per_page = 3; $cols_per_page_break = $cols_per_page - 1; // just to speed the loop echo table; echo trthCol Headings/th/tr; $counter = 0; while($row = db_fetch_row() ) { $new_row = $counter++ % $cols_per_page; if ($new_row == 0 ) { echo tr; // open a row } echo tdCol Data/td; if ($new_row == $cols_per_page_break ) { // close and open a row print /tr; } } // Make sure the row was closed in case of uneven recordset. if ( ( ($counter - 1) % $cols_per_page) != $cols_per_page_break ) { // close and open a row // cause we didn't close it in the loop print /tr; } echo /table; //close row and table um.. ok, so it wasnt that easy.. I made this a little more complicated than I was expecting it to be. btw, this is completely untested. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question regarding Syntax
I would encourage you to use double quotes instead of single quotes inside the PHP code. After this, you must comment HTML double quotes so the PHP engine does not consider these as part of its code. I would type your example like this: ?php echo Email: a href=\mailto:[EMAIL PROTECTED].$row_rep_RS['repEmail']./a; ? Note how the only concatenated string (using periods) is the variable $row_rep_RS[] and the double quotes inside the HTML link were commented using a backslash. HTH, Cesar Aracena www.icaam.com.ar -Mensaje original- De: Creative Solutions New Media [mailto:[EMAIL PROTECTED] Enviado el: Domingo, 17 de Agosto de 2003 08:08 p.m. Para: [EMAIL PROTECTED] Asunto: [PHP] Newbie Question regarding Syntax ?php echo 'Email: '.'A HREF=mailto:[EMAIL PROTECTED]'.$row_rep_RS['repEmail'].'/A'; ? Obviously this isn't working. What is the proper syntax when you have to use double quotes inside the tag? Thx Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -- 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] Newbie Question regarding Syntax
* Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): ?php echo 'Email: '.'A HREF=mailto:[EMAIL PROTECTED]'.$row_rep_RS['repEmail'].'/A'; ? Obviously this isn't working. What is the proper syntax when you have to use double quotes inside the tag? I usually prefer this method, its a style choice and others might argue using it.: Email: a href=mailto:[EMAIL PROTECTED] ?php echo $row_rep_RS['repEmail']; ?/a A lot easier/cleaner than to trying to concat and escape everything. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question regarding Syntax
Sorry guys.It think there is a bit of confusion. I miss typed what I need to do. $row_rep_RS['repEmail'] is actually the email address I want to turn into a link. So I guess it would look something like. ?php echo 'Email: '.'A HREF=mailto:'.$row_rep_RS['repEmail'].''.$row_rep_RS['repEmail'].'/A'; ? Whewthink I made a mess of that Is that any more clear? Thanks for the very quick responses guys! Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 8:28 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question regarding Syntax * Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): ?php echo 'Email: '.'A HREF=mailto:[EMAIL PROTECTED]'.$row_rep_RS['repEmail'].'/A'; ? Obviously this isn't working. What is the proper syntax when you have to use double quotes inside the tag? I usually prefer this method, its a style choice and others might argue using it.: Email: a href=mailto:[EMAIL PROTECTED] ?php echo $row_rep_RS['repEmail']; ?/a A lot easier/cleaner than to trying to concat and escape everything. Curt -- I used to think I was indecisive, but now I'm not so sure. -- 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] Newbie Question regarding Syntax
* Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): Sorry guys.It think there is a bit of confusion. I miss typed what I need to do. ?php echo 'Email: '.'A HREF=mailto:'.$row_rep_RS['repEmail'].''.$row_rep_RS['repEmail'].'/A'; ? You should make sure to quote your html values ( href=value ), it will lead to trouble if you don't. I would still do it like this: Email: a href=mailto:?php echo $row_rep_RS['repEmail']? ?php echo $row_rep_RS['repEmail']?/a Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] test - please ignore
I'm just testing if this list accepts text attachments .. would be much easier for code exchange and stuff... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question regarding Syntax
Thank you Curt. Works great and your right I makes more sense to do it that way. Tim Winters Manager, Creative Development Sampling Technologies Incorporated (STI) [EMAIL PROTECTED] [EMAIL PROTECTED] W: 902 450 5500 C: 902 430 8498 -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 8:45 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question regarding Syntax * Thus wrote Creative Solutions New Media ([EMAIL PROTECTED]): Sorry guys.It think there is a bit of confusion. I miss typed what I need to do. ?php echo 'Email: '.'A HREF=mailto:'.$row_rep_RS['repEmail'].''.$row_rep_RS['repEmail'].'/A'; ? You should make sure to quote your html values ( href=value ), it will lead to trouble if you don't. I would still do it like this: Email: a href=mailto:?php echo $row_rep_RS['repEmail']? ?php echo $row_rep_RS['repEmail']?/a Curt -- I used to think I was indecisive, but now I'm not so sure. -- 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] preg_replace question
[EMAIL PROTECTED] wrote: Then use a simple strstr to first find out if the string does contain mydomain.com :-) My example was a simple one. I can't just check to see if the string contains the mydomain.com first because I am not passing a string to preg_replace but a whole text file. I want preg_replace to replace all occurrences in the text file of the regexp: #a href=(\|')http://([^\']+)(\|')#ime But only if the regexp doesn't contain http://www.mydomain.com. How can I get preg_replace to ignore instances of http://www.mydomain.com when it is doing it's global search and replace? Thanks, Jean-Christian Imbeault -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Form Feeds within a HTML table
I am creating a "report" that the user can download and it is a HTML table. Is there a way to put Page Breaks within the report so if the user prints it, it will page break a predefined places? Todd. -- inline: NewLogo.gif
RE: [PHP] Validate The Last Day of Month with server's clock????
?php // check last day of september $month = '08'; $year = date(Y); $last_day = date(t, mktime (0,0,0, $month,1,$year)); print $last_day; ? -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 12:00 PM To: [EMAIL PROTECTED] Subject: [PHP] Validate The Last Day of Month with server's clock Hi! Here's a trick script. We know that some months have the last day which is 30 while other is 31. As for February, it can be either 28 or 29. So, what's the trick in using the php to find out what is the last day of the month if you want to checked it against the server's clock to find out the last day of the month. Suppose it is this month or 3 months ago or 3 months from now. Anyone know? 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] DATE insertion
Cesar Aracena wrote: Hi all, First of all, thanks to everyone who helped me with the checkbox issue. I have an issue here while trying to INSERT INTO a MySQL table a date in a DATE format (-MM-DD). Obviously saying date(Y,m,d) doesn't work. What PHP function should I use? date('Ymd') to put it in a MMDD format. If you want to use date('Y-m-d') then you need to enclose the date string in quotes in your query. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Feeds within a HTML table
Todd Cary wrote: I am creating a report that the user can download and it is a HTML table. Is there a way to put Page Breaks within the report so if the user prints it, it will page break a predefined places? Use CSS. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] indexing a folder
Thanks, but is this also possible for directories not on my server? Or can i just use these functions? Missed that bit, sorry. If the directory is not on your server, then you need to go through FTP. or SSH, or HTTP, or one of the other innumerable ways to get information from one machine to another. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Category and sub-category logic
Read this article: http://www.evolt.org/article/Four_ways_to_work_with_hierarchical_data/17 /4047/index.html It explains the 4 different methods that you can use when working with hierarchical data. -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 3:21 PM To: [EMAIL PROTECTED] Subject: [PHP] Category and sub-category logic Hi, I am thinking of making a program for personal use which does a very simple thing, just displays listings under categories, eg: under main category Auto there would be cars,bikes etc under banking there would be financing,loans etc (I as admin create master and sub-categories) then if you click on cars you would either see a sub category or all the listings there I have never done a project like this so am a bit confused but I am pretty sure quite a few of you must have done this because its a bit common on the net and while I am kind of new to php, most of you guys are fossils :-D So far the logic I have worked out is: Create a master_category table for the main categories, a child_table for the subs, a the_listings table for the details which will have a reference (number or word) field which will be to keep a reference as to which category/sub-category it belongs to.. Tell me if my logic is wrong or I missed anything The part where I am confused is, on the front page (say index.php) how do I display all the categories and sub categories in the correct order? eg: Auto --Cars --Bikes Banking --Finances --Loans Women --Boring but REALLY good looking --Great fun but not-so-good-looking Any ideas? I searched hotscripts and google but found crappy programs like phpyellow and zclassifieds which are really no good to me. If you know of something that already does the above kindly share it with me. Thanks, -Ryan --- - The government announced today that it is changing it's emblem to a condom because it more clearly reflects the government's political stance. A condom stands up to inflation, halts production, destroys the next generation, protects a bunch of pricks, and gives you a sense of security while you're actually getting screwed. --- - -- 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] get current path
Hi, The PHP site seems to be down right now ... so here's the question: Is it possible for PHP to tell me the current path of a page? For example: www.whatever.com/this/page.php - I'd like PHP to return /this/page.php ... is that possible and if so, how so? TIA -Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] comparing xml files, removing some html tags
Hi, I need to compare two XML files in order to find if they are similar, i.e their DOM tree have the same structure. The ideia is to use Xerces to balance HTML files in order to create Xhtml and then compare. To make things a little easier for Xerces I am considering to remove some elements that do not make diference for my similarity point of view, for example, script/script tags, before calling xerces. So I was wondering which regular expression should I use to remove the scriptcontent/script and so on... regards. __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get current path
The PHP site seems to be down right now ... so here's the question: Is it possible for PHP to tell me the current path of a page? For example: www.whatever.com/this/page.php - I'd like PHP to return /this/page.php ... is that possible and if so, how so? PHP site looks up to me, though I have been having intermittent difficulties recently with one of the servers - us4 I think. To get the current path of the page or other webserver-related environmental informatio, check the contents of the $_SERVER superglobal and all will be revealed. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do they do that?
I was wondering. http://www.php.net/date gives me/redirects to: http://www.php.net/manual/en/function.date.php How do they do that? What $_post[??] is that? Or is it a sevrer (Apache, I suppose?) thing? -- John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do they do that?
On Sun, 17 Aug 2003 23:13:24 -0400, you wrote: I was wondering. http://www.php.net/date gives me/redirects to: http://www.php.net/manual/en/function.date.php How do they do that? What $_post[??] is that? Or is it a sevrer (Apache, I suppose?) thing? I don't know how php.net does it, but I know how I'd approach it - either a custom 404 handler which examines the incoming URL and redirects to the appropriate page, or mod_rewrite. See http://httpd.apache.org/docs-2.1/mod/core.html#errordocument and http://httpd.apache.org/docs/mod/mod_rewrite.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Got failed while calling strtotime().
I moved website from NT to W2K and got problem of date conversion. I'm using MS SQL Server. In SQL Server, the data looks like 06/09/03. I got 06 9 2003 12:00AM in W2K and Jun 9 2003 12:00AM in NT. strtotime() works ok on NT, but return -1 on W2K. Any ideas? Thanks a lot! Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Got failed while calling strtotime().
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): I moved website from NT to W2K and got problem of date conversion. I'm using MS SQL Server. In SQL Server, the data looks like 06/09/03. I got 06 9 2003 12:00AM in W2K and Jun 9 2003 12:00AM in NT. strtotime() works ok on NT, but return -1 on W2K. Any ideas? Thanks a lot! 06 9 2003 12:00AM is not a valid date string. see: http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Got failed while calling strtotime().
I knew it's incorrect format. But why string from NT is correct? I don't want to change source codes on website migration. --- To: [EMAIL PROTECTED] cc: Curt Zirzow Subject: Re: [PHP] Got failed while calling strtotime(). [EMAIL PROTECTED] 08/18/03 11:45 AM * Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): I moved website from NT to W2K and got problem of date conversion. I'm using MS SQL Server. In SQL Server, the data looks like 06/09/03. I got 06 9 2003 12:00AM in W2K and Jun 9 2003 12:00AM in NT. strtotime() works ok on NT, but return -1 on W2K. Any ideas? Thanks a lot! 06 9 2003 12:00AM is not a valid date string. see: http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html Curt -- I used to think I was indecisive, but now I'm not so sure. -- 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] Got failed while calling strtotime().
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): I knew it's incorrect format. But why string from NT is correct? I don't want to change source codes on website migration. when you say you got (06 9 2003 12:00AM in W2K and Jun 9 2003 12:00AM in NT) how are you getting that value? * Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]): I moved website from NT to W2K and got problem of date conversion. I'm using MS SQL Server. In SQL Server, the data looks like 06/09/03. I got 06 9 2003 12:00AM in W2K and Jun 9 2003 12:00AM in NT. strtotime() works ok on NT, but return -1 on W2K. Any ideas? Thanks a lot! 06 9 2003 12:00AM is not a valid date string. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cannot output before input
Hi All, I run the following program at Windows command prompt c:\php\cli\php.exe input.php ?php print Input:; flush(); $fp = fopen(php://stdin, r); $input = fgets($fp); fclose($fp); echo $input; ? The program did not show out Input: and waiting for input after run! Any hint to flush the output first? I am using PHP 4.3.2 (cli) (built: May 28 2003 15:10:38) Regards, Chris Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot output before input
* Thus wrote Chris Lee ([EMAIL PROTECTED]): Hi All, I run the following program at Windows command prompt c:\php\cli\php.exe input.php ?php print Input:; flush(); use ob_flush() instead. Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php