Re: [PHP] smarty
Tuesday, April 6, 2004, 5:33:03 PM, you wrote: > hi all has anyone used smarty before? what do you think of it? I think it's > pretty nice to seperate your script (code) from your design. > i would like to hear your comments and if you have any alternatives let me > know. Hi, I've used it on a few sites - and I sort of can't do without any more :) - just kidding, but the clean seperation of logic and presentation helps a lot creating maintainable code. Speedwise it's very fast, no complaints there. There might have been a couple limitation here and there (uhm - new versions took care of that for me as well), but then you can write your own extensions in no time and get around those as well. Bottom line: I definitely recommend it. Richard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Reusing MySQL Connections - Can it be done?
Red Wingate wrote: [...] I tried this, but, same results. If I store the Resource ID from a mysql_pconnect() in $GLOBALS['_CONNECT_DB'] and then call... mysql_query($query, $GLOBALS['_CONNECT_DB']); [...] How are you setting the global? [...] I guess he said he is using $GLOBALS['_CONNECT_DB'] :-p I was asking for the exact line of code... -- paperCrane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Keyword Search
[snip] Thanx for the advice. I'll give it a try. BTW, I know that some of my questions belong on a SQL list. Can you recommend any? I haven't found any as active or helpful as this PHP one. [/snip] Some of them depend on the database in question. For MySql [EMAIL PROTECTED] is a good one. Many notables in the MySQL field are there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keyword Search
On Tue, 6 Apr 2004 11:25:09 -0500, Jay Blanchard wrote: > [snip] > I've inherited a database so must live with a less than elegant > structure. > The table contains one "keyword" field into which the author has entered > things like... > > Record 1 = Apples > Record 2 = Apples, Bananas > Record 3 = Apples, Figs > Record 4 = Bananas, Figs, Dates > > I need to do a search on this field to return all of the records > containing > "Figs". What's the search syntax? > > I've tried... > SELECT * from dbname.tablename MATCH (dbname.fieldname) AGAINST 'Figs' > [/snip] > > A. Belongs on a SQL list (and there are plenty) > 2. SELECT * FROM dbname.tablename WHERE (dbname.fieldname) LIKE '%Figs%' Thanx for the advice. I'll give it a try. BTW, I know that some of my questions belong on a SQL list. Can you recommend any? I haven't found any as active or helpful as this PHP one. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Array_keys problem
On 04 April 2004 01:13, Robin 'Sparky' Kopetzky wrote: > function key_exists($ps_key) > { > if ( in_array($ps_key, > array_keys($this->ma_arguments)) ) { > return true; > } else { > return false; > } > } Ummm -- function key_exists($ps_key) { return array_key_exists($ps_key, this->ma_arguments); } ? (Assuming it's passed the is_array() test, of course!) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Keyword Search
Hello Robb, Tuesday, April 6, 2004, 5:24:55 PM, you wrote: RK> I need to do a search on this field to return all of the records containing RK> "Figs". What's the search syntax? RK> I've tried... RK> SELECT * from dbname.tablename MATCH (dbname.fieldname) AGAINST 'Figs' RK> It doesnt' work. Does the keywords table have a fulltext index on it? If so the above would work, but only if you have reduced the minimum word length allowed. You could just do: SELECT * FROM table WHERE keyword LIKE '%Figs%' ? -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Keyword Search
[snip] I've inherited a database so must live with a less than elegant structure. The table contains one "keyword" field into which the author has entered things like... Record 1 = Apples Record 2 = Apples, Bananas Record 3 = Apples, Figs Record 4 = Bananas, Figs, Dates I need to do a search on this field to return all of the records containing "Figs". What's the search syntax? I've tried... SELECT * from dbname.tablename MATCH (dbname.fieldname) AGAINST 'Figs' [/snip] A. Belongs on a SQL list (and there are plenty) 2. SELECT * FROM dbname.tablename WHERE (dbname.fieldname) LIKE '%Figs%' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Keyword Search
I've inherited a database so must live with a less than elegant structure. The table contains one "keyword" field into which the author has entered things like... Record 1 = Apples Record 2 = Apples, Bananas Record 3 = Apples, Figs Record 4 = Bananas, Figs, Dates I need to do a search on this field to return all of the records containing "Figs". What's the search syntax? I've tried... SELECT * from dbname.tablename MATCH (dbname.fieldname) AGAINST 'Figs' It doesnt' work. Thanx in advance -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] smarty
Apr 6 at 5:33pm, Angelo Zanetti wrote: > hi all has anyone used smarty before? what do you think of it? I think > it's pretty nice to seperate your script (code) from your design. > i would like to hear your comments and if you have any alternatives There are a lot of templating systems for PHP, but I chose Smarty because it seemed the most feature-laden, and likely to have continued support. I wanted to standardize on something, so I went for the most ubiquitous. Really, I couldn't be happier with it in every regard. At first it may seem like more than you need, but continue working with it and you'll find new design strategies that take you further than you ever thought you'd go. It's one of those things you start using and never look back. I use it on almost every project now, even small ones. There are the naysayers who complain it's too bloated for basic work, but I think the powerful benefits far outweigh any performance issues. I've never felt like it was slow or too much for a given task. Get yo' template on! --Kelly (another Smarty fan) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expressions
* Thus wrote Matt Palermo ([EMAIL PROTECTED]): > What exactly does this do: > Your original expression: /< (?!p|br) [^>]* >/x Find '<' not followed by 'p|br' until the first '>' we find. - matches < > - matches Its a bit confusing as why the matches, perhaps the documentation at http://php.net/pcre might explain it a little more. > /< (?<=p|br) [^>]+ >/x > Find '<' until, if 'any charcaters' between, '>' and be sure that 'p|br' exist before 'any characters' And perhaps a little more effecient than the one above: /< (?=p|br) [^>]+ >/x Find '<', followed by 'p|br' until, if 'any characters' between, '>'. The last one probably is a better one since it will fail quickly whereas look behinds are a bit expensive since it will have to match < [^>]+ > before it considers the 'p|br'. > It may work, I just want to understand what it's looking for. HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connecting to Databases
On Tue, 6 Apr 2004 10:24:29 -0500, Robb Kerr wrote: > On Tue, 6 Apr 2004 11:18:11 -0400, John W. Holmes wrote: > >> From: "Robb Kerr" <[EMAIL PROTECTED]> >> >>> I have found that it is not uncommon when trying to connect to a database >>> on an Apache server to get a return similar to "Access denied for user: >>> [EMAIL PROTECTED]". I just ran into this problem because I wanted to use >>> SQLyog to manipulate a table that already exists on one of my servers. I >>> went to the "Connections" document that Dreamweaver creates and copied all >>> of the connection info (host, db, user, password) exactly into the >>> connection dialogue of SQLyog. The error message above was returned when I >>> tried to connect although I can connect Dreamweaver to the database >> without >>> problem even though the IPAdress is not listed as part of the username. >> >> With MySQL, a user is given permission to connect with a specific username >> and password _and_ from a specific host. When you run the script from >> Dreamweaver, is it on the same machine as SQLYog? You probably just need to >> modify your MySQL user to have permission to connect from "IPAddress". >> >> ---John Holmes... > > Unfortunately, SQLyog and Dreamweaver reside on the same machine. Should I > create a new user for the database which is "[EMAIL PROTECTED]"? Why would > SQLyog require this while Dreamweaver does not? And, why doesn't identical > connection information work on both applications? I solved the problem by adding my IP address to the Access Hosts list for the database. Fortunately I use a cable modem with a static IP address, but if I were using a dialup with a dynamic IP, would I have to add that IP as an Access Host every time I dialed up? This seems wrong. -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function CreateDate i made doesnt work?
> > Replace the above two lines with > > $time = date('YmdHis', mktime(0,0,0,$month,$day,$year); > ok the function works now because when i echo the output of $_SESSION['add']['start_date'] it shows the right 14 digit timestamp for the date i wanted to create... now the problem is getting it to echo on a page in a normal "standard user readable format"... i have the following line i used to attempt that with but still..no matter what i put in the form for a date it returns monday january 15 2038..or in one instance of playing with it even ended up with december 31 1969... even though i put in the date i wanted ... say "first saturday" 9 (september) 2004 here is the line i used: something must be wrong with it Start Date: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] smarty
hi all has anyone used smarty before? what do you think of it? I think it's pretty nice to seperate your script (code) from your design. i would like to hear your comments and if you have any alternatives let me know. Angelo Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Technikon or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connecting to Databases
On Tue, 6 Apr 2004 11:18:11 -0400, John W. Holmes wrote: > From: "Robb Kerr" <[EMAIL PROTECTED]> > >> I have found that it is not uncommon when trying to connect to a database >> on an Apache server to get a return similar to "Access denied for user: >> [EMAIL PROTECTED]". I just ran into this problem because I wanted to use >> SQLyog to manipulate a table that already exists on one of my servers. I >> went to the "Connections" document that Dreamweaver creates and copied all >> of the connection info (host, db, user, password) exactly into the >> connection dialogue of SQLyog. The error message above was returned when I >> tried to connect although I can connect Dreamweaver to the database > without >> problem even though the IPAdress is not listed as part of the username. > > With MySQL, a user is given permission to connect with a specific username > and password _and_ from a specific host. When you run the script from > Dreamweaver, is it on the same machine as SQLYog? You probably just need to > modify your MySQL user to have permission to connect from "IPAddress". > > ---John Holmes... Unfortunately, SQLyog and Dreamweaver reside on the same machine. Should I create a new user for the database which is "[EMAIL PROTECTED]"? Why would SQLyog require this while Dreamweaver does not? And, why doesn't identical connection information work on both applications? -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help importing a text file via phpmyadmin
From: "Brian Dunning" <[EMAIL PROTECTED]> > I'm trying to use phpmyadmin's "Insert data from a textfile into table" > function. I've done this before many times, exactly the same way, and > never had a problem. But today I'm getting: > >#1148 - The used command is not allowed with this MySQL version > > Is there a common cause for this error? I find little helpful info in > the phpmyadmin documentation. Any ideas appreciated... :) I think you need FILE permission to use LOAD DATA INFILE queries. The user you're connecting with must not have that permission. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Connecting to Databases
From: "Robb Kerr" <[EMAIL PROTECTED]> > I have found that it is not uncommon when trying to connect to a database > on an Apache server to get a return similar to "Access denied for user: > [EMAIL PROTECTED]". I just ran into this problem because I wanted to use > SQLyog to manipulate a table that already exists on one of my servers. I > went to the "Connections" document that Dreamweaver creates and copied all > of the connection info (host, db, user, password) exactly into the > connection dialogue of SQLyog. The error message above was returned when I > tried to connect although I can connect Dreamweaver to the database without > problem even though the IPAdress is not listed as part of the username. With MySQL, a user is given permission to connect with a specific username and password _and_ from a specific host. When you run the script from Dreamweaver, is it on the same machine as SQLYog? You probably just need to modify your MySQL user to have permission to connect from "IPAddress". ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help importing a text file via phpmyadmin
Hi all - I'm trying to use phpmyadmin's "Insert data from a textfile into table" function. I've done this before many times, exactly the same way, and never had a problem. But today I'm getting: #1148 - The used command is not allowed with this MySQL version Is there a common cause for this error? I find little helpful info in the phpmyadmin documentation. Any ideas appreciated... :) - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Connecting to Databases
I know that this message is more related to MySQL than PHP but I don't know of a good MySQL board. This board is VERY active and useful. As most of us, I use a variety of programs to produce my HTML/PHP/MySQL. I have run into this problem several times on a variety of programs so thought I'd post and see if anyone had the answer. I have found that it is not uncommon when trying to connect to a database on an Apache server to get a return similar to "Access denied for user: [EMAIL PROTECTED]". I just ran into this problem because I wanted to use SQLyog to manipulate a table that already exists on one of my servers. I went to the "Connections" document that Dreamweaver creates and copied all of the connection info (host, db, user, password) exactly into the connection dialogue of SQLyog. The error message above was returned when I tried to connect although I can connect Dreamweaver to the database without problem even though the IPAdress is not listed as part of the username. What's up? -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Executing PHP shell script in PHP
The shell script is in PHP as well? Presumably, you could either access it as an include or execute it using exec. -- jon --- jon roig web developer email: [EMAIL PROTECTED] phone: 888.230.7557 -Original Message- From: Brent Clark [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 1:32 AM To: [EMAIL PROTECTED] Subject: [PHP] Executing PHP shell script in PHP Hi Does anyone know of how to execute a php shell script in a php file. Kind Regards Brent Clark --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] execute script via email?
Sure... You can write a small php script that uses PHP's imap or pop functions to monitor any email address. (Check out http://us3.php.net/manual/en/ref.imap.php for details.) Once that's written, just schedule it as a task using the windows scheduler or cron in unix/linux. -- jon --- jon roig web developer email: [EMAIL PROTECTED] phone: 888.230.7557 -Original Message- From: BigMark [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 06, 2004 6:27 AM To: [EMAIL PROTECTED] Subject: [PHP] execute script via email? Is there a way for me to email this script so it executes the close of a round instead of doing it from the website administration . (it is a football tipping script) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Limiting an array to unique values
I guess I deserved that one... alex hogan > -Original Message- > From: John W. Holmes [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 06, 2004 9:40 AM > To: Alex Hogan; PHP General list > Subject: Re: [PHP] Limiting an array to unique values > > From: "Alex Hogan" <[EMAIL PROTECTED]> > > I have an array that I am using as a parameter for a query in a where > > clause. > > > > The array has values that are like this. > > > > Item 1 > > Item 2 > > Item 3 > > Item 1 > > Item 3 > > Item 3 > > Item 1 > > > > What I need to have is unique values only. > > > > Item 1 > > Item 2 > > Item 3 > > > > How can I sort out the redundant values in that array? > > array_unique(). Imagine that. :) > > ---John Holmes... ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
Re: [PHP] Limiting an array to unique values
From: "Alex Hogan" <[EMAIL PROTECTED]> > I have an array that I am using as a parameter for a query in a where > clause. > > The array has values that are like this. > > Item 1 > Item 2 > Item 3 > Item 1 > Item 3 > Item 3 > Item 1 > > What I need to have is unique values only. > > Item 1 > Item 2 > Item 3 > > How can I sort out the redundant values in that array? array_unique(). Imagine that. :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Limiting an array to unique values
Thanks... Exactly what I needed. alex hogan > -Original Message- > From: joel boonstra [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 06, 2004 9:30 AM > To: PHP General list > Subject: Re: [PHP] Limiting an array to unique values > > On Tue, Apr 06, 2004 at 09:27:31AM -0500, Alex Hogan wrote: > > Hi All, > > > > I have an array that I am using as a parameter for a query in a where > > clause. > > > > The array has values that are like this. > > > > Item 1 > > Item 2 > > Item 3 > > Item 1 > > Item 3 > > Item 3 > > Item 1 > > > > What I need to have is unique values only. > > > > Item 1 > > Item 2 > > Item 3 > > > > How can I sort out the redundant values in that array? > > PHP's 'array_unique' function should help: > > http://php.net/array_unique > > -- > [ joel boonstra | gospelcom.net ] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
Re: [PHP] Limiting an array to unique values
On Tue, Apr 06, 2004 at 09:27:31AM -0500, Alex Hogan wrote: > Hi All, > > I have an array that I am using as a parameter for a query in a where > clause. > > The array has values that are like this. > > Item 1 > Item 2 > Item 3 > Item 1 > Item 3 > Item 3 > Item 1 > > What I need to have is unique values only. > > Item 1 > Item 2 > Item 3 > > How can I sort out the redundant values in that array? PHP's 'array_unique' function should help: http://php.net/array_unique -- [ joel boonstra | gospelcom.net ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Limiting an array to unique values
Hi All, I have an array that I am using as a parameter for a query in a where clause. The array has values that are like this. Item 1 Item 2 Item 3 Item 1 Item 3 Item 3 Item 1 What I need to have is unique values only. Item 1 Item 2 Item 3 How can I sort out the redundant values in that array? alex hogan ** The contents of this e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. The views stated herein do not necessarily represent the view of the company. If you are not the intended recipient of this e-mail you may not copy, forward, disclose, or otherwise use it or any part of it in any form whatsoever. If you have received this e-mail in error please e-mail the sender. **
Re: [PHP] Re: Reusing MySQL Connections - Can it be done?
This is weird, it works for me, I use Oracle though. The real application uses ADODB but it should work with the PHP native resources. I do this: 1. Define a singleton function, for example: getDBConnection() function &getDBConnection() { $db =& GLOBALS['APP_DB_CONNECTION']; if (!is_object($db)) { // Here we make the connection $db =& WHAT_EVER_CONNECTION_FUNCTION_YOU_WANT(); // At this point $db is a valid connection object GLOBALS['APP_DB_CONNECTION'] =& $db; } return $db } 2. From every function that connects to the database you just call the singleton: function &getActiveCustomers() { $db =& getDBConnection(); $sql = "SELECT ."; // Here you execute the sql like you normally would return $rs; // This is the resultset } Note that in step 1 you can use the resource variable returned by native PHP functions, in my case I use ADODB so I store the object which isn't that different because inside that object resides the PHP resource. So you can change the line 'if (!is_object($db))' for 'if(!is_resource($db))'. If you look the singleton carefully you'll see that the connection process is executed just the first time. For example, if a user requests executes 10 queries to the database, the connection will be actually made in the first call to the singleton. The successive calls will return the connection stored in the global scope. I can tell for sure that this approach works very well. If it doesn't for you, there might be a more fundamental problem in your configuration or in your code. Regards, -William El lun, 05-04-2004 a las 17:18, Monty escribió: > > A define is pretty much for strings only, not objects or resources. Try > > using $GLOBALS['_CONNECT_DB'] instead. > > I tried this, but, same results. If I store the Resource ID from a > mysql_pconnect() in $GLOBALS['_CONNECT_DB'] and then call... > > mysql_query($query, $GLOBALS['_CONNECT_DB']); > > PHP gives me the following error: > > 4 is not a valid MySQL-Link resource > > When I look into this var, here's what I see: > > Resource id #4 > > This is the same that was stored in the constant var, so, it appears that > whether it's a Global or Constant isn't making a difference. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] function CreateDate i made doesnt work?
Hello Red, Tuesday, April 6, 2004, 3:40:07 PM, you wrote: RW> I've seen this type of creating a timestamp quite often now and was even so RW> often shaking my head about it. Guess i've seen it somewhere in the PHP RW> Documentation's user contributed notes on day. Just google for the term and RW> you will find many hits like this: Yeah, I reckon times must be one of the most misunderstood (or just misused) elements of PHP. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function CreateDate i made doesnt work?
I've seen this type of creating a timestamp quite often now and was even so often shaking my head about it. Guess i've seen it somewhere in the PHP Documentation's user contributed notes on day. Just google for the term and you will find many hits like this: http://www.mail-archive.com/[EMAIL PROTECTED]/msg136608.html -- red PS: Guess some ppl have never heard about mktime :-) [...] > Your function doesn't seem to make any sense to be honest - you're > passing in the $day value to strtotime (a function that ideally > requires English language date formats) and then asking it to > calculate a timestamp based off the offset of the month and year. > > So ultimately you're feeding strtotime = 10, timestamp > > which means it's going to try and calculate the difference between 10 > and the given timestamp (which is going to be a lot!) > > What exactly is this function *supposed* to do? [...] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] For your reference, how to validate dynamic form fields.
Just spent far too long trying to figure out how to do this, so I thought I'd pass it on to you great guys, in case you need it for the future. I used PHP to create multiple form rows, each one numbered: "); } ?> This creates a number of rows, each with a unique form value name. The problem I had was that I needed to validate those rows, to make sure they were numeric... Here's what I did. Have fun! User ID Entry Example function isNumeric(strString) { var strValidChars = "0123456789-."; var strChar; var blnResult = true; if (strString.length == 0) return false; // test strString consists of valid characters listed above for (i = 0; i < strString.length && blnResult == true; i++) { strChar = strString.charAt(i); if (strValidChars.indexOf(strChar) == -1) { blnResult = false; } } return blnResult; } function validateForm() { for (var i = 1; i <= = $numRows ?>; i++) { var fieldName = 'UserId' + i; var fieldValue = document.forms.userForm.elements[fieldName].value; if (fieldValue != '' && ! isNumeric(fieldValue)) { alert("Field value in row " + i + " (" + fieldValue + ") is not numeric."); return false; } } return true; } "); } ?> == This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. ==
[PHP] GD installation
im having a problem installing the GD library OS - Windows XP Pro PHP - 4.3.5 i tried in the PHP.INI get the ";" of the line with the GD extension and im getting an error that the file not found "./php_gd2.dll" i tried to copy the file to main PHP folder and WINDOWS\SYSTEM32 nothing seems to be working the i tried to change the extension path to th main php folder and it still didnt work although the file is there -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php + lynx + grep
Functions like system, exec etc aren't supported by most ISP ( at least over here in germany ). But you might give file_get_contents(); file(); ... a look as they can read the output of HTTP request which might be easier: $var = file ( 'http://weather.noaa.gov/weather/current/KTOL.html' ); foreach ( $var AS $line ) { if ( preg_match( "41-35-19N" , $var ) ) ... etc pp } good luck, red [...] > lynx --source http://weather.noaa.gov/weather/current/KTOL.html > > |grep -v '41-35-19N' |grep TOL | head -n 1 > > I need to get the output of the above command for a web site I'm > working on. I've tried exec(), system() and neither seems to > work. > > It's output should be something like this(it changes hourly): > KTOL 031452Z 28013KT > 10SM CLR 10/01 A2977 RMK AO2 SLP086 T0106 58015 > [...] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function CreateDate i made doesnt work?
by the way change ur if alittle.. change the && to || "John W. Holmes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > From: "Andy B" <[EMAIL PROTECTED]> > > > i have the function i made: > > function CreateDate($day, $month, $year) { > > if(!empty($day) && !empty($month) && !empty($year)){ > > //convert $day, $month, and $year into a valid timestamp > > > $time= strtotime($day, mktime(0,0,0,$month,1,$year)); > > $time=date("YmdHis", $time); > > Replace the above two lines with > > $time = date('YmdHis', mktime(0,0,0,$month,$day,$year); > > ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] execute script via email?
Is there a way for me to email this script so it executes the close of a round instead of doing it from the website administration . (it is a football tipping script) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function CreateDate i made doesnt work?
Hello Andy, Tuesday, April 6, 2004, 2:18:45 PM, you wrote: AB> i have the function i made: AB> function CreateDate($day, $month, $year) { AB> if(!empty($day) && !empty($month) && !empty($year)){ AB> //convert $day, $month, and $year into a valid timestamp AB> $time= strtotime($day, mktime(0,0,0,$month,1,$year)); AB> $time=date("YmdHis", $time); AB> return $time; } AB> else { AB> return false; }} ?>> AB> my output ends up being Monday January 18, 2038 no matter what i AB> try to use in the forms. Your function doesn't seem to make any sense to be honest - you're passing in the $day value to strtotime (a function that ideally requires English language date formats) and then asking it to calculate a timestamp based off the offset of the month and year. So ultimately you're feeding strtotime = 10, timestamp which means it's going to try and calculate the difference between 10 and the given timestamp (which is going to be a lot!) What exactly is this function *supposed* to do? -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function CreateDate i made doesnt work?
From: "Andy B" <[EMAIL PROTECTED]> > i have the function i made: > function CreateDate($day, $month, $year) { > if(!empty($day) && !empty($month) && !empty($year)){ > //convert $day, $month, and $year into a valid timestamp > $time= strtotime($day, mktime(0,0,0,$month,1,$year)); > $time=date("YmdHis", $time); Replace the above two lines with $time = date('YmdHis', mktime(0,0,0,$month,$day,$year); ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function CreateDate i made doesnt work?
i have the function i made: function CreateDate($day, $month, $year) { if(!empty($day) && !empty($month) && !empty($year)){ //convert $day, $month, and $year into a valid timestamp $time= strtotime($day, mktime(0,0,0,$month,1,$year)); $time=date("YmdHis", $time); return $time; } else { return false; }} ?> now when i try to use itlike this: //$startingday $startingmonth and $startingyear are all form //variables $_SESSION['add']['start_date']=CreateDate($startingday, $startingmonth, $startingyear); //now echo the date: assuming lets say we used 10/5/2004 //in the original form: Start Date: my output ends up being Monday January 18, 2038 no matter what i try to use in the forms.
Re: [PHP] php + lynx + grep
Brian L. Ollom wrote: lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v '41-35-19N' |grep TOL | head -n 1 I need to get the output of the above command for a web site I'm working on. I've tried exec(), system() and neither seems to work. You know, it might be easier if you use the new NOAA XML weather feeds [ http://www.nws.noaa.gov/alerts/ ]. Also, did you know that you can FTP into their public server and download observation reports? They are cycled every hour, and are available via anonymous FTP from weather.noaa.gov/data/observations/metar/cycles directory. Or, you can use snoopy and submit your ICAO code to http://www.noaa.gov/weather/metar.shtml and have snoopy return the plain text version of the file. You should get your METAR report there. (yes, I am an avid flight simulator) Sorry I didn't answer your original question. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php + lynx + grep
Brian L. Ollom wrote: lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v '41-35-19N' |grep TOL | head -n 1 I need to get the output of the above command for a web site I'm working on. I've tried exec(), system() and neither seems to work. It's output should be something like this(it changes hourly): KTOL 061152Z 23004KT 10SM CLR 00/M07 A3007 RMK AO2 SLP187 T1072 10017 21033 53005 Help! | Brian Ollom | | | NiteHawke.Com| http://www.nitehawke.com/| | An Authorized Firefly Dealer | email [EMAIL PROTECTED] | Try $output = `lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v '41-35-19N' |grep TOL | head -n 1` Those are backticks, not single quotes surrounding the command. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php + lynx + grep
lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v '41-35-19N' |grep TOL | head -n 1 I need to get the output of the above command for a web site I'm working on. I've tried exec(), system() and neither seems to work. It's output should be something like this(it changes hourly): KTOL 031452Z 28013KT 10SM CLR 10/01 A2977 RMK AO2 SLP086 T0106 58015 Help! | Brian Ollom | | | NiteHawke.Com| http://www.nitehawke.com/| | An Authorized Firefly Dealer | email [EMAIL PROTECTED] | ForPilot's - Software for your piloting needs! http://www.forpilots.com/ Great Deals on Great Pilot Supplies! http://www.acespilotshop.com/cgi-bin/ares.cgi?ID=240400532 Want deals on other great stuff? Click here! http://www.dollardays.com/index.asp?affilid=385 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php + lynx + grep
> lynx --source > http://weather.noaa.gov/weather/current/KTOL.html | grep -v > '41-35-19N' |grep TOL | head -n 1 > > I need to get the output of the above command for a web site > I'm working on. I've tried exec(), system() and neither seems > to work. > > It's output should be something like this(it changes hourly): > KTOL 031452Z 28013KT > 10SM CLR 10/01 A2977 RMK AO2 SLP086 T0106 58015 It works fine on the command line, but won't show any info on the site. | Brian Ollom | | | NiteHawke.Com| http://www.nitehawke.com/| | An Authorized Firefly Dealer | email [EMAIL PROTECTED] | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php + lynx + grep
lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v '41-35-19N' |grep TOL | head -n 1 I need to get the output of the above command for a web site I'm working on. I've tried exec(), system() and neither seems to work. It's output should be something like this(it changes hourly): KTOL 061152Z 23004KT 10SM CLR 00/M07 A3007 RMK AO2 SLP187 T1072 10017 21033 53005 Help! | Brian Ollom | | | NiteHawke.Com| http://www.nitehawke.com/| | An Authorized Firefly Dealer | email [EMAIL PROTECTED] | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Max Filesize for PHP copy
I posted this in the Netware PHP newsgroup, but have not gotten a response. Hopefully I will get something here. I was using a script to copy a file from one location to another. It was working great (but was only testing with small files under 1MB) and then when I tried uploading a file that was a little over 4MB the server abended with the message "Cache memory allocator out of available memory". I looked in the PHP.ini file and changed the max filesize to 5MB and tried to copy the same file. It worked, but I received the same message, but it didn't abend. I don't think that this is normal and would appreciate any suggestions as to a better method or an explanation as to what may be causing this. Netware 6, PHP 4.2.4 (newest version for Netware), Apache 2.0.48 Thanks in advance, Ashley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] assigning NULL to a variable
Andy B wrote: how would you assign NULL to a variable if its original value is ""? otherwise leave it with its value... if($var === '') $var = NULL; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php + lynx + grep
lynx --source http://weather.noaa.gov/weather/current/KTOL.html |grep -v '41-35-19N' |grep TOL | head -n 1 I need to get the output of the above command for a web site I'm working on. I've tried exec(), system() and neither seems to work. It's output should be something like this(it changes hourly): KTOL 031452Z 28013KT 10SM CLR 10/01 A2977 RMK AO2 SLP086 T0106 58015 Help! | Brian Ollom | | | NiteHawke.Com| http://www.nitehawke.com/| | An Authorized Firefly Dealer | email [EMAIL PROTECTED] | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP has a bug...?
From: "Stephen Craton" <[EMAIL PROTECTED]> > I was making a parabola grapher and I was testing out some values. Part of > the script is to take the variable b and multiply it was negative one, then > multiply by 2 times a. I entered a test value where a equals 1, b equals 0, > and c equals 0. The result told me that -1 times 0 is -0. > > Here's the code I'm using: > > $x = (-1 * $b) / (2 * $a); What version of PHP and what OS? I don't see this replicated on 4.3.3/Win2k. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to...
Vicente Werner wrote: El Martes, 6 de Abril de 2004 10:13, Burhan Khalid escribió: You cannot close the window from within PHP. You have to use client side scripting (Javascript). I've already tried sending : window.close() Just after echoing the file, but with 0 success. Try "onLoad"-event of BODY-tag, i.e. send such HTML to browser: Hope that helps. -- Pavel a.k.a. Papi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to...
El Martes, 6 de Abril de 2004 10:13, Burhan Khalid escribió: > You cannot close the window from within PHP. You have to use client side > scripting (Javascript). I've already tried sending : window.close() Just after echoing the file, but with 0 success. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to...
Vicente Werner wrote: I've already a php function that outputs a file from a folder outside the www path to a page, but I can't find a way to do this and then close the window where it was outed. Any 1 can point me in the right direction? You cannot close the window from within PHP. You have to use client side scripting (Javascript). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Executing PHP shell script in PHP
Brent Clark wrote: Hi Does anyone know of how to execute a php shell script in a php file. Kind Regards Brent Clark assuming *nix php myscript.php or stick at the beginning of the file #!/bin/php and then run ./myscript.php hope it helps pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] register_globals
Hello, Sunday, April 4, 2004, 1:17:53 AM, you wrote: n> Why i cann't change register_globals value with ini_set()? Because it's a system level configuration value - you cannot change it in your scripts. register_globals supports PHP_INI_PERDIR and PHP_INI_SYSTEM - meaning it can only be changed in the php.ini file or an htaccess file. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] register_globals
Hello. In my php.ini file register_globals has value Off. I have script Script echo 1. But if i create .htaccess in this dir which contains string php_value register_globals 0, my script return 0. Why i cann't change register_globals value with ini_set()? bye, mailto:[EMAIL PROTECTED], 4:11, 04.04.2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Executing PHP shell script in PHP
Hi Does anyone know of how to execute a php shell script in a php file. Kind Regards Brent Clark
Re: [PHP] How to Request?
--- Labunski <[EMAIL PROTECTED]> wrote: > But for example I have a link "index.php?fd=car&c=green".. > How to Request more then one variable if I want to get something like > this: > > if(isset($_REQUEST['fd','c'])){ // incorrect form. How to write this > correctly? > $vehicle = ($_REQUEST['fd']); > $color = ($_REQUEST['c']); > } You answer your own question immediately after you ask it. Wrong: $_REQUEST['fd','c'] Right: $_REQUEST['fd'] $_REQUEST['c'] Hope that helps. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming Fall 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to Request?
Labunski wrote: ... But for example I have a link "index.php?fd=car&c=green".. How to Request more then one variable if I want to get something like this: if(isset($_REQUEST['fd','c'])){ // incorrect form. How to write this correctly? $vehicle = ($_REQUEST['fd']); $color = ($_REQUEST['c']); } if ( isset( $_REQUEST['fd'] ) && isset( $_REQUEST['c'] )) { $vehicle = $_REQUEST['fd']; $color = $_REQUEST['c']; } Hope that helps. -- Pavel a.k.a. Papi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Reusing MySQL Connections - Can it be done?
[...] > > I tried this, but, same results. If I store the Resource ID from a > > mysql_pconnect() in $GLOBALS['_CONNECT_DB'] and then call... > > > > mysql_query($query, $GLOBALS['_CONNECT_DB']); [...] > > How are you setting the global? > [...] I guess he said he is using $GLOBALS['_CONNECT_DB'] :-p -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php