[PHP] Re: array question--help
Mark Pelillo wrote: > I am a Newbie at PHP > > I am sure I am missing something small but... > > I am trying to create a form selection box which an alphabetically sort > list of a unix group file. > > The group file has the format groupname::groupnumber: > > I have tried to create an array using the array=fgetcsv($fp, 30, ":") > which does read each line of the file. I have used this line in a while > loop and also a for loop, but everytime I exit the loop, the array now > has no information. > > I found if the change the line to be array[]=fgetcsv($fp, 30, ":") then > I can exit the loops but now how do extract only the group names from > the array and be able to sort them. > > Ideally what I would like to do is create an array where the keys = > group number and value = groupname. I need to be able to natsort the > values and display in the selection form box. Well lets try Please reply if this doesn't work? By the way... if you got further problems, please tell us which version of PHP you use. Regards, Johan Holst Nielsen www.weknowthewayout.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Auto refresh when data changed in Mysql
I have made a php + mysql site and hosting in my own IIS server, but in my school network, The page didnt change when i changed the data in mysql server. I think is the cache problem, but i cant fix it even i tick the "Update the page everytime when page load" in IE. There is no such problem in any home pc. but only in my school's pcs but when i type in www..com/showdata.php then the page can be update. Is there any code or setting can be set to over come this problem? Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto refresh when data changed in Mysql
You could use Headers to tell the browser to expire the page "now".. header ("Expires: Mon, 1 Jan 1990 05:00:00 GMT");// Date in the past header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); something like that should do it.. See if it works now.. - Original Message - From: "Simonk" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 7:50 PM Subject: [PHP] Auto refresh when data changed in Mysql > I have made a php + mysql site and hosting in my own IIS server, but in my > school network, The page didnt change when i changed the data in mysql > server. I think is the cache problem, but i cant fix it even i tick the > "Update the page everytime when page load" in IE. > There is no such problem in any home pc. but only in my school's pcs > but when i type in www..com/showdata.php > then the page can be update. > Is there any code or setting can be set to over come this problem? > > Thank you! > > > > -- > 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] The definitive source for PHP news, tutorials and articles (also, as XML)
Hello all I posted a link to Coding The Web (CodingTheWeb.com) a while ago as they had a channel dedicated to Google. It seems that they have updated the site a bit in the past few days and now have a news channel for PHP too. It is pretty cool: http://www.codingtheweb.com/projects/newslog/portal/1_1.htm What is really cool is the fact that you can syndicate their content for free. Take a look at the bottom of the page. There are two links to XML files: http://www.codingtheweb.com/projects/newslog/portal/1_2.xml (RDF) http://www.codingtheweb.com/projects/newslog/portal/1_3.xml (RSS) You can use this content on your own web site for free! Parsing out the data from an RDF file is pretty easy. Take a look at this tutorial to learn more: http://www.webmasterbase.com/article/560 (or see: http://www.phpclasses.org/browse.html/package/259.html http://www.phpclasses.org/browse.html/package/61.html http://www.phpclasses.org/browse.html/package/80.html ) I have already added the RDF file to my personal start page. It makes sure that I always know about the latest PHP articles, tutorials, news etc. To the Webmaster of CodingTheWeb.com if you are reading this: Thanks for creating this simple news portal. It works well, loads fast and you offer your content as XML. Nice. Well done. Stefen _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing variables to scripts
(yes, newbie - but I *have* tried everything I know, I swear) I'm trying to write a "comments" system for my site (because I think I can). Basically, the script receives the ID of a particular entry (the site is a blog) via "?entry_id=". It checks to see if there's a corresponding text file (.txt) and if so, it prints the contents of the text file and invites the user to input a comment. If not, it prints "no comments" and invites the user... yadda yadda. Now, unless I'm mistaken, passing the arguments are done like so: http://www.foo.com/comments.php?entry_id=test Right? Unfortunately, it doesn't work. That is to say, everything about the script works, except recognition of the $entry_id variable. Something as simple as: comments for entry "" returns "comments for entry "". Saving the text file's URL to a variable: http://www.foo.com/$entry_id; .txt; ?> Doesn't work either. I had a semi-hunch (brought on by my own inexperience, no doubt) that maybe I had to start a session or something on the referring page. Tried that (session_start();), didn't have any effect. Bah. Can anyone point out what I'm doing wrong? TIA -- Mark Gallagher -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passing variables to scripts
Which version of PHP you're running? May be you need to set register_globals = On in your php.ini file. -- Kind regards, Yuri. www.AceHoster.com Quality web hosting "Mark Gallagher" <[EMAIL PROTECTED]> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > (yes, newbie - but I *have* tried everything I know, I swear) > > I'm trying to write a "comments" system for my site (because I think I > can). Basically, the script receives the ID of a particular entry (the > site is a blog) via "?entry_id=". It checks to see if there's > a corresponding text file (.txt) and if so, it prints the > contents of the text file and invites the user to input a comment. If > not, it prints "no comments" and invites the user... yadda yadda. > > Now, unless I'm mistaken, passing the arguments are done like so: > http://www.foo.com/comments.php?entry_id=test > Right? > > Unfortunately, it doesn't work. That is to say, everything about the > script works, except recognition of the $entry_id variable. Something > as simple as: comments for entry " ?>" returns "comments for entry "". > > Saving the text file's URL to a variable: > $filename = http://www.foo.com/$entry_id; .txt; > ?> > > Doesn't work either. > > I had a semi-hunch (brought on by my own inexperience, no doubt) that > maybe I had to start a session or something on the referring page. Tried > that (session_start();), didn't have any effect. Bah. > > Can anyone point out what I'm doing wrong? > > TIA > > -- > Mark Gallagher > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] date problem
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all I have a field in MySQL db like this: date TIMESTAMP, and it looks pretty regular like this: 20020428011911 when I come to use php date("D M Y", $myTimeStamp) though I get TUE JAN 2038! I see something in the manual re this date but I'm afraid I still can't work it out so some advice/help would be greatly appreciated :-) - -- Nick Wilson // www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD4DBQE8y++SHpvrrTa6L5oRAh3xAJ9lfFdB1VW3KUHCWxnnksN+Uw950QCYpfg6 OCdApC0Nh/8hi8MYQY3OTQ== =FnlM -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] failed query results
Hello all, i am trying to query a mysql database to see if a customer all ready exists in a database and if so then use there customer id to insert data into another table. Can anyone tell me what valuse mysql returns if the query returns no value? i have the following code: $customer_id_check=("SELECT id FROM $customer_table WHERE firstname = '$firstname' && lastname = '$lastname' && email = '$email'"); $result1=mysql_query($customer_id_check); if (!$result1) { print "theres no such customer!"; } which i thought should echo 'theres no such customer!' if a customer didnt exist who fitted the query, however it doesnt and if i echo $result1 i get 'Resource id #2 not what i was expecting (was more expecting something along the lines of NULL). Thanks for any help in advance!!! Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date problem
First, the timestamp that is retrieved from mysql is NOT the same as is required for PHP. Second, do you REALLY wan the Day of the Week (Mon, Tue, Wed) or the date of the month (1,2,3,4,5,6,...)? Third, let Mysql do the conversion for you. For instance if you timestamp field is named "mydate": SELECT DATE_FORMAT(mydate,"%e %b %Y") AS thedate FROM mytable - Original Message - From: Nick Wilson <[EMAIL PROTECTED]> To: php-general <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 7:48 AM Subject: [PHP] date problem -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all I have a field in MySQL db like this: date TIMESTAMP, and it looks pretty regular like this: 20020428011911 when I come to use php date("D M Y", $myTimeStamp) though I get TUE JAN 2038! I see something in the manual re this date but I'm afraid I still can't work it out so some advice/help would be greatly appreciated :-) - -- Nick Wilson // www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD4DBQE8y++SHpvrrTa6L5oRAh3xAJ9lfFdB1VW3KUHCWxnnksN+Uw950QCYpfg6 OCdApC0Nh/8hi8MYQY3OTQ== =FnlM -END PGP SIGNATURE- -- 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] failed query results
If no customers are found, then: if (mysql_num_rows($result1)==0) { print "theres no such customer!"; } - Original Message - From: baldey_uk <[EMAIL PROTECTED]> To: Php-General <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 7:48 AM Subject: [PHP] failed query results Hello all, i am trying to query a mysql database to see if a customer all ready exists in a database and if so then use there customer id to insert data into another table. Can anyone tell me what valuse mysql returns if the query returns no value? i have the following code: $customer_id_check=("SELECT id FROM $customer_table WHERE firstname = '$firstname' && lastname = '$lastname' && email = '$email'"); $result1=mysql_query($customer_id_check); if (!$result1) { print "theres no such customer!"; } which i thought should echo 'theres no such customer!' if a customer didnt exist who fitted the query, however it doesnt and if i echo $result1 i get 'Resource id #2 not what i was expecting (was more expecting something along the lines of NULL). Thanks for any help in advance!!! Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: date problem
You can include date formatting function in your SQL statement: DATE_FORMAT(date,format) http://www.mysql.com/doc/D/a/Date_and_time_functions.html -- Kind regards, Yuri. www.AceHoster.com Quality web hosting "Nick Wilson" <[EMAIL PROTECTED]> ???/ ? ?: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi all > I have a field in MySQL db like this: date TIMESTAMP, > and it looks pretty regular like this: 20020428011911 > > when I come to use php date("D M Y", $myTimeStamp) though I get > > TUE JAN 2038! > > I see something in the manual re this date but I'm afraid I still can't > work it out so some advice/help would be greatly appreciated :-) > > - -- > Nick Wilson // www.explodingnet.com > > > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.0.6 (GNU/Linux) > > iD4DBQE8y++SHpvrrTa6L5oRAh3xAJ9lfFdB1VW3KUHCWxnnksN+Uw950QCYpfg6 > OCdApC0Nh/8hi8MYQY3OTQ== > =FnlM > -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date problem
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Richard Emery declared > Third, let Mysql do the conversion for you. For instance if you timestamp > field is named "mydate": > SELECT DATE_FORMAT(mydate,"%e %b %Y") AS thedate FROM mytable Nice one, cheers Richard. I didn't know about that mysql function... - -- Nick Wilson // www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8y/S9HpvrrTa6L5oRAs9cAJ4jcd8dukhfdaJIla/irYNvnX2ZRwCgoIhU WjS6nkU1UM44crfOGWlBxRA= =RYIM -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML in PHP
Hello, I have a newbie question for you. I do a query, I'd like to display the result but I'd like to go to a new line for each row. I use this code that's work : but this not work } ?> Could you tell me how I can do to have a after each row. Thanks for your help :) Bye
Re: [PHP] HTML in PHP
echo mysql_result($result,$i, "NAME"); should be: echo mysql_result($result,$i, "NAME") . ''; Andrew - Original Message - From: "Christian Ista" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 2:51 PM Subject: [PHP] HTML in PHP > Hello, > > I have a newbie question for you. > > I do a query, I'd like to display the result but I'd like to go to a new > line for each row. > > I use this code that's work : > for ($i = 0; $i { >echo mysql_result($result,$i, "NAME"); > } > ?> > > but this not work > > for ($i = 0; $i { >echo mysql_result($result,$i, "NAME"); > } > ?> > > Could you tell me how I can do to have a after each row. > > Thanks for your help :) > > Bye > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general Digest 28 Apr 2002 13:56:24 -0000 Issue 1313
php-general Digest 28 Apr 2002 13:56:24 - Issue 1313 Topics (messages 94955 through 94983): Re: tutorial on global variables 94955 by: Jason Wong Re: Apache: SERVER_NAME gone? 94956 by: Jason Wong class PHP 94957 by: Peter 94961 by: John Holmes 94962 by: SP does ImageCreateFromJPEG suck up memory? 94958 by: DrTebi Question 94959 by: Gerard Samuel PGP 94960 by: Richard Lynch array question--help 94963 by: Mark Pelillo 94970 by: Johan Holst Nielsen Re: session expires on server side 94964 by: Padraig Kitterick Stripping characters. 94965 by: CDitty 94966 by: CC Zona 94967 by: CC Zona 94969 by: Justin French Wrapping Text 94968 by: Scott Reismanis Auto refresh when data changed in Mysql 94971 by: Simonk 94972 by: The_RadiX The definitive source for PHP news, tutorials and articles (also, as XML) 94973 by: Stefen Lars passing variables to scripts 94974 by: Mark Gallagher 94975 by: Yuri Petro date problem 94976 by: Nick Wilson 94978 by: Richard Emery 94980 by: Yuri Petro 94981 by: Nick Wilson failed query results 94977 by: baldey_uk 94979 by: Richard Emery HTML in PHP 94982 by: Christian Ista 94983 by: Andrew Brampton Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- --- Begin Message --- On Sunday 28 April 2002 04:39, Henrik Hansen wrote: > [EMAIL PROTECTED] (John Hughes) wrote: > > Can someone point me toward a tutorial on the proper use of global > > references under PHP4. The manual has very good information. > > > > I have been declaring > > > > function something() > > { > > global $foo, $bar; > > > > /* some actions */ > > > > } > > > > in functions and I understand that this is not the way I'm supposed > > to be doing this. Or there is a new way that is preferred. That is a perfectly valid declaration, but without knowing your intent one cannot say whether it is 'right' or 'wrong'. The thing you need to remember with PHP is that unlike many other languages, by default variables are not global in nature. Thus in order to use a variable that is defined outside of a function you need to declare it like you have above. > you can do it that way, but if you want to avoid calling global all > the time you might consider this approach: > > $GLOBALS["foo"] = 123; $foo = 123; # No need to use the $GLOBALS array when outside of a function > function something() > { > echo $GLOBALS["foo"]; > } -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "...if the church put in half the time on covetousness that it does on lust, this would be a better world." - Garrison Keillor, "Lake Wobegon Days" */ --- End Message --- --- Begin Message --- On Tuesday 23 January 2001 07:55, The_RadiX wrote: > Hmm > > > because $SERVER_NAME is created IF the php > > directive register_globals = on. this setting > > is off by default as of PHP 4.2.0. all > > server predefined variables behave this way, > > such as $PHP_SELF, etc. > > Yes so I've heard... One thing though.. I use PHP4.1.1... not 4.2.x Read the changelog (or history). A lot of default behaviour has changed starting from 4.1.X. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Happiness isn't something you experience; it's something you remember. -- Oscar Levant */ --- End Message --- --- Begin Message --- The text of this proposal, test code, and updates live at petermoulding.com/class. I place it here for discussion of the best approach before people build code. Class PHP An invention for a classier PHP. This invention uses PHP classes as Web pages. The invention can be implemented as a wrapper around PHP or as an enhancement to PHP. In Apache 2, the invention can be implemented as a filter to precede PHP. I will give a quick outline of the requirement, then sketches of implementations, then detailed examples prototyped using PHP. The invention is named class. An Apache implementation could be a module named class. If you write code to implement this invention, suffix the project name with your name as in class_John. To prevent a rapacious company copyrighting this invention using the excuse that it is a business process or anything else they can copyright, I declare my copyright on everything in this invention and any processes derivable from this. Please make your code implementation
[PHP] Changing field size
I've a VARCHAR(4) field that I want to change to a VARCHAR(6) field. What would happen to the existing data in MySQL db? Thanks! Tony ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing field size
First, your question belongs on the mysql mailing list, not PHP Second, did you try it yourself before asking? I guess not. Third, the data would not be effected - Original Message - From: Anthony Rodriguez <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 8:09 AM Subject: [PHP] Changing field size I've a VARCHAR(4) field that I want to change to a VARCHAR(6) field. What would happen to the existing data in MySQL db? Thanks! Tony ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Changing field size
"ALTER TABLE works by making a temporary copy of the original table. The alteration is performed on the copy, then the original table is deleted and the new one is renamed. This is done in such a way that all updates are automatically redirected to the new table without any failed updates. While ALTER TABLE is executing, the original table is readable by other clients. Updates and writes to the table are stalled until the new table is ready." http://www.mysql.com/doc/A/L/ALTER_TABLE.html So, I think your data will be saved. -- Kind regards, Yuri. www.AceHoster.com Quality web hosting "Anthony Rodriguez" <[EMAIL PROTECTED]> ???/ ? ?: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I've a VARCHAR(4) field that I want to change to a VARCHAR(6) field. > > What would happen to the existing data in MySQL db? > > Thanks! > > Tony > ([EMAIL PROTECTED]) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] passing variables to scripts
Try $_GET["entry_id"] or $HTTP_GET_VARS["entry_id"], depending on your version of PHP. ---John Holmes... > -Original Message- > From: Mark Gallagher [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 4:04 AM > To: [EMAIL PROTECTED] > Subject: [PHP] passing variables to scripts > > (yes, newbie - but I *have* tried everything I know, I swear) > > I'm trying to write a "comments" system for my site (because I think I > can). Basically, the script receives the ID of a particular entry (the > site is a blog) via "?entry_id=". It checks to see if there's > a corresponding text file (.txt) and if so, it prints the > contents of the text file and invites the user to input a comment. If > not, it prints "no comments" and invites the user... yadda yadda. > > Now, unless I'm mistaken, passing the arguments are done like so: > http://www.foo.com/comments.php?entry_id=test > Right? > > Unfortunately, it doesn't work. That is to say, everything about the > script works, except recognition of the $entry_id variable. Something > as simple as: comments for entry " ?>" returns "comments for entry "". > > Saving the text file's URL to a variable: > $filename = http://www.foo.com/$entry_id; .txt; > ?> > > Doesn't work either. > > I had a semi-hunch (brought on by my own inexperience, no doubt) that > maybe I had to start a session or something on the referring page. Tried > that (session_start();), didn't have any effect. Bah. > > Can anyone point out what I'm doing wrong? > > TIA > > -- > Mark Gallagher > > > -- > 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] Wrapping Text
Wordwrap() might be a good solution for you, but it's probably more of a table design issue. The table needs some whitespace to break to a new line. If you are putting in a string of etc..then there's no where to break. Try putting a space before or after the when you replace the :P with it. And for the replacing, if the user does not edit the post, then do the conversion when they submit it. If they do edit it, then do it at run time. If there is editing involved, you want to present the text back to the user in the same format as they typed it, or otherwise they'll get confused. If there is no editing, then you'll save processor time by only doing the conversion once, instead of for every view. ---John Holmes... > -Original Message- > From: Scott Reismanis [mailto:[EMAIL PROTECTED]] > Sent: Saturday, April 27, 2002 11:58 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Wrapping Text > > Hi PHP digest readers. > > Ok I have a problem and a question which I am certain many share and > even a solution to my problem, however I wish to hear how you dealt with > this issue to see if there is a better method. > > Ok for my problem, it is regarding a smilie system. Currently what > happens is if people post :P:P:P:P:P:P etc.. etc.. then the text field > expands to an ugly length. My current solution which I don't really like > is to limit the number of smiles which a person is allowed to use. Can > anyone propose a better solution than this? i.e. wrap them using PHP or > maybe I coded my html poorly which is why my table is expanding? > > Secondly my question on a similar note whether to convert smilies at > runtime, or when a person submits a post? The beneifits at runtime is > less space used in the DB, and no worring about converting the converted > post back when it is needed to be edited, however with this method the > server has to do more processing in converting smilies each time the > post is viewed and vise versa. > > Thanks for your time, and I anticipate any light which can be shed on > this issue. > > Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Removing empty elements from an array
I have an array that contains several empty elements. What is simplest way to remove these elements? Array ( [0] => [1] => [2] => [3] => 16/Mar/02 [4] => [5] => 17/Mar/02 [6] => 18/Mar/02 [7] => 19/Mar/02 [8] => 20/Mar/02 [9] => 21/Mar/02 [10] => 22/Mar/02 [11] => 23/Mar/02 [12] => [13] => 24/Mar/02 [14] => 25/Mar/02 [15] =>) Thanks Craig ><> [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing empty elements from an array
unset() ??? - Original Message - From: Craig Westerman <[EMAIL PROTECTED]> To: php-general-list <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 9:36 AM Subject: [PHP] Removing empty elements from an array I have an array that contains several empty elements. What is simplest way to remove these elements? Array ( [0] => [1] => [2] => [3] => 16/Mar/02 [4] => [5] => 17/Mar/02 [6] => 18/Mar/02 [7] => 19/Mar/02 [8] => 20/Mar/02 [9] => 21/Mar/02 [10] => 22/Mar/02 [11] => 23/Mar/02 [12] => [13] => 24/Mar/02 [14] => 25/Mar/02 [15] =>) Thanks Craig ><> [EMAIL PROTECTED] -- 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: RE: [PHP] Wrapping Text
Sorry I wasn't exactly clear on my explaination. I believe it is a table design issue because i tried putting spaces between the image tags. i.e. etc... and the table was still been stretched. my solution has since been to force a (using wordwrap) but I would rather force a space which i can do but this does not seem to cause the streching to stop. I guess it is my tables as my site is designed to fit any res and as such does not have set pixel width tables. back to the drawing board for me then i guess :) cheers for the suggestion - Original Message - From: "John Holmes" <[EMAIL PROTECTED]> Date: Monday, April 29, 2002 3:36 am Subject: RE: [PHP] Wrapping Text > Wordwrap() might be a good solution for you, but it's probably > more of a > table design issue. The table needs some whitespace to break to a new > line. If you are putting in a string of > etc..then there's no where to break. Try putting a space before or > afterthe when you replace the :P with it. > > And for the replacing, if the user does not edit the post, then do the > conversion when they submit it. If they do edit it, then do it at run > time. If there is editing involved, you want to present the text > back to > the user in the same format as they typed it, or otherwise they'll get > confused. If there is no editing, then you'll save processor time by > only doing the conversion once, instead of for every view. > > ---John Holmes... > > > -Original Message- > > From: Scott Reismanis [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, April 27, 2002 11:58 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Wrapping Text > > > > Hi PHP digest readers. > > > > Ok I have a problem and a question which I am certain many share and > > even a solution to my problem, however I wish to hear how you dealt > with > > this issue to see if there is a better method. > > > > Ok for my problem, it is regarding a smilie system. Currently what > > happens is if people post :P:P:P:P:P:P etc.. etc.. then the text > field> expands to an ugly length. My current solution which I > don't really > like > > is to limit the number of smiles which a person is allowed to > use. Can > > anyone propose a better solution than this? i.e. wrap them using PHP > or > > maybe I coded my html poorly which is why my table is expanding? > > > > Secondly my question on a similar note whether to convert > smilies at > > runtime, or when a person submits a post? The beneifits at > runtime is > > less space used in the DB, and no worring about converting the > converted > > post back when it is needed to be edited, however with this > method the > > server has to do more processing in converting smilies each time the > > post is viewed and vise versa. > > > > Thanks for your time, and I anticipate any light which can be > shed on > > this issue. > > > > Scott > > Powered by telstra.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Removing empty elements from an array
If $arr is your array, something like... foreach ($arr as $key=>$val) { if (strlen($val) == 0) unset($arr[$key]); } HTH, Stuart -Original Message- From: Craig Westerman [mailto:[EMAIL PROTECTED]] Sent: 28 April 2002 15:37 To: php-general-list Subject: [PHP] Removing empty elements from an array I have an array that contains several empty elements. What is simplest way to remove these elements? Array ( [0] => [1] => [2] => [3] => 16/Mar/02 [4] => [5] => 17/Mar/02 [6] => 18/Mar/02 [7] => 19/Mar/02 [8] => 20/Mar/02 [9] => 21/Mar/02 [10] => 22/Mar/02 [11] => 23/Mar/02 [12] => [13] => 24/Mar/02 [14] => 25/Mar/02 [15] =>) Thanks Craig ><> [EMAIL PROTECTED] -- 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: RE: [PHP] Wrapping Text
It should have a % for the width at least, and then it should wrap itself. ---John Holmes... > -Original Message- > From: Scott Reismanis [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 7:42 AM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: RE: [PHP] Wrapping Text > > Sorry I wasn't exactly clear on my explaination. I believe it is a > table design issue because i tried putting spaces between the image > tags. i.e. etc... and the table > was still been stretched. my solution has since been to force a > (using wordwrap) but I would rather force a space which i can do but > this does not seem to cause the streching to stop. I guess it is my > tables as my site is designed to fit any res and as such does not have > set pixel width tables. back to the drawing board for me then i guess :) > > cheers for the suggestion > > - Original Message - > From: "John Holmes" <[EMAIL PROTECTED]> > Date: Monday, April 29, 2002 3:36 am > Subject: RE: [PHP] Wrapping Text > > > Wordwrap() might be a good solution for you, but it's probably > > more of a > > table design issue. The table needs some whitespace to break to a new > > line. If you are putting in a string of > > etc..then there's no where to break. Try putting a space before or > > afterthe when you replace the :P with it. > > > > And for the replacing, if the user does not edit the post, then do the > > conversion when they submit it. If they do edit it, then do it at run > > time. If there is editing involved, you want to present the text > > back to > > the user in the same format as they typed it, or otherwise they'll get > > confused. If there is no editing, then you'll save processor time by > > only doing the conversion once, instead of for every view. > > > > ---John Holmes... > > > > > -Original Message- > > > From: Scott Reismanis [mailto:[EMAIL PROTECTED]] > > > Sent: Saturday, April 27, 2002 11:58 PM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] Wrapping Text > > > > > > Hi PHP digest readers. > > > > > > Ok I have a problem and a question which I am certain many share and > > > even a solution to my problem, however I wish to hear how you dealt > > with > > > this issue to see if there is a better method. > > > > > > Ok for my problem, it is regarding a smilie system. Currently what > > > happens is if people post :P:P:P:P:P:P etc.. etc.. then the text > > field> expands to an ugly length. My current solution which I > > don't really > > like > > > is to limit the number of smiles which a person is allowed to > > use. Can > > > anyone propose a better solution than this? i.e. wrap them using PHP > > or > > > maybe I coded my html poorly which is why my table is expanding? > > > > > > Secondly my question on a similar note whether to convert > > smilies at > > > runtime, or when a person submits a post? The beneifits at > > runtime is > > > less space used in the DB, and no worring about converting the > > converted > > > post back when it is needed to be edited, however with this > > method the > > > server has to do more processing in converting smilies each time the > > > post is viewed and vise versa. > > > > > > Thanks for your time, and I anticipate any light which can be > > shed on > > > this issue. > > > > > > Scott > > > > > > > Powered by telstra.com > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Removing empty elements from an array
function filter($array) { if ( !is_array($array) ) { die("Must be an array!"); } foreach($array as $key => $value) { if($array[$key] == "") { unset($array[$key]); } } return($array); } - Original Message - From: "Craig Westerman" <[EMAIL PROTECTED]> To: "php-general-list" <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 10:36 AM Subject: [PHP] Removing empty elements from an array > I have an array that contains several empty elements. What is simplest way > to remove these elements? > > Array ( [0] => [1] => > [2] => > [3] => 16/Mar/02 > [4] => > [5] => 17/Mar/02 > [6] => 18/Mar/02 > [7] => 19/Mar/02 > [8] => 20/Mar/02 > [9] => 21/Mar/02 > [10] => 22/Mar/02 > [11] => 23/Mar/02 > [12] => > [13] => 24/Mar/02 > [14] => 25/Mar/02 > [15] =>) > > Thanks > > Craig ><> > [EMAIL PROTECTED] > > > -- > 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] Removing empty elements from an array
This is what you want. http://www.php.net/manual/en/function.array-filter.php Matt Friedman Web Applications Developer www.SpryNewMedia.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday April 28, 2002 10:57 AM To: Craig Westerman; php-general-list Subject: Re: [PHP] Removing empty elements from an array function filter($array) { if ( !is_array($array) ) { die("Must be an array!"); } foreach($array as $key => $value) { if($array[$key] == "") { unset($array[$key]); } } return($array); } - Original Message - From: "Craig Westerman" <[EMAIL PROTECTED]> To: "php-general-list" <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 10:36 AM Subject: [PHP] Removing empty elements from an array > I have an array that contains several empty elements. What is simplest way > to remove these elements? > > Array ( [0] => [1] => > [2] => > [3] => 16/Mar/02 > [4] => > [5] => 17/Mar/02 > [6] => 18/Mar/02 > [7] => 19/Mar/02 > [8] => 20/Mar/02 > [9] => 21/Mar/02 > [10] => 22/Mar/02 > [11] => 23/Mar/02 > [12] => > [13] => 24/Mar/02 > [14] => 25/Mar/02 > [15] =>) > > Thanks > > Craig ><> > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] NameVirtualHost breaks PHP
Hello. I'm new to this list, though not new to PHP. I'm hoping that my question hasn't been answered a thousand times before, and I did at least search on NameVirtualHost and read all those archived messages before getting to this point. I have an Apache web server (1.0.38) that has been peacefully co-existing with php4 for quite some time. I've interfaced it to mySQL, and life was great. Then, I came up with the brilliant idea to used Named Virtual Hosts rather than using up all my IP addresses. I did all according to the instructions I had, and the "virtual" part of things worked fine. www.hostone.net showed its proper page, as did www.hosttwo.net. But It broke php. When I go to a php page now, it show's the code rather than executing it. I've verified that this behavior happens across all the web pages, incuding the "main" one that isn't "virtualized." Can anyone point me in the right direction? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] NameVirtualHost breaks PHP
On Monday 29 April 2002 00:53, Greg Blakely wrote: > I have an Apache web server (1.0.38) that has been peacefully > co-existing with php4 for quite some time. I've interfaced it to mySQL, > and life was great. Apache 1.0.38 How old is that? If you're really using such an old version you should first upgrade to something modern (1.3.X or the 2.0.X series). -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Chicken Little was right. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP] Wrapping Text
On Monday 29 April 2002 01:53, John Holmes wrote: > It should have a % for the width at least, and then it should wrap > itself. Not necessarily, if you have a single 'word' (a string of characters with no space) that is very long then the width of the table stretches to accomodate the length of that 'word'. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* There's no easy quick way out, we're gonna have to live through our whole lives, win, lose, or draw. -- Walt Kelly */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date problem
On Sunday 28 April 2002 21:10, Nick Wilson wrote: > * and then Richard Emery declared > > > Third, let Mysql do the conversion for you. For instance if you > > timestamp field is named "mydate": > > SELECT DATE_FORMAT(mydate,"%e %b %Y") AS thedate FROM mytable > > Nice one, cheers Richard. > I didn't know about that mysql function... Can we say, RTFM :) -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Everything is possible. Pass the word. -- Rita Mae Brown, "Six of One" */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] failed query results
On Sunday 28 April 2002 20:48, baldey_uk wrote: > $customer_id_check=("SELECT id FROM $customer_table WHERE firstname = > '$firstname' && lastname = '$lastname' && email = '$email'"); > $result1=mysql_query($customer_id_check); > if (!$result1) { > print "theres no such customer!"; > } > > which i thought should echo 'theres no such customer!' if a customer didnt > exist who fitted the query, however it doesnt and if i echo $result1 i get > 'Resource id #2 not what i was expecting (was more expecting something > along the lines of NULL). Have a look at the examples in the php manual and learn how to incorporate error checking in your code. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* "BTW, does Jesus know you flame?" -- Diane Holt, [EMAIL PROTECTED], to Ed Carp */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: RE: [PHP] Wrapping Text
> > It should have a % for the width at least, and then it should wrap > > itself. > > Not necessarily, if you have a single 'word' (a string of characters with > no > space) that is very long then the width of the table stretches to > accomodate > the length of that 'word'. Right, that's why I told him to put a space around his image tags. Then, with that space, and a % width, it should (?) wrap. I think he was ending up with a long 'word' like you were saying; only made of image tags. etc... so it would not wrap. etc... should wrap, though. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: NameVirtualHost breaks PHP
Can you indicate Apache settings regarding php and virtualhosts? -- Kind regards, Yuri. www.AceHoster.com Quality web hosting "Greg Blakely" <[EMAIL PROTECTED]> ???/ ? ?: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello. I'm new to this list, though not new to PHP. I'm hoping that my question hasn't been answered a thousand times before, and I did at least search on NameVirtualHost and read all those archived messages before getting to this point. I have an Apache web server (1.0.38) that has been peacefully co-existing with php4 for quite some time. I've interfaced it to mySQL, and life was great. Then, I came up with the brilliant idea to used Named Virtual Hosts rather than using up all my IP addresses. I did all according to the instructions I had, and the "virtual" part of things worked fine. www.hostone.net showed its proper page, as did www.hosttwo.net. But It broke php. When I go to a php page now, it show's the code rather than executing it. I've verified that this behavior happens across all the web pages, incuding the "main" one that isn't "virtualized." Can anyone point me in the right direction? Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird/inconsistent behaviour when sending an empty file? (WAMP, Apache2, PHP 4.2.0)
Hi, it might very well be an ignorant oversight, but I can't explain the following behaviour. Consider a file containing -only- this code: -snip- -snip- As you can see, it doesn't do anything. It should return an empty file. However, what it does return is the following (copy/paste from telnet.exe): -snip- HTTP/1.1 500 Internal Server Error Date: Sun, 28 Apr 2002 17:32:45 GMT Server: Apache/2.0.35 (Win32) PHP/4.2.0 Accept-Ranges: bytes X-Powered-By: PHP/4.1.0 Content-Length: 0 Connection: close Content-Type: text/html; charset=ISO-8859-1 Connection to host lost. -snip- Evidently, Apache reports an error 500, however error.log doesn't show anything, access.log reports a successful access ("127.0.0.1 - - [28/Apr/2002:19:34:10 + 0100] "GET /test2.php HTTP/1.1" - 0"). Note that the X-Powered-By reports PHP/4.1.0 while the server info says (correctly) 4.2.0. That's probably a simple oversight, and I assume has been reported before. Furthermore, with three different browsers, I get three different kind of behaviours. Opera 6.0 apparently just sits there waiting for incoming data ("Completed request to 127.0.0.1"). Mozilla 0.9.9 displays an empty white page, viewing the source displays "", which I assume Mozilla automatically added when receiving an empty file. MSIE 6.0, finally, displays a standard "The page cannot be displayed" error message, signifying an error 500 at the bottom. Further testing Opera reveals that this is "consistent" behaviour and not related to PHP, it also does this when trying to retrieve a 0b txt file, while the other browsers work fine. I can do basically everything in the PHP code, calculate, database calls, writing to a log file - as long as an empty file is returned, it doesn't work. As already mentioned, I'm using Apache2 with the experimental PHP 4.2.0 module ("LoadModule php4_module F:/Apache2/php/experimental/apache2filter.dll", I hope this is correct) on a Windows XP system. I do think I had a similar behaviour on Apache 1.3, though, but I didn't really test it on that platform. I stumbled on this problem when trying to redirect using a Location header directive, as in: -snip- http://www.php.net";); exit; } else { echo "No redirection for you!\n"; } ?> -snip- If $redirect is set to TRUE, the behavious describes above occurs, if set to FALSE the echo works as expected. Similarily, all my other scripts, by and large, seem to work fine. I hope the solution isn't too obvious, and thanks in advance, Moritz -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and Query String Variable Handling
Thanks for your assistance... I found three small errors that caused me the problem. 1. I had an extra line or space in my include file that defines all my functions after the '?>' 2. I didn't realize that session_start returns an output. I assigned a variable to it. 3. I needed to passed the REQUEST_URI string in a hidden variable within my login form. Voila!!! Everything worked fine. I just wasn't seeing it yesterday. I was just too close to the code... - Original Message - From: "John Holmes" <[EMAIL PROTECTED]> To: "'Dennis Moore'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Saturday, April 27, 2002 11:33 PM Subject: RE: [PHP] Sessions and Query String Variable Handling > Not for server side. You can use a META REFRESH on the client side, but > I personally find that ugly. > > This is why I always write my functions so that they don't output > anything. They just assign the output to a variable and return it. That > way, I can call the function anywhere, save the result, and just echo > that variable where ever I need to. > > ---John Holmes... > > > -Original Message- > > From: Dennis Moore [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, April 27, 2002 5:24 PM > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > > Subject: Re: [PHP] Sessions and Query String Variable Handling > > > > Thanks, > > > > Is there any way of doing this without using the header() to redirect? > I > > have some functions that get executed before the sessions stuff. I > am > > trying to avoid using output buffering or re-writing my code. > > > > /dkm > > > > > > > > > > - Original Message - > > From: "John Holmes" <[EMAIL PROTECTED]> > > To: "'Dennis Moore'" <[EMAIL PROTECTED]>; > <[EMAIL PROTECTED]> > > Sent: Saturday, April 27, 2002 8:49 PM > > Subject: RE: [PHP] Sessions and Query String Variable Handling > > > > > > > $page = $_SERVER["SERVER_NAME"] . $_SERVER["SCRIPT_NAME"] . > > > $_SERVER["QUERY_STRING"]; > > > > > > That will recreate the URL that the user clicked on. Save that to a > > > variable before you check for a session. Once you start a session or > > > verify that one exists, use header() to send them back to that page. > > > > > > ---John Holmes. > > > > > > -Original Message- > > > From: Dennis Moore [mailto:[EMAIL PROTECTED]] > > > Sent: Saturday, April 27, 2002 2:37 PM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] Sessions and Query String Variable Handling > > > > > > Env: Apache 1.3.x/php4.0.6/mysql3.23.x > > > > > > Scenario: I have built a system that uses PHP sessions for user > access. > > > Within the system I send user notifications via email. Within the > > > email are links to certain pages with variables. For example. > > > > > > http://mysite.com/view_page.htm?id=6 > > > > > > My system checks to see if the session is valid. Since the user is > > > coming from an email. There is no session. So the user is prompted > for > > > the user and password. They enter and click submit. The > authentication > > > passes the user to right page, but losses the variables in the query > > > string. Thus causing errors. > > > > > > Here is the authentication code... > > > set session settings from login form > > > if (!session_is_registered("valid_user") && $session_login=="proc") > { > > > if ($userid && $password) { > > > // if the user has just tried to log in > > > > > > $db_conn = mysql_connect("localhost"); > > > mysql_select_db("$dbname", $db_conn); > > > $query = "select * from auth_users " > > >."where auth_username='$userid' " > > >." and auth_password='$password' "; > > > $result = mysql_query($query, $db_conn); > > > if (mysql_num_rows($result) >0 ) { > > > // if they are in the database register the user id > > > $valid_user = $userid; > > > $valid_group=mysql_result($result,0,"auth_group"); > > >$valid_perms=mysql_result($result,0,"auth_perms"); > > >$valid_auth_id=mysql_result($result,0,"auth_id"); > > > session_register("valid_user"); > > >session_register("valid_group"); > > >session_register("valid_perms"); > > >session_register("valid_auth_id"); > > > } else { > > >$invalid_login= "Invalid login: Could not log you in... > > >"; > > > } > > > } > > > } > > > > > > Any Ideas on how to pass the query string variables through the > > > authentication process? > > > > > > > > > -- > > 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] Auto refresh when data changed in Mysql
I have added the code, but it turn out : "Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\php\hospital_equipment.php:5) in C:\Inetpub\php\hospital_equipment.php on line 6 Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\php\hospital_equipment.php:5) in C:\Inetpub\php\hospital_equipment.php on line 7 Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\php\hospital_equipment.php:5) in C:\Inetpub\php\hospital_equipment.php on line 9 Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\php\hospital_equipment.php:5) in C:\Inetpub\php\hospital_equipment.php on line 10 Equipments' Detail:- " I have tried to put the code in / before the , but it still cant work properly why? Here is my full HTML code: Equipments' Detail body {scrollbar-face-color : #9ca6a5 ; scrollbar-shadow-color : #eaebcf ; scrollbar-darkshadow-color : #eaebcf ; scrollbar-highlight-color : #eaebcf ; scrollbar-3dlight-color : #eaebcf ; scrollbar-track-color : #eaebcf ; scrollbar-arrow-color : black} Equipments' Detail:- A = Available H = Hall N = Not in Hall $head->name"; } echo ""; while ($field = mysql_fetch_row($row)) { echo ""; for ($i = 0; $i <= count($field) - 1; $i++) { echo "$field[$i]"; }echo ""; } echo ""; if (!$row) echo "Failed"; else { $num = mysql_num_rows($row); echo"equipment database has got $num data."; } ?> Search individual equipment: Main Menu Loaned Equipments Add New Equipment "The_radix" <[EMAIL PROTECTED]> wrote in message 000501c08528$6d880270$3300a8c0@oracle">news:000501c08528$6d880270$3300a8c0@oracle... > You could use Headers to tell the browser to expire the page "now".. > > > header ("Expires: Mon, 1 Jan 1990 05:00:00 GMT");// Date in the past > header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); > // always modified > header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 > header ("Pragma: no-cache"); > > > something like that should do it.. > > See if it works now.. > > > > > - Original Message - > From: "Simonk" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, April 28, 2002 7:50 PM > Subject: [PHP] Auto refresh when data changed in Mysql > > > > I have made a php + mysql site and hosting in my own IIS server, but in my > > school network, The page didnt change when i changed the data in mysql > > server. I think is the cache problem, but i cant fix it even i tick the > > "Update the page everytime when page load" in IE. > > There is no such problem in any home pc. but only in my school's pcs > > but when i type in www..com/showdata.php > > then the page can be update. > > Is there any code or setting can be set to over come this problem? > > > > Thank you! > > > > > > > > -- > > 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] Auto refresh when data changed in Mysql
All header calls need to be made before any content is sent back to the browser. Try this... -- BEGIN CODE -- Equipments' Detail body {scrollbar-face-color : #9ca6a5 ; scrollbar-shadow-color : #eaebcf ; scrollbar-darkshadow-color : #eaebcf ; scrollbar-highlight-color : #eaebcf ; scrollbar-3dlight-color : #eaebcf ; scrollbar-track-color : #eaebcf ; scrollbar-arrow-color : black} Equipments' Detail:- A = Available H = Hall N = Not in Hall $head->name"; } echo ""; while ($field = mysql_fetch_row($row)) { echo ""; for ($i = 0; $i <= count($field) - 1; $i++) { echo "$field[$i]"; }echo ""; } echo ""; if (!$row) echo "Failed"; else { $num = mysql_num_rows($row); echo"equipment database has got $num data."; } ?> Search individual equipment: Main Menu Loaned Equipments Add New Equipment -- END CODE -- HTH, Stuart -Original Message- From: Simonk [mailto:[EMAIL PROTECTED]] Sent: 28 April 2002 20:33 To: [EMAIL PROTECTED] Subject: Re: [PHP] Auto refresh when data changed in Mysql I have added the code, but it turn out : "The_radix" <[EMAIL PROTECTED]> wrote in message 000501c08528$6d880270$3300a8c0@oracle">news:000501c08528$6d880270$3300a8c0@oracle... > You could use Headers to tell the browser to expire the page "now".. > > > header ("Expires: Mon, 1 Jan 1990 05:00:00 GMT");// Date in the past > header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); > // always modified > header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 > header ("Pragma: no-cache"); > > > something like that should do it.. > > See if it works now.. > > > > > - Original Message - > From: "Simonk" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, April 28, 2002 7:50 PM > Subject: [PHP] Auto refresh when data changed in Mysql > > > > I have made a php + mysql site and hosting in my own IIS server, but in my > > school network, The page didnt change when i changed the data in mysql > > server. I think is the cache problem, but i cant fix it even i tick the > > "Update the page everytime when page load" in IE. > > There is no such problem in any home pc. but only in my school's pcs > > but when i type in www..com/showdata.php > > then the page can be update. > > Is there any code or setting can be set to over come this problem? > > > > Thank you! > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP4.2.0 + Apache2 prints code
I've installed Apache 2.0.35 with PHP 4.2.0 on both FreeBSD and Linux, and both yield the same result. When the test.php page is accessed it returns "" instead of actually processing it. I have the lines: LoadModule php4_modulemodules/libphp4.so AddType application/x-httpd-php .php in my httpd.conf files, and the /server-info page displays the server as: Server Version: Apache/2.0.35 (Unix) PHP/4.2.0 It also indicates that "sapi_apache2.c" is loaded. I've tried making the php files +x, and also accessing them in directories that are set as Options ExecCGI, but nothing causes apache to actually process the php. I have to be doing something wrong here, but for the life of me I can't figure out what it is. The only thing I can think of that might help is an AddHandler line, but I don't know what I'd put there as a handler. Any thoughts/comments/ideas would be greatly appreciated. Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] NameVirtualHost breaks PHP
Jason Wong asked: > Apache 1.0.38 How old is that? If you're really using such an old > version you should first upgrade to something modern (1.3.X or the 2.0.X > series). My bad. I queried the wrong httpd (/bin/httpd rather than /sbin/httpd). It's really 1.3.20 If I'd given it much thought, I'd have recognized the error. Oh, well. Chalk it up to Sunday morning brain slips. -Greg- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] i18n translation of PHP based forum
Hello, I am one of the core developers of FUDforum, which is PHP based forum released under the GPL licence. The upcomming release of FUDforum 2.0 will contain i18n support and I am looking for people who would be willing to help translate the forum to other languages. If you want to help with the translations, please contact me at [EMAIL PROTECTED] Thanks. Ilia FUDforum Developer http://fud.prohost.org/forum/ [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Autoload of cookies on Linux fails, Win32 works???
I'm confused.. Assuming I've got a cookie called "loggedin" defined as "12345" In 4.2.0 on Win32, my cookies are preloaded so when I do if (isset($loggedin)) echo $loggedin It checks to see if there is a variable named $loggedin that was created by autoloading of cookies, then it prints "12345" On linux, this does not happen. In fact, there appears to be no autoloading of variables. Is this intentional or is there a configuration setting I'm missing? Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header question
I have a tell a friend script and got the php script from a friend to make it work. I am a newbie so still do not fully udners stand it. Here is the problem, it puts the following at the top of each e-mail: X-Mailer: PHP/4.1.2 Here is the script:
[PHP] for inclusion (include_path='.;c:\php4\pear') in Unknown on line 0
This is all I can get even when I paly with PHP windows include= Warning: Failed opening '/inetpub/wwwroot/test.php' for inclusion (include_path='.;c:\php4\pear') in Unknown on line 0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] (include_path='.;c:\php4\pear') in Unknown on line 0
Sorry Should do it all Using apache 1.3 for windoze and 4.2 php but can get it to fly best I can get even when I use Vins (fix it) is Warning: Failed opening '/inetpub/wwwroot/test.php' for inclusion (include_path='.;c:\php4\pear') in Unknown on line 0 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] NameVirtualHost breaks PHP
Frenck advised: > add this to your virutalhost tag: > AddType application/x-httpd-php .php I did, and now browsers ask me if I want to download index.php... Do I need to activate the php module? I wonder why it worked before the NameVirtualHost, and now it doesn't... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: NameVirtualHost breaks PHP
Yuri Petro asked: > Can you indicate Apache settings regarding php and virtualhosts? In the "main" server configuration area, I have: # The following is for PHP4 (conficts with PHP/FI, below): AddType application/x-httpd-php .php4 .php3 .phtml .php AddType application/x-httpd-php-source .phps # The following is for PHP3: AddType application/x-httpd-php3 .php3 AddType application/x-httpd-php3-source .phps # The following is for PHP/FI (PHP2): AddType application/x-httpd-php .phtml ### and the, further on down, there is: NameVirtualHost * ### and then, under the "VirtualHost" area, I have: Port 80 AddType application/x-httpd-php .php4 .php3 .phtml .php AddType application/x-httpd-php-source .phps ServerAdmin [EMAIL PROTECTED] DocumentRoot /home/tcrc/www/forum ServerName forum.tcrconline.com ErrorLog /home/tcrc/logs/error_log CustomLog /home/tcrc/logs/access_log combined ### ### By the way, I tried it with and without the "AddType" statements in the VirtualHost area. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] class PHP
Best I can figure, it's a very verbose description of a process analogous to using mod_rewrite to parse requests ending in .class and pass them off to a wrapper that instantiates the eponymous class (i.e., about 2 minutes of programming). But it was a little hard to get through, so I may have misread it. miguel On Sun, 28 Apr 2002, John Holmes wrote: > Can someone translate this to English? > > > -Original Message- > > From: Peter [mailto:[EMAIL PROTECTED]] > > Sent: Saturday, April 27, 2002 7:21 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] class PHP > > > > The text of this proposal, test code, and updates live at > > petermoulding.com/class. I place it here for discussion of the best > > approach before people build code. > > > > Class PHP > > > > An invention for a classier PHP. > > > > This invention uses PHP classes as Web pages. The invention can be > > implemented as a wrapper around PHP or as an enhancement to PHP. In > > Apache 2, the invention can be implemented as a filter to precede PHP. > I > > will give a quick outline of the requirement, then sketches of > > implementations, then detailed examples prototyped using PHP. > > > > The invention is named class. An Apache implementation could be a > module > > named class. If you write code to implement this invention, suffix the > > project name with your name as in class_John. > > > > To prevent a rapacious company copyrighting this invention using the > > excuse that it is a business process or anything else they can > > copyright, I declare my copyright on everything in this invention and > > any processes derivable from this. Please make your code > implementations > > GPL, www.gnu.org/copyleft/gpl.html, and mention my page at > > petermoulding.com/class. > > > > Invention Requirement > > The main requirement is to replace PHP's page input with invented > input. > > > > Here is a file named any_class.class that containing a PHP class named > > any_class: > > > class any_class > > { > > function any_class() > > { > > /* code to build a Web page. */ > > } > > } > > ?> > > > > Here is a Web page containing a PHP script to build the entire page > > using the PHP class any_class: > > > include_once("any_class.class"); > > $any_class = new any_class(); > > ?> > > > > The invention makes PHP initiate any_class.class as if any_class were > > included and instantiated by the example Web page. > > > > PHP Wrapper > > > > The invention could be implemented as a module for Apache or another > Web > > server by writing a wrapper for PHP. The wrapper would accept a call > > from Apache then pass the call on to PHP so PHP could perform 100% > > unaltered as if PHP were called direct from Apache. > > > > The module would look for class requests with a page of the form > *.class > > then intercept the URL and prepare to pass invented input to PHP. The > > Apache configuration parameters can ensure all requests for class go > to > > class and only requests for class to class. In a mixed class/PHP > > environment, the requested class can go to class and the PHP requests > > can go direct to PHP. There could also be a check in class for a class > > file so that all requests are directed to class and class processes > just > > those with a matching class file. > > > > When class finds a valid class request, class builds a PHP Web page > that > > includes the class file and initiates the class. To make PHP read the > > invented Web page, you could trap PHP's Web page read and substitute > the > > invented page. As PHP has to access files within the constraints of a > > Web server, the access technique could vary from release to release > and > > across Web servers. I will describe two quick implementation > > possibilities. > > > > If PHP reads files via Apache's file read functions (or an equivalent > on > > other web servers), class gets to view all file requests from PHP to > > Apache and monitor all replies. Class can then pass the invented page > > back to PHP without the request reaching Apache. PHP remains untouched > > by class. > > > > Where a Web server does not provide file access functions or PHP > chooses > > to not use those functions, class would need a modification to PHP to > > intercept file reads. The interception depends on the exact > compilation > > of PHP and would be in the form of a wrapper around a file access > > routine in PHP. The wrapper (or interception layer) needs to be at a > > level where the code can see file names and subvert the whole file > read > > process. Interception at this level requires PHP release dependent > > coding and is a step toward the PHP enhancement described next. > > PHP Enhancement > > A PHP enhancement would be an implementation of the invention direct > > within PHP's code so that PHP can react to class requests in > conjunction > > with an external process or without an external process. The ultimate > > enhancement would be to inco
Re: [PHP] Producing images in different sizes
Addressed to: Miguel Cruz <[EMAIL PROTECTED]> [EMAIL PROTECTED] ** Reply to note from Miguel Cruz <[EMAIL PROTECTED]> Sat, 27 Apr 2002 19:11:46 -0500 (CDT) > > I'm guessing the issue is that it complicates the process of adding new > images, because someone has to create and upload two corresponding files. > > This way, they get the benefit of rapid page generation combined with a > simpler administration process. > > miguel > Who said anything about UPLOADING two images? My understanding of the question was that he wanted to: "store only one copy of each image - full size." and "resize it down to the thumbnail size before sending it," IMnsHO, that's crazy, unless you have a very large number of images with very few repeat visits to their thumbnail pages. I agree, it is just as crazy to expect the user to do the thumbnail creation. ImageMagick does a great job of this, but it should be done when the file is uploaded, not every time an image needs to appear on a thumbnail page. It might not be that bad with 400X400 initial files, but resize time on my server for a mega-pixel JPEG from my digital camera is about 10-40 seconds which you might get a photo uploader to sit thru, but way too long for a visitor to your site. Rick > On Sat, 27 Apr 2002 [EMAIL PROTECTED] wrote: > > I think he already has the best solution. Store two images. How many > > thumbnails are there on a page? At 1-2 seconds per image to resize how > > long will you make every visitor wait to see the thumbnails? > > > > Disk space is cheap. If you have to buy another drive - no big deal. I > > don't know about you, but for me if a web page doesn't load in about 10-15 > > seconds I'm outa here! > > > > Rick > > > > > > > > ** Reply to note from Miguel Cruz <[EMAIL PROTECTED]> Sat, 27 Apr 2002 11:36:54 -0500 >(CDT) > > > > > > On Sat, 27 Apr 2002, Ray Paseur 703.346.0600 wrote: > > > > I am storing several detailed images at about 400x400 pixels (inventory > > > > for an art gallery). I show a page with thumbnails of the images. When > > > > a site visitor clicks on a thumbnail, I open a separate window to > > > > display the detailed image. > > > > > > > > Presently I am storing two copies of each image - full size and thumb. > > > > > > > > My objective is to store only one copy of each image - full size. (The > > > > rationale behind this is a complicated story involving old gallery > > > > owners, digital cameras, rudimentary image editing skills, etc.) > > > > > > > > I want the server to read the full size image, but resize it down to the > > > > thumbnail size before sending it, thus saving transmission time. > > > > > > > > Are there any server-side applications that can handle this? > > > > > > You could use ImageMagick (particularly, the 'convert' program) to do this > > > but decent results are not fast (not that it'll take several seconds or > > > anything, but it does take a certain amount of time, and everything adds > > > up). > > > > > > If you want to do this on the fly, I'd suggest having it save the > > > thumbnails when they're generated so that the next time someone comes, it > > > doesn't have to go through the process again. > > > > > > miguel > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > Rick Widmer > > Internet Marketing Specialists > > http://www.developersdesk.com > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > Rick Widmer Internet Marketing Specialists http://www.developersdesk.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PGP
On Sat, 27 Apr 2002, Richard Lynch wrote: > $test = escapeshellarg($cleartext); > exec("cat $test | /usr/bin/pgpe -a -t -f -r '[EMAIL PROTECTED]' > . . . > ^Kb^Estdin^H^@^@^@ $cleartext is the actual text? What if you used 'echo' instead of 'cat'? miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question
On Sat, 27 Apr 2002, Gerard Samuel wrote: > Is it possible to have PHP find out the ethernet's card MAC address?? > I know that one can parse the output of dmesg or equvalent to find it > out, but that would be OS platform > specific code. > I just want to know if php has a native way of finding out that information. Nope. You'd have to deal with it on a platform-by-platform basis. Look at the OSTYPE environment variable and switch() to various handlers of your creation. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Header question
Just replace the last line with: @mail ($To,$Subject,$Message,"From: $EmailSender\nReply-To: $EmailSender); -- Kind regards, Yuri. www.AceHoster.com Quality web hosting "Dean Ouellette" <[EMAIL PROTECTED]> ???/ ? ?: 000e01c1eef4$07cbeb40$0200a8c0@yoda">news:000e01c1eef4$07cbeb40$0200a8c0@yoda... > > I have a tell a friend script and got the php script from a friend to > make it work. I am a newbie so still do not fully udners stand it. > Here is the problem, it puts the following at the top of each e-mail: > X-Mailer: PHP/4.1.2 > > > Here is the script: > > $Subject = "Look at this, I think you will like it"; //The Emails > subject > $Email[] = "[EMAIL PROTECTED]"; > reset ($Email); > while (list(, $To) = each ($Email)) { > @mail ($To,$Subject,$Message,"From: $EmailSender\nReply-To: > $EmailSender\nX-Mailer: PHP/".phpversion()); > } > > ?> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: NameVirtualHost breaks PHP
You need to specify IP address in NameVirtualHost directive: NameVirtualHost 127.0.0.1 DocumentRoot /home/tcrc/www/forum ServerName forum.tcrconline.com ErrorLog /home/tcrc/logs/error_log CustomLog /home/tcrc/logs/access_log combined -- Kind regards, Yuri. www.AceHoster.com Quality web hosting "Greg Blakely" <[EMAIL PROTECTED]> ???/ ? ?: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Yuri Petro asked: > Can you indicate Apache settings regarding php and virtualhosts? In the "main" server configuration area, I have: # The following is for PHP4 (conficts with PHP/FI, below): AddType application/x-httpd-php .php4 .php3 .phtml .php AddType application/x-httpd-php-source .phps # The following is for PHP3: AddType application/x-httpd-php3 .php3 AddType application/x-httpd-php3-source .phps # The following is for PHP/FI (PHP2): AddType application/x-httpd-php .phtml ### and the, further on down, there is: NameVirtualHost * ### and then, under the "VirtualHost" area, I have: Port 80 AddType application/x-httpd-php .php4 .php3 .phtml .php AddType application/x-httpd-php-source .phps ServerAdmin [EMAIL PROTECTED] DocumentRoot /home/tcrc/www/forum ServerName forum.tcrconline.com ErrorLog /home/tcrc/logs/error_log CustomLog /home/tcrc/logs/access_log combined ### ### By the way, I tried it with and without the "AddType" statements in the VirtualHost area. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GET question
Hi to all. I pass parameters via querystring in this way: page.php?ID=5&ID=6&ID=23 In $_GET["ID"] I get only the value 23 I am surprised 'cause in ASP I get 5,6,23. Is there a way to make things working to have a sequence of values separated by commas? Am I doing something wrong in PHP? Thanks for your help, Evan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HTML in PHP
On Sun, 28 Apr 2002, Christian Ista wrote: > for ($i = 0; $i { >echo mysql_result($result,$i, "NAME"); > } > ?> > > Could you tell me how I can do to have a after each row. Two options: { echo mysql_result($result,$i, "NAME") . ''; } or: { echo mysql_result($result,$i, "NAME"); ?> was added onto the end of whatever else echo was outputting. In the second one, we temporarily switch back from PHP to HTML, output the tag, then switch back to PHP. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GET question
On Sun, 28 Apr 2002, Evan wrote: > I pass parameters via querystring in this way: > page.php?ID=5&ID=6&ID=23 > > In $_GET["ID"] I get only the value 23 > I am surprised 'cause in ASP I get 5,6,23. > > Is there a way to make things working to have a sequence of values separated > by commas? page.php?ID[]=5&ID[]=6&ID[]=23 the [] tells it to make ID an array. Otherwise each value just replaces the previous one. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Autoload of cookies on Linux fails, Win32 works???
On Sun, 28 Apr 2002, Joseph Smith wrote: > Assuming I've got a cookie called "loggedin" defined as "12345" > > In 4.2.0 on Win32, my cookies are preloaded so when I do > > if (isset($loggedin)) >echo $loggedin > > It checks to see if there is a variable named $loggedin that was > created by autoloading of cookies, then it prints "12345" > > On linux, this does not happen. In fact, there appears to be no > autoloading of variables. > > Is this intentional or is there a configuration setting I'm missing? Yes, your Windows PHP server is configured insecurely (register_globals is on). Try isset($_COOKIE['loggedin']) miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] date problem
On 28 Apr 2002 at 14:48, Nick Wilson wrote: > I have a field in MySQL db like this: date TIMESTAMP, > and it looks pretty regular like this: 20020428011911 If you've got the data in your database then do the date/time conversions as part of your sql query - it's more efficient. Something like this would work: $qid = db_query("SELECT DATE_FORMAT(TimeStamp, '%e %b %y') AS DispDate FROM sometable"); That will extract your timestamp as DD MMM from memory - have a look at the MySQL manual under the chapter on selects and date/time formatting and you'll get the complete list of '%x' options you can use. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird/inconsistent behaviour when sending an empty file? (WAMP, Apache2, PHP 4.2.0)
On 28 Apr 2002 at 17:54, Moritz Schallaboeck wrote: > it might very well be an ignorant oversight, but I can't explain the following > behaviour. Consider a file containing -only- this code: > > -snip- > > ?> > -snip- [etc] Just a personal opinion here... if you're sending output to a browser that is not formatted as a valid web page then you can't rely on what will work, or not work, for any given browser. IE in particular is very good at "fixing" broken html as it loads a page and this can hide otherwise serious problems with html. If you're going to output something to a browser then you _really_ should make sure it's valid html. At the very least that would mean including: in a page. What you do after that is up to you. At least if you include that much you'll get a valid web page and pretty much every browser will no what to do with it. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] failed query results
On 28 Apr 2002 at 13:48, baldey_uk wrote: > $customer_id_check=("SELECT id FROM $customer_table WHERE firstname = > '$firstname' && lastname = '$lastname' && email = '$email'"); > $result1=mysql_query($customer_id_check); > if (!$result1) { > print "theres no such customer!"; > } if (isset($result1) && !empty($result1) && mysql_num_rows($result1) == 0) { print "no customer"; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto refresh when data changed in Mysql
On 28 Apr 2002 at 20:32, Simonk wrote: > I have added the code, but it turn out : > > "Warning: Cannot add header information - headers already sent by (output > started at C:\Inetpub\php\hospital_equipment.php:5) in > C:\Inetpub\php\hospital_equipment.php on line 6 [etc] > Here is my full HTML code: > > > > Equipments' Detail > [etc] > header ("Expires: Mon, 1 Jan 1990 05:00:00 GMT");// Date in the past > header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); > // always modified > header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 > header ("Pragma: no-cache"); Put this stuff up above your and it will most likely work. You must put header stuff before any other output including white space (tabs, spaces, new lines etc). CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: NameVirtualHost breaks PHP
On 28 Apr 2002 at 16:11, Greg Blakely wrote: > > Can you indicate Apache settings regarding php and virtualhosts? > > In the "main" server configuration area, I have: [etc] > ### and then, under the "VirtualHost" area, I have: > > > Port 80 > AddType application/x-httpd-php .php4 .php3 .phtml .php > AddType application/x-httpd-php-source .phps > ServerAdmin [EMAIL PROTECTED] > DocumentRoot /home/tcrc/www/forum > ServerName forum.tcrconline.com > ErrorLog /home/tcrc/logs/error_log > CustomLog /home/tcrc/logs/access_log combined > get rid of the AddType lines in your virtual host definition. You don't need them. Settings in your main config area will be inherited by your virtual host config. When you change this stuff, don't forget to restart apache for the changes to take effect. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GET question
On 28 Apr 2002 at 23:30, Evan wrote: > I pass parameters via querystring in this way: > page.php?ID=5&ID=6&ID=23 > > In $_GET["ID"] I get only the value 23 Unless you set ID as an array, which you haven't, you'll only keep the last value. The simple answer is to have something like: page.php?ID1=5&ID2=6&ID=23 although there's quite a few other solutions depending on what it is you're trying to do. > Is there a way to make things working to have a sequence of values separated > by commas? Probably, but it's probably more effective to let us know what you're trying to do. There's probably better ways to achieve the end result you're after. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GET question
Thats because that query string is like saying: $ID = 5; $ID = 6; $ID = 23; If this is a form that you can't change the ID field names to ID1, ID2, ID3, etc. (which would probably be best) you could try something like: That will first unset all the variables that were defined automatically by PHP, and do it how ASP does. It would be a better idea to store them in an array instead of a CSV string, but whatever floats your boat. Evan Nemerson PS nice name ;) On Sunday 28 April 2002 14:30 pm, you wrote: > Hi to all. > > I pass parameters via querystring in this way: > page.php?ID=5&ID=6&ID=23 > > In $_GET["ID"] I get only the value 23 > I am surprised 'cause in ASP I get 5,6,23. > > Is there a way to make things working to have a sequence of values > separated by commas? > Am I doing something wrong in PHP? > > Thanks for your help, > Evan -- Common sense is not so common. Voltaire -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Supplied argument is not a valid MySQL result resource
What does that error mean? $result = mysql_query('select * from aannh_towns;'); echo 'info stored'; while ($query_data = mysql_fetch_array($result)) { echo "", $query_data['town'], "", $query_data['town_id'], ""; } ?> = dan mccullough "Theres no such thing as a problem unless the servers are on fire!" __ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Supplied argument is not a valid MySQL result resource
It means your query failed. www.php.net/mysql_error ---John Holmes... > -Original Message- > From: Dan McCullough [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 3:15 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Supplied argument is not a valid MySQL result resource > > What does that error mean? > > $result = mysql_query('select * from aannh_towns;'); > echo 'info stored'; > while ($query_data = mysql_fetch_array($result)) { > echo "", $query_data['town'], "", $query_data['town_id'], ""; } > ?> > > = > dan mccullough > > "Theres no such thing as a problem unless the servers are on fire!" > > > __ > Do You Yahoo!? > Yahoo! Health - your guide to health and wellness > http://health.yahoo.com > > -- > 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] Autoload of cookies on Linux fails, Win32 works???
Thanks, but when I tried this.. I consistently get "No Cookie!!" Yes, the cookie is set.. I can delete the cookies and a new one gets created. - Original Message - From: "Miguel Cruz" <[EMAIL PROTECTED]> To: "Joseph Smith" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 4:35 PM Subject: Re: [PHP] Autoload of cookies on Linux fails, Win32 works??? > On Sun, 28 Apr 2002, Joseph Smith wrote: > > Assuming I've got a cookie called "loggedin" defined as "12345" > > > > In 4.2.0 on Win32, my cookies are preloaded so when I do > > > > if (isset($loggedin)) > >echo $loggedin > > > > It checks to see if there is a variable named $loggedin that was > > created by autoloading of cookies, then it prints "12345" > > > > On linux, this does not happen. In fact, there appears to be no > > autoloading of variables. > > > > Is this intentional or is there a configuration setting I'm missing? > > Yes, your Windows PHP server is configured insecurely (register_globals > is on). > > Try isset($_COOKIE['loggedin']) > > miguel > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Supplied argument is not a valid MySQL result resource
Probably means your query failed. What line did the error occur on? You should be able to track down your problem with that. On Sunday 28 April 2002 15:14 pm, you wrote: > What does that error mean? > > $result = mysql_query('select * from aannh_towns;'); > echo 'info stored'; > while ($query_data = mysql_fetch_array($result)) { > echo "", $query_data['town'], "", $query_data['town_id'], ""; } > ?> > > = > dan mccullough > > "Theres no such thing as a problem unless the servers are on fire!" > > > __ > Do You Yahoo!? > Yahoo! Health - your guide to health and wellness > http://health.yahoo.com -- A classic is a book which people praise and don't read. Samuel Clemens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Autoload of cookies on Linux fails, Win32 works???
Actually.. I see now... Windows doesn't care about cookie case. Linux does. However, I still can't get the value from the $_COOKIES array. It tells me it's defined, but doesn't return the value of the cookie. Any thoughts? J - Original Message - From: "Miguel Cruz" <[EMAIL PROTECTED]> To: "Joseph Smith" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 4:35 PM Subject: Re: [PHP] Autoload of cookies on Linux fails, Win32 works??? > On Sun, 28 Apr 2002, Joseph Smith wrote: > > Assuming I've got a cookie called "loggedin" defined as "12345" > > > > In 4.2.0 on Win32, my cookies are preloaded so when I do > > > > if (isset($loggedin)) > >echo $loggedin > > > > It checks to see if there is a variable named $loggedin that was > > created by autoloading of cookies, then it prints "12345" > > > > On linux, this does not happen. In fact, there appears to be no > > autoloading of variables. > > > > Is this intentional or is there a configuration setting I'm missing? > > Yes, your Windows PHP server is configured insecurely (register_globals > is on). > > Try isset($_COOKIE['loggedin']) > > miguel > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Supplied argument is not a valid MySQL result resource
I am betting the problem is simply your semicolon... never use a semicolon in a php mysql query. It doesn't need one. In general, though, you should write your query such that it will tell you exactly what went wrong... Re-write this like so: $sql = 'select * from aannh_towns'; $result = mysql_query($sql) or exit("Query failed. Error: ".mysql_error()."".$sql); This will spit out the mysql error as well as the query as mysql tried to execute it. You could even make this a function if you like... then all you'd have to do is pass the query into it and it'll spit out the result resource. Something like: function sql_query($sql) { $result = mysql_query($sql) or exit("Query failed. Error: ".mysql_error()."".$sql); return $result; } This will save you a lot of time searching for what broke! :-) Cheers, # Nathan - Original Message - From: "Dan McCullough" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, April 28, 2002 4:14 PM Subject: [PHP] Supplied argument is not a valid MySQL result resource What does that error mean? $result = mysql_query('select * from aannh_towns;'); echo 'info stored'; while ($query_data = mysql_fetch_array($result)) { echo "", $query_data['town'], "", $query_data['town_id'], ""; } ?> = dan mccullough "Theres no such thing as a problem unless the servers are on fire!" __ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com -- 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: Re[2]: [PHP] Re: Header question
Not sure what is happening. Still getting same error. As soon as I remove \nX-Mailer: PHP/".phpversion() I get the error message ___- May be you just made incorrect modification... Correct php code: Best regards, Yuri. www.AceHoster.com <- your one stop web hosting shop Original Message From: Dean Ouellette <[EMAIL PROTECTED]> To: 'Yuri Petro' <[EMAIL PROTECTED]> Subject: [PHP] Re: Header question Now I get an error says Parse error: parse error in /usr/local/psa/home/vhosts/sitename.com/httpdocs/involved/friendsubmit.p hp on line 165 Line 165 is a -Original Message- From: Yuri Petro [mailto:[EMAIL PROTECTED]] Sent: Sunday, April 28, 2002 5:17 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Header question Just replace the last line with: @mail ($To,$Subject,$Message,"From: $EmailSender\nReply-To: $EmailSender); -- Kind regards, Yuri. www.AceHoster.com Quality web hosting "Dean Ouellette" <[EMAIL PROTECTED]> ???/ ? ?: 000e01c1eef4$07cbeb40$0200a8c0@yoda">news:000e01c1eef4$07cbeb40$0200a8c0@yoda... > > I have a tell a friend script and got the php script from a friend to > make it work. I am a newbie so still do not fully udners stand it. > Here is the problem, it puts the following at the top of each e-mail: > X-Mailer: PHP/4.1.2 > > > Here is the script: > > $Subject = "Look at this, I think you will like it"; //The Emails > subject > $Email[] = "[EMAIL PROTECTED]"; > reset ($Email); > while (list(, $To) = each ($Email)) { > @mail ($To,$Subject,$Message,"From: $EmailSender\nReply-To: > $EmailSender\nX-Mailer: PHP/".phpversion()); > } > > ?> > > -- 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] Supplied argument is not a valid MySQL result resource
On Sun, 28 Apr 2002, Dan McCullough wrote: > What does that error mean? > > $result = mysql_query('select * from aannh_towns;'); > echo 'info stored'; > while ($query_data = mysql_fetch_array($result)) { > echo "", $query_data['town'], "", $query_data['town_id'], ""; } > ?> You'd know if you checked mysql_error() after not getting anything in $result. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re[2]: [PHP] Re: Header question
You need a closing quote after $EmailSender... $EmailSender"); miguel On Sun, 28 Apr 2002, Dean Ouellette wrote: > Not sure what is happening. Still getting same error. As soon as I > remove > \nX-Mailer: PHP/".phpversion() > I get the error message > > > > ___- > May be you just made incorrect modification... > Correct php code: > > $Subject = "Look at this, I think you will like it"; //The Emails > subject > $Message = "Your message here"; > $Email[] = "[EMAIL PROTECTED]"; > reset ($Email); > while (list(, $To) = each ($Email)) { > @mail ($To,$Subject,$Message,"From: $EmailSender\nReply-To: > $EmailSender); > } > ?> > > Best regards, > Yuri. > www.AceHoster.com <- your one stop web hosting shop > > Original Message > From: Dean Ouellette <[EMAIL PROTECTED]> > To: 'Yuri Petro' <[EMAIL PROTECTED]> > Subject: [PHP] Re: Header question > > > Now I get an error says Parse error: parse error in > /usr/local/psa/home/vhosts/sitename.com/httpdocs/involved/friendsubmit.p > hp on line 165 > > Line 165 is a > > -Original Message- > From: Yuri Petro [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 5:17 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Header question > > Just replace the last line with: > > @mail ($To,$Subject,$Message,"From: $EmailSender\nReply-To: > $EmailSender); > > -- > Kind regards, > Yuri. > > www.AceHoster.com Quality web hosting > > > "Dean Ouellette" <[EMAIL PROTECTED]> ???/ ? > ?: > 000e01c1eef4$07cbeb40$0200a8c0@yoda">news:000e01c1eef4$07cbeb40$0200a8c0@yoda... > > > > I have a tell a friend script and got the php script from a friend to > > make it work. I am a newbie so still do not fully udners stand it. > > Here is the problem, it puts the following at the top of each e-mail: > > X-Mailer: PHP/4.1.2 > > > > > > Here is the script: > > > > > $Subject = "Look at this, I think you will like it"; //The Emails > > subject > > $Email[] = "[EMAIL PROTECTED]"; > > reset ($Email); > > while (list(, $To) = each ($Email)) { > > @mail ($To,$Subject,$Message,"From: $EmailSender\nReply-To: > > $EmailSender\nX-Mailer: PHP/".phpversion()); > > } > > > > ?> > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Hey PHP PPL - Great Question !!!
Session Data. What is the best. to save in database, or to save as file ??? let me know. Cheerz Vins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] register_globals=Off Question
How do I use $PHP_SELF with register_globals off? I looked up the documentation on php.net but haven't gotten this line of code to work: I get this error instead: [28-Apr-2002 16:33:31] PHP Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in - on line 140 what am I doing wrong? thanks, Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Hey PHP PPL - Great Question !!!
Yes > -Original Message- > From: Vins [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 3:52 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Hey PHP PPL - Great Question !!! > > Session Data. > > What is the best. > to save in database, or to save as file ??? > > let me know. > > Cheerz > Vins > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Hey PHP PPL - Great Question !!!
Vins wrote: > Session Data. > > What is the best. > to save in database, or to save as file ??? > > let me know. > > Cheerz > Vins > > Sorry Vins, It's not a great question. It's too dependant on what you need to do, what your development level is, and a host of other factors. Start with files and when they don't do what you need, move to a database. Michael Kimsal http://www.phphelpdesk.com Guaranteed PHP support when you need it 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Append a line to a text file
I need to add a email to the text file that is already written, but I get the file writen over , so I always get only the last email send by the form. What I need is a form that get the e-mail and it writes the email at the end of a text file. Thanx, Rodrigo
[PHP] Re: Hey PHP PPL - Great Question !!!
For example: one form... - First name - last name - address - country - phone - email - mobile number After you click submit on the first page, it sends you to a preview data page where you can check all the data. instead of inserting tons of hidden input form fields and waist download time, use a session. after the button on the preview page is clicked, submit to a save page, where data will be entered into a db but all values my be called from the session. now would it be wise, faster and more safer to use a database or a file to save the sessions ? "Vins" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Session Data. > > What is the best. > to save in database, or to save as file ??? > > let me know. > > Cheerz > Vins > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] register_globals=Off Question
You are missing an ending quote to begin with. Either add it in and use braces, or remove the quotes. action = '' or... action = '' or... action = '' Adapt to your needs... ---John Holmes... > -Original Message- > From: Kirk Babb [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 3:58 PM > To: [EMAIL PROTECTED] > Subject: [PHP] register_globals=Off Question > > How do I use $PHP_SELF with register_globals off? I looked up the > documentation on php.net but haven't gotten this line of code to work: > > > > I get this error instead: > > [28-Apr-2002 16:33:31] PHP Parse error: parse error, expecting `T_STRING' > or `T_VARIABLE' or `T_NUM_STRING' in - on line 140 > > what am I doing wrong? thanks, > > Kirk > > > > -- > 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] register_globals=Off Question
On Sun, 28 Apr 2002, Kirk Babb wrote: > How do I use $PHP_SELF with register_globals off? I looked up the > documentation on php.net but haven't gotten this line of code to work: > > action='' miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Append a line to a text file
That is a dam good question LOL I would also love to know how2 append text to the END of a file. Vins "Rodrigo" <[EMAIL PROTECTED]> wrote in message 000f01c1ef08$debba1e0$6e48bbac@rodirgo">news:000f01c1ef08$debba1e0$6e48bbac@rodirgo... > I need to add a email to the text file that is already written, but I > get the file writen over , so I always get only the last email send by > the form. > > What I need is a form that get the e-mail and it writes the email at the > end of a text file. > > Thanx, > > Rodrigo > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Append a line to a text file
On Sun, 28 Apr 2002, Rodrigo wrote: > I need to add a email to the text file that is already written, but I > get the file writen over , so I always get only the last email send by > the form. > > What I need is a form that get the e-mail and it writes the email at the > end of a text file. www.php.net/fopen miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Supplied argument is not a valid MySQL result resource
On 28 Apr 2002 at 15:14, Dan McCullough wrote: > What does that error mean? > > $result = mysql_query('select * from aannh_towns;'); > echo 'info stored'; > while ($query_data = mysql_fetch_array($result)) { > echo "", $query_data['town'], "", $query_data['town_id'], ""; } > ?> Means you stuffed up your sql query. If you've copied it down right then I'd say you need to ditch the ';' from your query. CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Re: Header question
in order to add a new line to a mail header you need not use '\n' you MUST use '\r\n' otherwise no headers will be sent. "Dean Ouellette" <[EMAIL PROTECTED]> wrote in message 001901c1ef06$697b3910$0200a8c0@yoda">news:001901c1ef06$697b3910$0200a8c0@yoda... > > Not sure what is happening. Still getting same error. As soon as I > remove > \nX-Mailer: PHP/".phpversion() > I get the error message > > > > ___- > May be you just made incorrect modification... > Correct php code: > > $Subject = "Look at this, I think you will like it"; //The Emails > subject > $Message = "Your message here"; > $Email[] = "[EMAIL PROTECTED]"; > reset ($Email); > while (list(, $To) = each ($Email)) { > @mail ($To,$Subject,$Message,"From: $EmailSender\nReply-To: > $EmailSender); > } > ?> > > Best regards, > Yuri. > www.AceHoster.com <- your one stop web hosting shop > > Original Message > From: Dean Ouellette <[EMAIL PROTECTED]> > To: 'Yuri Petro' <[EMAIL PROTECTED]> > Subject: [PHP] Re: Header question > > > Now I get an error says Parse error: parse error in > /usr/local/psa/home/vhosts/sitename.com/httpdocs/involved/friendsubmit.p > hp on line 165 > > Line 165 is a > > -Original Message- > From: Yuri Petro [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 5:17 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Header question > > Just replace the last line with: > > @mail ($To,$Subject,$Message,"From: $EmailSender\nReply-To: > $EmailSender); > > -- > Kind regards, > Yuri. > > www.AceHoster.com Quality web hosting > > > "Dean Ouellette" <[EMAIL PROTECTED]> ???/ ? > ?: > 000e01c1eef4$07cbeb40$0200a8c0@yoda">news:000e01c1eef4$07cbeb40$0200a8c0@yoda... > > > > I have a tell a friend script and got the php script from a friend to > > make it work. I am a newbie so still do not fully udners stand it. > > Here is the problem, it puts the following at the top of each e-mail: > > X-Mailer: PHP/4.1.2 > > > > > > Here is the script: > > > > > $Subject = "Look at this, I think you will like it"; //The Emails > > subject > > $Email[] = "[EMAIL PROTECTED]"; > > reset ($Email); > > while (list(, $To) = each ($Email)) { > > @mail ($To,$Subject,$Message,"From: $EmailSender\nReply-To: > > $EmailSender\nX-Mailer: PHP/".phpversion()); > > } > > > > ?> > > > > > > > > -- > 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] Date and Time
Hi all, Anyone know any reason that the date function would return 2am in the morning as 102 if i use it in the following manner? $time=date("H:i:s"); print $time; this outputs 102:14:51 instead of 02:14:51, anyone know where the 1 comes from? and why its there? Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] redirection
Hi, I want to set up a check that the page cannot be exacted by calling from another page. E.g., members.php can only be excited if it called by login.php. So I set if (eregi("members.php", $_SERVER['PHP_SELF'])) Header("Location, login.php"); at the very top of members.php. But I am being redirected to login.php no matter if members.php was called from login.php. What's proper way of implementing this? Regards, Norman -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date and Time
What version of PHP, OS, web server, etc are you running? Is that the exact code you used? Did you try it in a file all by itself and did it return the same result? ---John Holmes... > -Original Message- > From: baldey_uk [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 6:22 PM > To: Php-General > Subject: [PHP] Date and Time > > Hi all, > > Anyone know any reason that the date function would return 2am in the > morning as 102 if i use it in the following manner? > > $time=date("H:i:s"); > print $time; > > > this outputs 102:14:51 instead of 02:14:51, anyone know where the 1 comes > from? and why its there? > > > Cheers From > > baldey_uk > > > > -- > 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] register_globals=Off Question
Looks like you forgot your ticks ' around the PHP_SELF. If I am correct, it should be $_SERVER['PHP_SELF']. Either way, you might want to try this. Somebody else posted it before and I have been using it so that no matter what version of PHP my program runs on, it should work. if (isset($_SERVER)) $PHP_SELF = $_SERVER['PHP_SELF']; Steve At 05:58 PM 4/28/2002, Kirk Babb wrote: >How do I use $PHP_SELF with register_globals off? I looked up the >documentation on php.net but haven't gotten this line of code to work: > > > >I get this error instead: > >[28-Apr-2002 16:33:31] PHP Parse error: parse error, expecting `T_STRING' >or `T_VARIABLE' or `T_NUM_STRING' in - on line 140 > >what am I doing wrong? thanks, > >Kirk > > > >-- >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] redirection
On Monday 29 April 2002 10:11, Norman Zhang wrote: > Hi, > > I want to set up a check that the page cannot be exacted by calling from > another page. E.g., members.php can only be excited if it called by > login.php. > > So I set > > if (eregi("members.php", $_SERVER['PHP_SELF'])) Header("Location, > login.php"); > > at the very top of members.php. But I am being redirected to login.php no > matter if members.php was called from login.php. What's proper way of > implementing this? In your code, assuming your regex is correct it matches *all* the time, thus no matter how you get to members.php, you'll be redirected to login.php. And do you really only want to let people access members.php directly after visting login.php? How about if they login, go to the members page then go somewhere else on your site, then try to go back to the members page and they can't! I would suggest that you use a more robust mechanism, such as sessions, for allowing/denying access to certain pages. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* To generalize is to be an idiot. -- William Blake */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Append a line to a Text File
I still need to know how to do it, since the "a+" or the "a" give me problems... I need to be able to add a line at the end of a text file thru sending the information (and by this I mean the e-mail to be writen) thru a form, and this new information should be added to the file at the end of it without overwriting it. Thanx, Rodrigo PS: If possible send a code for instruction. ;)
Re: [PHP] Append a line to a Text File
On Sun, 28 Apr 2002, Rodrigo wrote: > I still need to know how to do it, since the "a+" or the "a" give me > problems... What kind of problems? Do you get an error message that you can paste into a message for us to see? Does the file get corrupted in some specific way that you can describe? Does your computer start on fire? > I need to be able to add a line at the end of a text file thru sending > the information (and by this I mean the e-mail to be writen) thru a > form, and this new information should be added to the file at the end of > it without overwriting it. > > PS: If possible send a code for instruction. ;) miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Append a line to a Text File
How about you send us your code, because you're the one doing something wrong. "a" is what you want, if it's not working, then there is an error in your code or logic. ---John Holmes... > -Original Message- > From: Rodrigo [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 7:50 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Append a line to a Text File > > I still need to know how to do it, since the "a+" or the "a" give me > problems... > I need to be able to add a line at the end of a text file thru sending > the information (and by this I mean the e-mail to be writen) thru a > form, and this new information should be added to the file at the end of > it without overwriting it. > Thanx, > Rodrigo > > PS: If possible send a code for instruction. ;) > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] append line to text file HELP !!!
Ok guys, this is the code and under it you can see what I get when I try to submit the form. Warning: Supplied argument is not a valid File-Handle resource in /home/restricted/home/h4ck3r/public_html/write.php on line 4 Warning: Supplied argument is not a valid File-Handle resource in /home/restricted/home/h4ck3r/public_html/write.php on line 6
[PHP] lookin for a Menuing System...
I could do this myself but I don't want to waist time writing something that I could have just asked for.. what I need is a menuing system.. When link is clicked the sub-topics appear under the topic you just clicked on.. e.g. if you where to click on Contact. Contact --becomes: Contact Enquires Account / Billing Media Enquiries Much like this JavaScript one... except I need it in PHP... http://www.dynamicdrive.com/dynamicindex1/navigate1.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] keymappings - PHP or MySQL?
Hi, At the moment im getting a difference in keymappings between what is typed into a field and what is stored in the database. I have an html form that gets a text string called $email and this is inserted into a VARCHAR database feild via php, the problem is when special characters are included in the email address. For example [EMAIL PROTECTED] gets stored in the database as baldey\[EMAIL PROTECTED] Has anyone seen this before? Is this a PHP or mysql issue? Do i have to set special options to use a UK keymap or something like that? If anyone has any links to docs that deal with this sort of thing i'd really appreciate them!! Cheers From baldey_uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] append line to text file HELP !!!
On Mon, 29 Apr 2002, Rodrigo wrote: > Ok guys, this is the code and under it you can see what I get when I try > to submit the form. > > $file_pointer=file('emails.txt','a') || exit; > $string_to_write = ("$newmail")."\n"; > $s=fopen($file_pointer,$string_to_write); > $s=fclose($fp); > ?> Where did this code come from? It looks like you took what I mailed and just sort of smudged it around into an incomprehensible, random mess. Let's look at it on a line-by-line basis: > $file_pointer=file('emails.txt','a') || exit; Here you changed "fopen" to "file" for some weird reason. Also, you don't tell it which directory the file "emails.txt" should be in. Put in a full pathname unless the web server actually has write privileges on the directory containing your script, in which case you have a whole different set of troubles. > $string_to_write = ("$newmail")."\n"; Good enough, though it's easier to just write: $string_to_write = $newmail . "\n"; or even: $string_to_write = "$newmail\n"; > $s=fopen($file_pointer,$string_to_write); Here you changed "fwrite" to "fopen" for, presumably, the same weird reason that you made the weird change above. > $s=fclose($fp); Where did $fp come from? The file pointer variable in this program is called $file_pointer. > Warning: Supplied argument is not a valid File-Handle resource in > /home/restricted/home/h4ck3r/public_html/write.php on line 4 No surprise here. You can't randomly throw functions together. They all have specific purposes and expect specific types of inputs. I'd suggest two things: 1) Read the documentation carefully. 2) If someone gives you an example that might work, try it verbatim, and test after each change. Then you'll know when it went wrong. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PayPal: Instant Payment Notification
Lauri, There are a couple links here that might help: http://www.paypalipn.com/scripts.html Chris Montgomery[EMAIL PROTECTED] Airtight Web Services http://www.airtightweb.com Web Development, Web Project Management, Software Sales 210-490-3249/888-745-7603 > -Original Message- > From: Lauri Vain [mailto:[EMAIL PROTECTED]] > Sent: Saturday, April 27, 2002 11:26 AM > To: 'PHP' > Subject: [PHP] PayPal: Instant Payment Notification > > > Hello there, > > Has anybody worked with PayPal's Instant Payment Notification? > > How exactly does it work -- will the payer ever go to PayPal's site > itself (and leave my site for a sec) or will all contact with PayPal's > servers be handled by my script? > > I have to write a system that enables payments via this service, but I'm > low on documentation and this service is a new one for me. > > An overview of the process and pointers would be great! > > Thanks, > Lauri > -- > Tharapita Creations > [server-client web applications] > [EMAIL PROTECTED] > Mobile: +372 53 410 610 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: lookin for a Menuing System...
There are many Javascript menu editors. I think that's what you need. Dan wrote: > I could do this myself but I don't want to waist time writing something that > I could have just asked for.. > > what I need is a menuing system.. > > When link is clicked the sub-topics appear under the topic you just clicked > on.. > > e.g. if you where to click on Contact. > > Contact > --becomes: > > Contact >Enquires >Account / Billing >Media Enquiries > > Much like this JavaScript one... except I need it in PHP... > http://www.dynamicdrive.com/dynamicindex1/navigate1.htm > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] append line to text file HELP !!!
Do you read the replies that were sent to you. Where did you get file() from and why are you using fopen() to write to a file?? You're lucky Miguel is such a nice guy and helping you out. ---John Holmes... > -Original Message- > From: Rodrigo [mailto:[EMAIL PROTECTED]] > Sent: Sunday, April 28, 2002 8:26 PM > To: [EMAIL PROTECTED] > Subject: [PHP] append line to text file HELP !!! > > Ok guys, this is the code and under it you can see what I get when I try > to submit the form. > > > $file_pointer=file('emails.txt','a') || exit; > $string_to_write = ("$newmail")."\n"; > $s=fopen($file_pointer,$string_to_write); > $s=fclose($fp); > ?> > > > Warning: Supplied argument is not a valid File-Handle resource in > /home/restricted/home/h4ck3r/public_html/write.php on line 4 > > Warning: Supplied argument is not a valid File-Handle resource in > /home/restricted/home/h4ck3r/public_html/write.php on line 6 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php