> 1. sleep(300) would mean pause by 300 mins, right? That's
> why i thought you mean usleep(300) - 300 microseconds.
No, 300 seconds - 5 minutes.
Chris
I'm trying to fopen a URL that I have no problems getting to
if I just past it into the address field of my browser. However,
when I use it in my fopen() function call, I'm getting an "Error
0" (zero) message.
I've looked all over the documentation and I could not find what
'Error 0' means.
Any
> My problem is:
> I wanna know the names of the variables that my actual page
> recives from the last page (using the POST method).
while( list( $formVarName, $formVarValue = each( $HTTP_POST_VARS )) {
echo "$formVarName = $formVarValue\n";
}
Chris
> I came across this:
> $confidential = 0;
> echo "$confidential " . ($confidential == "yes");
> In which "0 1" was printed.
> Is there something I'm missing?
Yes. When comparing types, PHP generally typcasts one side
of the operand to the type of what is on the other side. So in
th
Is it possible to pull an image, stored as binary data in a
mySQL table, and display it on a page inline? So it acts
as if the image was pulled from the file system normally?
If it is possible, could you point me to some online resources
that would give information on how this is done? I've trie
> Hi, I'm about to make a function with two arguments, and I
> want the second one to be optional. Can I just write the function
> and use it with one or two arguments without problems (I check
> if the second argument was passed inside the function).
> Is this OK?
To make the second argument
> This is the output I get running 4.0.4pl1 or 3.0.17 on Win98/Apache
> Using 3/9/1935
> Unix timestamp for this date is -1
This is what I get:
Using 3/9/1935
Unix timestamp for this date is -1098727200
Reconverting... March 09, 1935
> Warning: unexpected error in date() in on line 13
> Reconve
> Therefore any date on or before 1 Jan 1970 ain't going to
> work using mktime or any PHP function which returns a
> UNIX timestamp.
I'm sorry, but this is wrong. The following works with no
problems whatsoever.
$month = 3;
$day = 9;
$year = 1935;
echo "Using $month/$day/$yea
> I have finally learned to upload file using php.
> But the problem is that When I upload a file, it
> disappears from it's place and moves to the location I
> have told it to go to. It's more like a cut & paste
> rather then copy and paste...
> if (copy($userfile, "c:\\upload.txt"))
This is co
> I have a PHP web form setup for user to fill in information
> then email it to me after pressing SUBMIT button. Everytime
> user uses double-quote(") or single(') it inserts (/) right in front
> of " or '. Does anyone know why and how to fix it? Please advise.
Look up:
stripslashes();
> Sorry if I am confused by the date functions in the manual but I am.
> Here's what I want to do:
> I have a string in the form MM/DD/. I wish to:
> 1) convert it to a date
> 2) add $n days to it
> 3) convert back to a string in the same format above
> I believe I can accomplish [2] and [3]
> >Yes. But with regards to form variables, all you need to do is
> >make one variable global:
> >$HTTP_POST_VARS
> >it is an associative array that contains all the post variables from
> >the form. Make it global and just loop through it.
> exactly, u need to loop to an array to get the globa
> function u want to use it. THis is not nice, what about if u
> have a form with 50 fields and want a function to validate
> all of them, u have to pass them all to the function or build
> a little piece of code to make all the $GLOBALS local right?
> Is this really the idea of global vars?
Y
> I know this have been covered before but I can't find it in
> my thousands of emails... How would I URL Encode the following...
> I am retrieving a variable like but
> for example if it is Hilton Head Island I need it to add the
> + signs as Hilton+Head+Island so Netscape won't crash.
Funny
> > $joeBob = new myClass();
> > "myClass" can somehow know that "joeBob" is the name of
> > it's instance?
> > I'm thinking 'no', but would like verification.
> I'm not aware of a way to do so. I'm curious why you'd want
> to? If you want to pass "joeBob" to the class you can do so as the
> p
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 thinking
> 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
}
Chr
> 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
> 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) w
> > 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 s
> 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
> 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
> mo
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
i
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
> 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
> 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 mini
> You probably stated this in your previous post, but what is
> the result from your call to mysql() ? Is this call failing so
> that when you get to mysql_insert_id(), the id doesn't exist?
I did. It's returning a numerical one (1).
What I'm doing now is as follows. It's getting me the val
> 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 jus
I'm having intermittent problems with this function.
Most of the time, it returns the proper value. However,
sometimes it doesn't return anything at all even when
the insert query executes without error and I can see the
new data in the database. I try to get the last insert id
both by supplying
Are there any tutorials on how to use Sockets in PHP?
If so, where can I find them? I've looked on several of
the sites that are linked from the main php.net site but
found nothing... :/
Thanks.
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
> 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 l
> Also, you can check the value of $HTTP_REFERER for the ip of
> the trusted host, to further eliminate the potential.
How do you get the IP out of $HTTP_REFERER? As far as I know,
that only tells you the referring url, not the ip address. And couldn't
that value be messed with?
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 s
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,
> 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
> What if I want the function to be processed within the " "
> quotes? Same as a variable might be interopelated? IOW,
> can I call a function without concantenating the function
> together with the string?
> *being a little stubborn*
No. Why would you want to?
You *might* be able to do it
>echo "...are you logged in: $LoggedIn()";> //
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
> What is the syntax for dividing 7 by 2 and getting 3; not 3.5?
you can use:
$intVar = ((int)( 7 / 2 ));
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 a
> 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
> 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"
session_start();
header( "location: page1.php?" . SID );
exit();
"page1.php
sessio
> "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 PHPSESSI
I know that if you compile PHP4 with --enable-trans-sid
(as we have), it will automagically append SID to all href
links. This is supposed to make it so that if a client's browser
does not accept cookies, the session ID gets sent to any
subsequent pages that the user gets to by clicking on links.
> agreed, 4.5.2 still contains pretty old bugs.
> UltraEdit is bugfree (at least I haven't encountered any), has
> project management capabilities (but cannot make use of a
> version control system, AFAIK).
And that is definitely the most important feature I need,
unfortunately...
Chris
> > >Personally, my team and I use HomeSite 4.5.x from Allaire.
> > You did not mention the price (compared to HoTMetaL at $70).
> my two cents on price. who cares! if an editor makes one
> happy then pay as much as it takes to get it. consider how many
> hours are spent with the editor. 18
201 - 246 of 246 matches
Mail list logo