[PHP] Name of Class' instance

2001-02-06 Thread Boget, Chris
I think I already know the answer to this question, but I just want to make certain. Is there a way that a class can know the name of the variable used to instantiate it? So if you do: $joeBob = new myClass(); "myClass" can somehow know that "joeBob" is the name of it's instance? I'm

RE: [PHP] Suggest for List

2001-02-01 Thread Boget, Chris
Good idea, I agree, this would be nice. It would allow posters to better categorize their question, and would give responders a good place to hangout depending on their skill set. This has been suggested before. What you will invariably find is that all users (beginner and advanced) will

RE: [PHP] Pricing for PHP programming???

2001-02-01 Thread Boget, Chris
Besides, sometimes I think that PHP is so easy to learn that we should be considered unskilled labor ;-) The skill is in the shaping. Any joe off the street can make an ugly sculpture. It takes talent and skill to make art... :p Chris

RE: [PHP] Exit Function

2001-02-01 Thread Boget, Chris
What is the way to exit a function? For example: function FooBar() { if ($foo = $bar) Exit_this_Function; ## otherwise execute the rest of this function } function FooBar() { if ($foo = $bar) return 0; } ## otherwise execute the rest of this function } Chris

[PHP] Can you do this

2001-01-31 Thread Boget, Chris
Academic curiosity - You can do the following: echo "3 - 2 = " . ( bcsub( 3, 2 )); and PHP evaluates the expression in parenthesis (in this case a function) before it evaluates the echo statement and what gets printed out is: 3 - 2 = 1 Now, say I have a function where one of the arguments

RE: [PHP] Can you do this

2001-01-31 Thread Boget, Chris
What about using normal pass-by-value and returning the result? function MyFunc ($SomeVal) { $SomeVal += 42; return $SomeVal; } echo MyFunc ($StrangeVal); I'm already using the return value for something else. Anyway - functions that get their parameters by reference and modify

RE: [PHP] Is correct ??

2001-01-31 Thread Boget, Chris
Anybody knows if this sourcecode is correct to calculate the numbers of days in certain date ? Why are you going through all that effort? $janOne = mktime( 0, 0, 0, 1, 1, date( "Y" )); $myDate = mktime( 0, 0, 0, $m, $d, $y ); $daysInYear = ( $myDate - $janOne ) / 86400; That should do it

RE: [PHP] Is correct ??

2001-01-31 Thread Boget, Chris
Anybody knows if this sourcecode is correct to calculate the numbers of days in certain date ? Why are you going through all that effort? $janOne = mktime( 0, 0, 0, 1, 1, date( "Y" )); $myDate = mktime( 0, 0, 0, $m, $d, $y ); $daysInYear = ( $myDate - $janOne ) / 86400; That should do

[PHP] PHP Library for currency conversions

2001-01-26 Thread Boget, Chris
We need something to where we can poll a service and pull the exchange rates for various currencies against the dollar to our database for later use. Is there a PHP library/class that does something like this already? Just so I'm not reinventing the wheel? :p Chris

RE: [PHP] mysql_insert_id()

2001-01-24 Thread Boget, Chris
When you are using mysql_insert_id, you don't want to pass it the result of your previous SQL statement as in: $result = mysql"mydb", "My SQL statement", $my_connect) ; $last_id = mysql_insert_id($result) This is what it sounds like it's looking for in the documentation. It could be just

RE: [PHP] mysql_insert_id()

2001-01-24 Thread Boget, Chris
Instead of checking if(!$id), perhaps you would be better off to check the result of your query (which in this example was successful, since you got a return from mysql() ). I am. I just didn't include it in my previous message as it as I was trying to keep extraneous code down to a

RE: [PHP] how do you erase quotes from variable?

2001-01-24 Thread Boget, Chris
I have a variable(s) that hold the string: "name" and I'd like to kill the quotes so it contains: name I am aware of the strlen() function but can find the concant $newVar = eregi_replace( "\"", "", $varWithAboveData ); Chris

[PHP] Authenticating across sites/servers

2001-01-23 Thread Boget, Chris
I've been charged with trying to find out how something like this can be done if it is at all in fact possible. The info I'm hoping to get is what would be involved and where I can find information on it. I'm not asking for code or examples unless you really want to provide them. :P Anyways,

RE: [PHP] Authenticating across sites/servers

2001-01-23 Thread Boget, Chris
Have the user log in to/authenticate against the first server. That server generates a key, based on combining the username and a private key known to the authenticating server and your servers. Pass that back to your servers in a URL - cookie wouldn't work, but the key in the URL should

RE: [PHP] field types

2001-01-23 Thread Boget, Chris
Does anyone know a function to give me the mySql field types? I saw the function mysql_field_type, but that returns php types not mysql. What I wanna do is if the type of the field is "Text" then I wanna make a "textarea" to edit and add stuff. Thanks. If you have phpMySql, take a look

RE: [PHP] field types

2001-01-23 Thread Boget, Chris
If you have phpMySql, take a look at the file: /mysqladmin/tbl_properties.php That code is doing something to return the type of the field. It's a little hard to follow so I don't know exactly how he's doing it and unfortunately, didn't have the time to decipher. :p However, I'm sure if

RE: [PHP] Integer division

2001-01-19 Thread Boget, Chris
What is the syntax for dividing 7 by 2 and getting 3; not 3.5? you can use: $intVar = ((int)( 7 / 2 )); Chris

RE: [PHP] Function / String Problem

2001-01-19 Thread Boget, Chris
echo "brbr...are you logged in: $LoggedIn()brbr"; // outputs:...are you logged in: () Function is: function LoggedIn(){ global $HTTP_POST_VARS if ($HTTP_POST_VARS["Login"] == "PHPIsCool") {return "YES";} else {return "NO";} } Change your

RE: [PHP] but what if.. Function / String Problem

2001-01-19 Thread Boget, Chris
It won't work even with single quotes. It'll just echo out LoggedIn() as part of the string. Yeah, I didn't think so. But I knew that '' behaves differently than "". I just wasn't sure of the exact details of the differences. Chris

RE: [PHP] Sessions/security

2001-01-17 Thread Boget, Chris
Try looking at register_shutdown_function at http://www.php.net/manual/en/function.register-shutdown-function.php From the documentation: "int register_shutdown_function (string func) Registers the function named by func to be executed when script processing is complete." What qualifies as

RE: [PHP] HELP! Date formatting

2001-01-16 Thread Boget, Chris
Ive gotto format a date such as 30/12/1956 to format 30-Dec-1956, I can not use mktime cause that only provides the timestamp from 1970. Is there any other method of getting this right. mktime() can be used for this. 0 is from 1970. Negative values are used for dates prior. Chris

RE: [PHP] Sessions, no cookies and enable-trans-sid, oh my

2001-01-11 Thread Boget, Chris
"allow per session cookies(not stored)" will enable cookies, IE just does some garbage collection when its closed thats all. so php realizes that IE is accepting cookies in this case and uses cookies vs trans-sid. Ok. Makes sense. However, when this option is enabled, I see PHPSESSID

RE: [PHP] Sessions, no cookies and enable-trans-sid, oh my

2001-01-11 Thread Boget, Chris
make sure of course too that session_start() is called from in your code too. else your not using sessions :) These are the 3 files I'm using; they all reside in the same dir: "index.php" script language="php" session_start(); header( "location: page1.php?" . SID ); exit();

<    1   2   3