Re: [PHP] Help with an error...

2008-07-24 Thread Ted Wood
Micah, Please provide an example of what your response was referring to in the original message. And it is possible to have commands in the middle of a string by using concatenation. $str = My name is .strtoupper($name).', but you can call me Sam.; ~Ted On 24-Jul-08, at

Re: [PHP] Reference or copy?

2008-07-23 Thread Ted Wood
The general rules of thumb are -- don't use references unless you actually *want* a reference. And don't use references for performance reasons. Under PHP 4, it's generally been recommended to use a reference operator when creating objects. $obj = new Object(); PHP uses

Re: [PHP] Reference or copy?

2008-07-23 Thread Ted Wood
On 23-Jul-08, at 1:19 AM, Ted Wood wrote: So PHP waits until a copy is actually needed before it makes one. Explicitly making copies incurs overhead because of the concept of reference counting. So again, don't use references for performance reasons. That should've been: Explicitly

Re: [PHP] Reference or copy?

2008-07-23 Thread Ted Wood
In both PHP 4 and PHP 5, this would be an internal reference: $a = $b; until $b is changed. The only exception is with Object handling under PHP 4, which had flawed reference handling. So, the rule remains -- don't use references for performance reasons -- use them if you need

Re: [PHP] syntax error

2008-07-21 Thread Ted Wood
Not a syntax error. It's not successfully connecting to the database. Check your settings. ~Ted On 21-Jul-08, at 4:24 AM, Ronald Wiplinger wrote: On a system with php4 and mysql 4.x I had these lines: require(../db-config); // includes $dbhost, $buname, $dbpass $db =

Re: [PHP] Class 'PDO' not found in .... PHP 5.2.5

2008-07-17 Thread Ted Wood
PDO is distributed with PHP 5.1 and higher by default, but it can still be excluded during the compile stage. This may be the case for your installation. Run php_info() to find out, and if PDO is not listed, ask your host to install it. http://ca3.php.net/manual/en/pdo.installation.php

Re: [PHP] Question regarding OO

2008-07-11 Thread Ted Wood
Object-oriented programming, with it's class and object approach, is meant to model real life more closely than functional programming. In, a parking space is physically inside a parking lot, but a parking space is not a subclass of a parking lot. It's not a variation or mini parking

Re: [PHP] Question regarding OO

2008-07-11 Thread Ted Wood
Corrected code example: (too early in the morning to think) ?php class ParkingLot { var $size; var $num_spaces; var $spaces = array(); } class ParkingSpace { var $ps_ID; var $occupied_by; var $st_time; } ? In the above class definition, simply populate the $spaces array

Re: [PHP] PHP code will not work

2008-07-10 Thread Ted Wood
PHP at the command line doesn't run within a web server environment. ~Ted On 9-Jul-08, at 11:07 PM, Sanjay Mantoor wrote: Hi, I found $_SERVER['HTTP_USER_AGENT'] works when you are using with browser by server like Apache. If you are executing your code like script in command prompt it

Re: [PHP] Objects and Traversing

2008-06-04 Thread Ted Wood
You should be able to access the Name field using this syntax: QueryResult-records[0]-sobjects[0]-fields-Name Reading from left-to-right: 1. accessing index 0 (zero) of the records array. 2. accessing index 0 (zero) of the objects array. 3. accessing the Name property of the fields SimpleXML

Re: [PHP] Quickly verifying single word.

2008-06-04 Thread Ted Wood
There's probably a regex solution that is most elegant, but here is one solution: if ($str == str_replace(array(' ', \n), '', $str)) { // if you get here, then $str has no spaces or newline characters } ~Ted On 4-Jun-08, at 4:04 PM, Tyson Vanover wrote: I need a quick way to make

Re: [PHP] no array passed error

2008-06-03 Thread Ted Wood
PJ, I remember the days when this stuff seemed beyond mystical. 1. $dbh and $query are not built-in variables... but they need to be defined somewhere earlier in the code. That could even be in a different file if the file you're in has been included. 2. One trick to try is to use the php

Re: [PHP] strlower problem

2008-06-02 Thread Ted Wood
On 2-Jun-08, at 10:25 AM, Ed Curtis wrote: I found the problem myself. The actual code follows the same principal but the value of $thisStr is a $_GET value from a link. The name of that value in the link was 'style'. Oops, you should never use a HTML reserved attribute as a varible

Re: [PHP] question about session variables

2008-06-02 Thread Ted Wood
How are you calling thankyou.php? 1. are you -redirecting- the user to that file? --or-- 2. are you -including- that file into register.php upon a successful submission? The method you're using determines how you best secure thankyou.php from direct access. If you're redirecting, then

Re: [PHP] Links (A HREF) loosing my session

2008-06-02 Thread Ted Wood
1. If you're using cookies, there's no need to pass the session name via the URL. 2. Is the cookie being created? ~Ted On 2-Jun-08, at 11:32 AM, Razer MontaƱo wrote: Hello All, my first time here at list. Well, I am with a very weird question, never happened with me, always worked

Re: [PHP] Anybody got a little spare time to help me out with a little OOP

2008-06-01 Thread Ted Wood
On 1-Jun-08, at 8:15 AM, Ryan S wrote: Thanks for replying, but how and where do I put that into the script? all that this- stuff is confusing Tony Marsten's links seem to be very good, but let me offer you a simpler introduction. Once you can think in an OOP fashion,

Re: [PHP] validating username

2008-05-27 Thread Ted Wood
You need to encode the # mark. It is a special character in URLs. Example (not a real url): www.php.net/documentation.php#help That #help points to an anchor in that page. Try using the javascript escape() function. http://www.javascripter.net/faq/escape.htm ~Ted On 27-May-08, at 10:14 AM,