[PHP] Array_keys problem
Good afternoon. I'm building a class and am having a bunch of trouble with the PHP array_keys function. I keep getting these errors: Warning: First argument to array_keys() should be an array in D:\Htf.php on line 33 Warning: Wrong datatype for second argument in call to in_array in D:\Htf.php on line 35 $this-ma_arguments IS an array, so why is the error popping up? I did check syntax but am buffaloe'd by this one. Just so no one gets confused, I use a form of Hungarian (p=parameter, m=module, a=array, s=string) /** * @var assoc array of passed arguments */ var $ma_arguments; /** * Constructor */ function bmc_html_tag_functions() { $this-init(); } function init() { $this-ma_arguments = array(); } /** * Checks if the given key or index exists in the array (PHP 4.1.0) * * @param $ps_keyKey to check against * @param $pa_search Array of elements * @return true if key is in array * @access private */ function key_exists($ps_key) { if ( in_array($ps_key, array_keys($this-ma_arguments)) ) { return true; } else { return false; } } Robin 'Sparky' Kopetzky Black Mesa Computers/Internet Service Grants, NM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Local define?
Greetings!! If you define a constant within a function, is it local or global? Example: function foo() { define('BAR', 0); } Robin Kopetzky Black Mesa Computers/Internet Services, LLC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Credit card/Debit card validation
Does anyone know of a PHP routine to validate Credit/Debit cards? I've seen some convoluted Javascript scripts but want a PHP version so validation can be done done server-side. Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
Re: [PHP] Credit card/Debit card validation
Thank you for responding. I found just what the doctor ordered - ECHO php. Sparky - Original Message - From: Ralph Guzman [EMAIL PROTECTED] To: 'Sparky Kopetzky' [EMAIL PROTECTED]; 'PHP General' [EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 16:02 Subject: RE: [PHP] Credit card/Debit card validation Go to http://www.phpclasses.org and look for CreditCard Class under Validation, else look for one at http://www.hotscripts.com -Original Message- -Original Message- From: Sparky Kopetzky [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 09, 2003 2:33 PM To: PHP General Subject: [PHP] Credit card/Debit card validation Does anyone know of a PHP routine to validate Credit/Debit cards? I've seen some convoluted Javascript scripts but want a PHP version so validation can be done done server-side. Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] print vs heredoc
Hi, again!! I'm looking for opinions as to which is better/faster, print or heredoc. print makes the code layout look nice and eazy to debug, where heredoc IS faster but makes the code look like a nightmare with everything jammed against the left side of the code. I'm pretty picky about what looks good and heredoc is a nightmare of horrors... Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] URL problem
Hi! I'm passing this url to the script: http://www.fttta.com/auction.php and intercepting it with: if ($_SERVER['QUERY_STRING'] = ) { disp_cat(); } However, nothing is happening. phpinfo show $_SERVER['QUERY_STRING'] as 'no value', so this should work. Anyone know why this doesn't work?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] print vs. heredoc
Hi, again!! I'm looking for opinions as to which is better, print or heredoc. print makes the code layout look nice and eazy to debug, where heredoc IS faster but makes the code look like a nightmare and I'm pretty picky about what looks good. Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] Nested mysql_query()'s
Hi! I've got two nested queries where one looks up data based on values returned from the first. $lot_query = SELECT * FROM LOT WHERE lot_category_id= . $lot_category . AND lot_close_time . time(); $lot_result = mysql_query($lot_query, $CONNECT_ID); if ($lot_result) { while ($row = mysql_fetch_array($lot_result)) { blah-blah-blah... $bid_query = select * from bids where bid_lot_id= . $lot_id . order by bid_amount; $bid_result = mysql_query($bid_query, $CONNECT_ID); $bid_count = mysql_num_rows($bid_result); blah-blah-blah... I get this error message: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource from the second query. Do I need a second $CONNECT_ID for a second link to mysql_query #2?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
Re: [PHP] Re: Nested mysql_query()'s
Problem was a fat-finger - meant 'bid' not 'bids'... Doh!!! Sparky - Thanks again. - Original Message - From: Shena Delian O'Brien [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 16:01 Subject: [PHP] Re: Nested mysql_query()'s Sparky Kopetzky wrote: Hi! I've got two nested queries where one looks up data based on values returned from the first. $lot_query = SELECT * FROM LOT WHERE lot_category_id= . $lot_category . AND lot_close_time . time(); $lot_result = mysql_query($lot_query, $CONNECT_ID); if ($lot_result) { while ($row = mysql_fetch_array($lot_result)) { blah-blah-blah... $bid_query = select * from bids where bid_lot_id= . $lot_id . order by bid_amount; $bid_result = mysql_query($bid_query, $CONNECT_ID); $bid_count = mysql_num_rows($bid_result); blah-blah-blah... I get this error message: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource from the second query. Do I need a second $CONNECT_ID for a second link to mysql_query #2?? No... you don't even need to use a connect ID. It should work fine if you just use mysql_query($bid_query) The problem is likely that the query is failing for some reason and thus not generating a proper result. Do an echo mysql_error($CONNECT_ID) to figure out if there's an error in your syntax, etc. -- 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] Email troubles
I'm getting this error while sending email with mail(): Warning: mail(): SMTP server response: 550 5.7.1 [EMAIL PROTECTED]... Relaying denied in (path to my program) How do I turn relaying on?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] ARGHHH!!! POST variable problem
I can click links and they work but when I enter data in a form and try to send it to the next php script to process the data, nothing happens. Is there a simple way I can see what is returning from the browser to see if what I expect is actually getting there?? I think $_SERVER['QUERY_STRING'] should do it but I get nothing with that one... Any help is GREATLY appreciated. Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
Re: [PHP] ARGHHH!!! POST variable problem
OK, I see that I have to use $_POST['user_name'] or can I just use the variable passed back $user_name which would be a heck of a lot simpler?? Sparky - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 29, 2003 14:56 Subject: Re: [PHP] ARGHHH!!! POST variable problem On Monday 30 June 2003 04:38, Sparky Kopetzky wrote: I can click links and they work but when I enter data in a form and try to send it to the next php script to process the data, nothing happens. Is there a simple way I can see what is returning from the browser to see if what I expect is actually getting there?? I think $_SERVER['QUERY_STRING'] should do it but I get nothing with that one... Stick in phpinfo() at the top of your script. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* A real person has two reasons for doing anything ... a good reason and the real reason. */ -- 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] ARGHHH!!! POST variable problem
Jason: THANK YOU!!! phpinfo is helping out big time. I never thought of using it for debugging but I finally got it working. Have a cold brewski on me for the save!! Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net - Original Message - From: Jason Wong [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, June 29, 2003 14:56 Subject: Re: [PHP] ARGHHH!!! POST variable problem On Monday 30 June 2003 04:38, Sparky Kopetzky wrote: I can click links and they work but when I enter data in a form and try to send it to the next php script to process the data, nothing happens. Is there a simple way I can see what is returning from the browser to see if what I expect is actually getting there?? I think $_SERVER['QUERY_STRING'] should do it but I get nothing with that one... Stick in phpinfo() at the top of your script. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* A real person has two reasons for doing anything ... a good reason and the real reason. */ -- 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] Sorting problem
Yes, I need the key to remain associated with the value as the key links the value to a directory. Can't have files going into the wrong places. So if asort does the job, I'll try that and see if the code breaks or not. Sparky - Original Message - From: Daryl Meese [EMAIL PROTECTED] To: David Otton [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Friday, June 27, 2003 19:17 Subject: RE: [PHP] Sorting problem David, See what you mean. I guess we need some clarification on the original question? Thanks -Original Message- From: David Otton [mailto:[EMAIL PROTECTED] Sent: Friday, June 27, 2003 8:09 PM To: Daryl Meese Cc: PHP General Subject: Re: [PHP] Sorting problem On Fri, 27 Jun 2003 19:45:27 -0500, you wrote: ckeck out asort and arsort I'm looking... My understanding was that the original poster wanted to sort an array by value|key (sort an array and have the key 'follow' the value) eg 'pear' = 'green', 'orange'= 'orange', 'banana'= 'yellow', 'tangerine' = 'orange', 'apple' = 'green' becomes 'apple' = 'green', 'pear' = 'green', 'orange'= 'orange', 'tangerine' = 'orange', 'banana'= 'yellow' However, asort() produces (here, anyway) : 'apple' = 'green', 'pear' = 'green', 'tangerine' = 'orange', 'orange'= 'orange', 'banana'= 'yellow' It's not explicitly stated in the manual, but it seems that when the values are the same, the order of the keys associated with them is not defined. Even if it happened to produce correct output on one system, I wouldn't trust it in production code. Of course, I could have mis-read the original question... I can see how have the key 'follow' the value could be read as have the key maintain it's association with the value. -- 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/Time problem
Well, I got the time displaying sort of right but have a length problem. See, using %T doesn't work in date() but %Z does but it returns a very long string 'Mountain Daylight Time' when all I want is 'MDT'. Is there a way around this problem other than having to edit the string date() returns?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] OOPS!!! [PHP] Date/Time problem
Opps! I meant strftime() as I have to pass timestamp from a file. Sparky - Original Message - From: Adam Voigt [EMAIL PROTECTED] To: Sparky Kopetzky [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Friday, June 27, 2003 11:07 Subject: Re: [PHP] Date/Time problem echo(date('T')); Works fine for me. On Fri, 2003-06-27 at 13:03, Sparky Kopetzky wrote: Well, I got the time displaying sort of right but have a length problem. See, using %T doesn't work in date() but %Z does but it returns a very long string 'Mountain Daylight Time' when all I want is 'MDT'. Is there a way around this problem other than having to edit the string date() returns?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_POST problem
Hi, it's me again... I've got my script kinda running but am unable to retrieve any values with $_POST. I turned on register_globals in the php.ini and am using this url: http://www.fttta.com/auction.php?action=reg. (Sorry, it's local for now...) I'm using this kind of line to check for values: elseif ('reg' == $_POST['action']) { do something; } What am I doing wrong here??? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] Sorting problem
I need to sort an array and have the key 'follow' the value. I know I could splice a string, sort it, then split it again but what a pain. Is there a simpler way? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookoo clock
I am in New Mexico and my php system is telling via date() that my timezone is BST (British standard time) and not MST (Mountain Standard Time). Any clue as to why it's doing this?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] HTTP_HOST question
Is $_SERVER['HTTP_HOST'] the same as $_ENV['REMOTE_HOST'] ?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] One more time - HTTP_HOST
Is $_SERVER['HTTP_HOST'] the same as CGI $_ENV['REMOTE_HOST'] ?? Please, I need to know... Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] Reg Exp help needed
I'm translating (hacking) code from Perl to PHP and have two reg exp expressions I can't figure out what they do. 1st: $goodbadnum =~ tr/0-9//cd; I think this one removes any chars that are not numbers. 2nd: $goodbadnum =~ tr/0-9/x/; I think this one replaces and numbers with an 'x'. Right, wrong?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] Text files vs other types
If there an ability like Perl to determine if a file is a text file (-T) or any other type?? Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] Chomp, Chomp, Chomp
Does anyone have a piece of code that emulates a Perl 'Chomp' function? I need one. Thanks in advance!! Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
Re: [PHP] Chomp, Chomp, Chomp
I looked at the documentation on rtrim. It trims ALL whitespace characters from the end, not just the '\n'. I need only the '\n' trimmed. Sparky - Original Message - From: Lars Torben Wilson [EMAIL PROTECTED] To: Sparky Kopetzky [EMAIL PROTECTED] Cc: PHP General [EMAIL PROTECTED] Sent: Friday, June 20, 2003 16:47 Subject: Re: [PHP] Chomp, Chomp, Chomp On Fri, 2003-06-20 at 15:37, Sparky Kopetzky wrote: Does anyone have a piece of code that emulates a Perl 'Chomp' function? I need one. Thanks in advance!! Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net This should do it for you: http://www.php.net/rtrim Good luck! Torben -- Torben Wilson [EMAIL PROTECTED]+1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com - Boycott Starbucks! http://www.haidabuckscafe.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookies- peanut butter or chocolate??
Yes, this question is about PHP cookies. Two questions: 1. How do you setup a cookie that will not expire?? 2. How do you put 2 items that you want to save in the cookie and retrieve?? Examples in the PHP manual only show how to work with a single value. Thanks! Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] Url problem
OK. I'm suffering from brain gas... I'm trying this, it doesn't work and I can't figure out why: include_once $SYSTEM_URL . /classes/category.php; where $SYSTEM_URL = http://www.example.com; is the url to the web site. and I get this error: Fatal error: Cannot instantiate non-existent class: category in c:\program files\apache group\apache\htdocs\index.php on line 19 So, obviously, it's not pointing to the right place. I can load the opening page from the url, so I know Apache is trying to load from the htdocs folder. Help... :o(( Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] Questions, questions, questions...
Ok - let the war begin... Question: Why doesn't the PHP community support using an Hungarian style of programming if it prevents errors?? I've gotten too darn many times now by a type mismatch using what the 'Bible' of PHP programming style recommends - PHP Coding Standard by Fredrik Kristiansen. I'm sorry - $MonkeyBrains doesn't tell me anything about what type is or what type it holds. $intMonkeyBrains DOES and I can tell instantly that $intValue shouldn't hold $strValue without a type coersion. (I know PHP will blindly stick the string in and replace the integer...) Question: Is there a better way in classes to access/modify var's other than get_var, put_var functions? Works great for me and I know whether I'm saving a variable or accessing it. Sure, I'd like to be able to use a VB style Set/Get property but who wouldn't?? Feel free to email me directly if this will generate a firestorm in the maillist. Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
[PHP] Heredoc question
Can one use ?php ? within the heredoc syntax or is there another way?? I'm trying to dynamically generate email from generic text but with obvious additions, like this: $message = my_message Name: ?php echo $lot-get_name(); ? Lot php echo $lot-get_id(); ? has been approved. Here is the link to the lot: my_message; Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net
Re: [PHP] Heredoc question
That's fine for that but I have several places that use if's and else's... Sparky - Original Message - From: Jennifer Goodie [EMAIL PROTECTED] To: Sparky Kopetzky [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 16:47 Subject: RE: [PHP] Heredoc question Can one use ?php ? within the heredoc syntax or is there another way?? I'm trying to dynamically generate email from generic text but with obvious additions, like this: http://us4.php.net/types.string says that heredoc acts just like double quoted, which would mean it expands variables, so I would try just throwing them in there like this... $message = my_message Name: {$lot-get_name()} Lot {$lot-get_id()} has been approved. Here is the link to the lot: my_message; There's an example of almost exactly like this on that page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Heredoc question
I did figure a way around heredoc last night. Here's the solution if anyone can use it: ?php $truth = true; $head = brain bucket; $message = TEST This is a test of the emergency broadcasting system. If this had been an actual emergency, you would have been instructed to TEST; if ($truth) { $message .= place your {$head} between your legs and\n; } $message .= TEST read from the chapters of Matthew, Mark, Luke and DUCK!! TEST; print $message; ? $message is actually works in heredoc just like any other string. Didn't expect that. Hope this helps someone else who is trying the same thing as I am. Robin E. Kopetzky Black Mesa Computers/Internet Services www.blackmesa-isp.net - Original Message - From: Jennifer Goodie [EMAIL PROTECTED] To: Sparky Kopetzky [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED] Sent: Thursday, June 05, 2003 16:47 Subject: RE: [PHP] Heredoc question Can one use ?php ? within the heredoc syntax or is there another way?? I'm trying to dynamically generate email from generic text but with obvious additions, like this: http://us4.php.net/types.string says that heredoc acts just like double quoted, which would mean it expands variables, so I would try just throwing them in there like this... $message = my_message Name: {$lot-get_name()} Lot {$lot-get_id()} has been approved. Here is the link to the lot: my_message; There's an example of almost exactly like this on that page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Prefix question
Does anyone know of a prefix convention used for PHP? What I'm talking about is using a type of Hungarian notation for PHP variables. I know they use 'g', 'm', and 'r' for global, method and reference variables but for other variable types. I get confused once and a while, while I am coding and want to make things clearer than mud... Just a thought... Robin Kopetzky Black Mesa Computers/Internet Services