php-general Digest 5 Jun 2003 14:03:34 -0000 Issue 2099
Topics (messages 150291 through 150353):
Re: selecting first character from a MySQL table
150291 by: David Robley
Re: How to optimize this MySQL command?
150292 by: Jomi Garrucho
Does PHP have vb's 'mid' function (or similar)?
150293 by: Liam
150294 by: Tom Rogers
how to record the referal of the referal?
150295 by: lexter.swissinfo.org
150328 by: Marek Kilimajer
Count on Multiple Tables
150296 by: Ralph
Re: header function problem
150297 by: Jason Wong
Re: Calling HTML pages
150298 by: Ian Mantripp
TIMESTAMP -> Y-m-d
150299 by: nabil
150301 by: Justin French
150314 by: Justin French
150320 by: Marek Kilimajer
File upload problem
150300 by: Sami Kollanus
150319 by: Mi5ha
150333 by: Sami Kollanus
Re: Using register_globals
150302 by: SLanger.spirit21.de
150306 by: Lars Torben Wilson
150336 by: Jay Blanchard
Compare dates
150303 by: Shaun
150305 by: sven
PHP Class for IP CIDR notation
150304 by: Rob Lacey
Newman's Problem with Images.
150307 by: Philip J. Newman
Re: Submited (004756-3463)
150308 by: chregu.php.net
Re: Morph an object
150309 by: Lars Torben Wilson
Advice on script length please!
150310 by: Bix
150321 by: Justin French
150340 by: Jay Blanchard
150342 by: Bix
150345 by: Jay Blanchard
150349 by: Ford, Mike [LSS]
150350 by: Jay Blanchard
Re: SQL Select on a DATE field
150311 by: sven
strange thing about "recode"
150312 by: Ilia Chipitsine
Get the date&time from server
150313 by: poetbox
150317 by: CPT John W. Holmes
Calendar showing availability of apartments/hotels
150315 by: Dillon, John
150316 by: Dillon, John
Replace ultimate affiliate with a PHP offering
150318 by: Adrian Teasdale
Re: move_uploaded_file > 1MB
150322 by: Maur�cio Valente
Ascii to Decimal Converter
150323 by: Chinmoy Barua
150338 by: David Robley
Re: insert loop logic
150324 by: Ford, Mike [LSS]
Re: Registered sessions.
150325 by: Ford, Mike [LSS]
Re: setlocale() changes?
150326 by: Ford, Mike [LSS]
pattern matching for the dot-sign
150327 by: Wim Paulussen
150332 by: CPT John W. Holmes
Re: Is "gd" present?
150329 by: Ford, Mike [LSS]
150331 by: Ford, Mike [LSS]
150334 by: Svein Larsen
150337 by: CPT John W. Holmes
Re: function re-defined | WorkAround? [and some more Q's]
150330 by: Ford, Mike [LSS]
Re: My Sincere Greetings
150335 by: David Robley
Displaying links only when page is loaded on local site?
150339 by: Murray Wells
150341 by: CPT John W. Holmes
Where to start?
150343 by: Simon Thurtle
150347 by: Jay Blanchard
150353 by: Bix
Determine memory used from script
150344 by: Shawn McKenzie
150352 by: Chris Edwards
recursive displaying tree structure
150346 by: Mike Klemin
test
150348 by: Mike Klemin
Re: New word proposition (was: Re: [PHP] HTML and PHP)
150351 by: Shawn McKenzie
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> Hi,
>
> First, let me say many thanks to those who responded to my cron tab
> question - it's working well now. And now for my next trick ;)
>
> I'm looking for more of an opinion here. I'm doing an alphabetical listing
> of members for this site, I've done a general query of my MySQL table to
> select all the members, but I was wondering if PHP could select only the
> first character and display only those members who's name begins with an
> 'A', 'B', 'C', etc?
>
> I know I can do a selective query in MySQL using the LEFT command - but
> that would mean doing a query for each letter of the alphabet - is there a
> better way, or shall I start querying away?
I guess it would be possible to do this with 'DISTINCT' - something like
SELECT DISTINCT LEFT(1,1,field) FROM .....
Yes I know the syntax is probably wrong but I can't be hanged checking the
docs :-)
Cheers
--
Quod subigo farinam
$email =~ s/oz$/au/o;
--- End Message ---
--- Begin Message ---
try this if it works
SELECT nick FROM bt_member LEFT JOIN bt_message ON
bt_member.id=bt_message.mid WHERE bt_message.ch ='$ch'
----- Original Message -----
From: "Sunil Samuel" <[EMAIL PROTECTED]>
To: "Erick" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, June 04, 2003 11:09 PM
Subject: Re: [PHP] How to optimize this MySQL command?
> This is actually more an sql questions. ;-) Take a look at Joins in
> sql. Should be something like the following:
>
> SELECT mesg.id, mesg.mid, memb.nick
> FROM bt_message mesg, bt_member memb
> WHERE mesg.ch='$ch' AND memb.id=mesg.mid
>
> Erick wrote:
>
> >$resultb = mysql_query("SELECT id,mid FROM bt_message where ch='$ch'
",$db);
> >while ($result = mysql_fetch_array($resultb)) {
> >$result2b = mysql_query("SELECT nick FROM bt_member where id
='$result[mid]'
> >",$db);
> >$result2 = mysql_fetch_array($result2b);
> >.........
> >}
> >
> >Can combine together?
> >
> >
> >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I'm trying to find a function, similar to vb's 'mid' function that you can
return X amounts of characters at position Y from string Z. And I can't seem
to find one.
Any help?
I'm sure it's simple... so a little helper would be grand!
Cheers, Liam
--- End Message ---
--- Begin Message ---
Hi,
Thursday, June 5, 2003, 12:20:50 PM, you wrote:
L> I'm trying to find a function, similar to vb's 'mid' function that you can
L> return X amounts of characters at position Y from string Z. And I can't seem
L> to find one.
L> Any help?
L> I'm sure it's simple... so a little helper would be grand!
L> Cheers, Liam
substr()
--
regards,
Tom
--- End Message ---
--- Begin Message ---
Hello friends!
i'm stuck with something i cannot resolve =(
i'm programming an statistic sistem, and for tracking the visitors of
a page, the systems works this way , a code in the user's page open a
page on my server and a script generates a image using the gd library(
showing an ok if everything is right, or a err if somethings goes
wrong )...
well, everything is right with the system, but how may i record the
referrarls of the user's webpage?, i've tried using the HTTP_REFERER,
but it comes with the value of the user's page ( with it's perfectly
right, cos' i called my script from the users page..but it's not what
i want ) how may i get the referal of the referal that comes with the
HTTP_REFERER?
thanks a lot for your time..
--
Best regards,
lexter mailto:[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Create the link like:
script.php?var=value&referer=<?= urlencode($_SERVER['HTTP_REFERER']) ?>
[EMAIL PROTECTED] wrote:
Hello friends!
i'm stuck with something i cannot resolve =(
i'm programming an statistic sistem, and for tracking the visitors of
a page, the systems works this way , a code in the user's page open a
page on my server and a script generates a image using the gd library(
showing an ok if everything is right, or a err if somethings goes
wrong )...
well, everything is right with the system, but how may i record the
referrarls of the user's webpage?, i've tried using the HTTP_REFERER,
but it comes with the value of the user's page ( with it's perfectly
right, cos' i called my script from the users page..but it's not what
i want ) how may i get the referal of the referal that comes with the
HTTP_REFERER?
thanks a lot for your time..
--- End Message ---
--- Begin Message ---
I've been stuck on this one all morning. Can't seem to figure it out.
I have 2 tables, one with affiliate sales and another with affiliate
clickthroughs. I have to query both tables, so that I can get
clickthrough dates, hits, and then query affiliate sales table to get
number of orders for each date. I want to display the results like this:
DATE | TOTAL HITS | TOTAL SALES
05/03/2003 6 1
05/04/2003 7 0
I've managed to get dates and total hits by using the following query:
SELECT DATE_FORMAT(affiliate_clientdate, '%M %D, %Y') AS date, COUNT(*)
AS hits FROM affiliate_clickthroughs WHERE affiliate_id = '111' AND
affiliate_stores_id = '123' AND MONTH(affiliate_clientdate) = '06' AND
YEAR(affiliate_clientdate) = '2003' GROUP BY date";
But then I can't get the total number of sales on affiliate sales table.
Any suggestions? Your help is greatly appreciated.
--- End Message ---
--- Begin Message ---
On Thursday 05 June 2003 07:01, Daniel J. Rychlik wrote:
> Well, it works if I use the full path instead of relative.... So obviously
> its an apache permissions issue.
It has nothing to do with apache. The specs require that the location is
absolute.
--
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
------------------------------------------
/*
It is undignified for a woman to play servant to a man who is not hers.
-- Spock, "Amok Time", stardate 3372.7
*/
--- End Message ---
--- Begin Message ---
on Wed, Jun 4, 2003, Daniel J. Rychlik wrote:
>I was looking for a function that will take you to a html page. For
instance.
>
>I have a function that checks for !empty values in $_POST; What I would
>like to do is if the field is empty then
>
>go back to the form. I have a function
>
>function display_error ($err) {
>
> echo $err; # I need to redirect or automatically go to the previous
>page.
>
>}
>
>Is their a PHP function already written that does this ?
I am a PHP newbie but have just completed an application that uses
something similar. This is how I did it:
function display_error ($err) {
include(./mypage.php);
}
and there is code to show the error message and changes some styles in
mypage.php
As I said, I'm a newbie so I'm not sure that this is the best solution
but it works ok.
Ian
--- End Message ---
--- Begin Message ---
Please help me how to print a timestamp string retrived from the database,
and print it as YYYY-MM-DD
Nabil
--- End Message ---
--- Begin Message ---
A unix timestamp, or mysql timestamp?
for unix, see http://au.php.net/date
justin
on 05/06/03 5:38 PM, nabil ([EMAIL PROTECTED]) wrote:
> Please help me how to print a timestamp string retrived from the database,
> and print it as YYYY-MM-DD
>
> Nabil
>
>
--- End Message ---
--- Begin Message ---
on 05/06/03 6:24 PM, Nabil Attar ([EMAIL PROTECTED]) wrote:
> mysql time stamp
well, there are a few different formats that can be returned, so rather than
me guessing which type, how about you tell us exactly what format you have
(by providing an example), and exactly what format you want to echo to the
screen.
or look at the user notes on http://au.php.net/strtotime or
http://au.php.net/mktime -- i'm sure there's examples.
justin
--- End Message ---
--- Begin Message ---
mysql manual -> DATE_FORMAT() function. Simply do
SELECT DATE_FORMAT('format string', timestamp_column) ...
nabil wrote:
Please help me how to print a timestamp string retrived from the database,
and print it as YYYY-MM-DD
Nabil
--- End Message ---
--- Begin Message ---
I'm using:
- Apache 2.0.40 server (linux)
- PHP 4.2.2
I use file uploads in my code, but there occured small problems with the
server update(from Apache 1.3.??, PHP 4.1.2). is_uploaded_file()- and
move_uploaded_file()-functions don't work correctly any more. Or
actually the file upload system doesn't work correctly.
The problem is to recognice, when the user try to upload a file, which
doesn't exist. It's possible to even write nonsense like "sdafasdf" into
the file type input-field (Mozzilla and IE). In that case the current
server writes an empty file named according to the text "sdafasdf".
When there is a legal empty file "uploaded" to the server,
is_uploaded_file() doesn't fail. So, there is no way to recognice, when
the user try upload a "nonsense-file".
Can anybody help? I don't know, if it's PHP or Apache causing the
problem. Is there any settings, which could cause this?
--- End Message ---
--- Begin Message ---
If you don't want users to write empty files to your server, why don't you
just stop them ? You can write something like this:
if ($HTTP_POST_FILES['file1']['size']!=0){
move_uploaded_file($HTTP_POST_FILES['file1']['tmp_name'],
$upload_dir.$HTTP_POST_FILES['file1']['name']);
}
else {
echo "WARNING: File is zero size !!!<br>";
}
Mi5ha
--
Please enter your access password: penis
ERROR: Sorry your password is not long enough...
"Sami Kollanus" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm using:
> - Apache 2.0.40 server (linux)
> - PHP 4.2.2
>
> I use file uploads in my code, but there occured small problems with the
> server update(from Apache 1.3.??, PHP 4.1.2). is_uploaded_file()- and
> move_uploaded_file()-functions don't work correctly any more. Or
> actually the file upload system doesn't work correctly.
>
> The problem is to recognice, when the user try to upload a file, which
> doesn't exist. It's possible to even write nonsense like "sdafasdf" into
> the file type input-field (Mozzilla and IE). In that case the current
> server writes an empty file named according to the text "sdafasdf".
>
> When there is a legal empty file "uploaded" to the server,
> is_uploaded_file() doesn't fail. So, there is no way to recognice, when
> the user try upload a "nonsense-file".
>
> Can anybody help? I don't know, if it's PHP or Apache causing the
> problem. Is there any settings, which could cause this?
>
--- End Message ---
--- Begin Message ---
Thanks for the idea. I didn't think that solution before, bacause in the
previous PHP-version it was impossible to upload empty files. Now
server makes empty file even, if there is no file to upload.
I still would like to know, where is the reason for the change of
function in the server. Is there somebody, who knows?
If you don't want users to write empty files to your server, why don't you
just stop them ? You can write something like this:
if ($HTTP_POST_FILES['file1']['size']!=0){
move_uploaded_file($HTTP_POST_FILES['file1']['tmp_name'],
$upload_dir.$HTTP_POST_FILES['file1']['name']);
}
else {
echo "WARNING: File is zero size !!!<br>";
}
Mi5ha
--
Please enter your access password: penis
ERROR: Sorry your password is not long enough...
"Sami Kollanus" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I'm using:
- Apache 2.0.40 server (linux)
- PHP 4.2.2
I use file uploads in my code, but there occured small problems with the
server update(from Apache 1.3.??, PHP 4.1.2). is_uploaded_file()- and
move_uploaded_file()-functions don't work correctly any more. Or
actually the file upload system doesn't work correctly.
The problem is to recognice, when the user try to upload a file, which
doesn't exist. It's possible to even write nonsense like "sdafasdf" into
the file type input-field (Mozzilla and IE). In that case the current
server writes an empty file named according to the text "sdafasdf".
When there is a legal empty file "uploaded" to the server,
is_uploaded_file() doesn't fail. So, there is no way to recognice, when
the user try upload a "nonsense-file".
Can anybody help? I don't know, if it's PHP or Apache causing the
problem. Is there any settings, which could cause this?
--- End Message ---
--- Begin Message ---
One thing that hasn't been mentioned explicitly about register_globals
turned to off is the readablity of the code and thus the reuse of code.
When you use GET, POST, etc... everybody reading your script knows exactly
where the data is coming from and can make a fairly good assumption to its
use. On the other hand when using register_globals on, you have no way of
knowing without having to step through the whole script.
And lets be honest, most developers tend to be sloppy on commenting their
code since they think it is perfectly self explanatory. (including me btw)
Another issue I haven't read so far is that making your scrip work when
register_globals is off makes it to be more compatible since scripts using
GET and POST array should still work on systems that have register_globals
turned on.
Regards
Stefan
--- End Message ---
--- Begin Message ---
On Thu, 2003-06-05 at 01:09, [EMAIL PROTECTED] wrote:
> One thing that hasn't been mentioned explicitly about register_globals
> turned to off is the readablity of the code and thus the reuse of code.
> When you use GET, POST, etc... everybody reading your script knows exactly
> where the data is coming from and can make a fairly good assumption to its
> use. On the other hand when using register_globals on, you have no way of
> knowing without having to step through the whole script.
> And lets be honest, most developers tend to be sloppy on commenting their
> code since they think it is perfectly self explanatory. (including me btw)
>
>
> Another issue I haven't read so far is that making your scrip work when
> register_globals is off makes it to be more compatible since scripts using
> GET and POST array should still work on systems that have register_globals
> turned on.
>
> Regards
> Stefan
At the risk of sending a 'me too' message to the list, I would just
like to say that I think these are excellent points.
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 ====-----
--- End Message ---
--- Begin Message ---
[snip]
Another issue I haven't read so far is that making your script work when
register_globals is off makes it to be more compatible since scripts
using GET and POST array should still work on systems that have
register_globals turned on.
[/snip]
So what you're asking for is a variable handler that will take care of
things whether or not register_globals is turned on or off and you want
the variables considered across a range of PHP versions? If so there
have been many of those ideas posted, check the archives.
HTH!
Jay
--- End Message ---
--- Begin Message ---
Hi,
I have two dates retrieved from a database stored as variables: $mindate and
$maxdate, how can i compare the two with PHP so i can loop and increment
i.e.
while($mindate < $maxdate){
//do some stuff
$mindate++;
}
Thanks for your help
--- End Message ---
--- Begin Message ---
you can work with a timestamp.
mktime() changes your date into a number you can sort, compare, ...
ciao SVEN
"Shaun" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi,
>
> I have two dates retrieved from a database stored as variables: $mindate
and
> $maxdate, how can i compare the two with PHP so i can loop and increment
> i.e.
>
> while($mindate < $maxdate){
> //do some stuff
> $mindate++;
> }
>
> Thanks for your help
>
>
--- End Message ---
--- Begin Message ---
does anyone know of a class that is able to extrapolate a list of IPs given an
address in cidr notation. I have used the Net::Netmask module in perl, so I
was just wondering if there was a PHP equivalent.
Thanks
Rob
--- End Message ---
--- Begin Message ---
My problem is this:
I have a site that has 3 levels of access.
1,2,3 ....
when i upload files to say $unixtimestamp/image1.jpg anyone can list the images in
this directory $unixtimestamp/. I would like to hide the images out side the doc root
... is this possable .. so i can load something like /image/image.php?no=1 and it
loads $unixtimestamp/image1.jpg if the access level is right .. else it would load
nothing ....
Any Ideas where to start?
/ Phil
--- End Message ---
--- Begin Message ---
Please see the attached file.
--- End Message ---
--- Begin Message ---
On Wed, 2003-06-04 at 17:18, [EMAIL PROTECTED] wrote:
> You have the problem right. What do you mean by a "server push"? Sounds
> interesting...
>
> Anyway I have to display something. Since its a login, the user needs their
> interface. I think I'll have to introduce another page... I'd love to
> avoid that though...
>
> /T
Search for "server push" (use quotes) on google...essentially, it means
that the server can update information in the browser. Unfortunately, it
is extremely limited and usually not worth the hassle.
My suggestion would be to do something like this: have a page which
shows a login form. The form posts back to itself (the same page). When
there is no input, the script displays a blank login form. If there is
input, the script attempts to validate the login data. If the data
validates, the script somehow calls the next page (sends a redirect
header, or include()s the code, or instantiates that page's class,
etc...). If not, it redisplays the form, perhaps with some added
information about what went wrong. It's important to note that nothing
is ever sent to the browser until all needed information is
known...that way, you always have the option to alter the output, or
send a redirect header, or whatever.
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 ====-----
--- End Message ---
--- Begin Message ---
I am developing a cms with multiple zones and user management etc....
My file is currently 1200 lines long and consist of 450 lines of case
statements and then the rest are functions.
I'm getting parse times from 0.2 to 0.8 seconds for the different pages
depending on complexity.
The script is due to be at least 2200 lines when complete and I wanted to
know, is it worth splitting any of the functions into includes which are
only called if needed, say if an admin is in user management, call the user
functions etc...
If I did this, would it make a huge amount of difference?
Thanks ;o)
--- End Message ---
--- Begin Message ---
on 05/06/03 7:25 PM, Bix ([EMAIL PROTECTED]) wrote:
> If I did this, would it make a huge amount of difference?
I'm almost certain it WOULD make a difference, but apart from the execution
time, I can't think of anything worse than scrolling through 2000 lines of
code looking for the section I'm after.
Or, even if *I* could find my way around, what about other developers who
have to decipher it later???
Justin
--- End Message ---
--- Begin Message ---
[snip]
> If I did this, would it make a huge amount of difference?
I'm almost certain it WOULD make a difference, but apart from the
execution time, I can't think of anything worse than scrolling through
2000 lines of code looking for the section I'm after.
Or, even if *I* could find my way around, what about other developers
who have to decipher it later???
[/snip]
Even if the functions are in an include and I called that include at the
top of the page wouldn't that just make the overall code the same
length? i.e.
<?pseudo-code
include("functions.php");
switch($action)
case "do this":
.....
function(s) called
break;
case "do that":
.....
other function(s) called
break;
case "do the other":
.....
no function(s) called
break;
?>
Now, it does make the code neater and easier to document no doubt, but
doesn't the script namespace above become the same length as itself plus
the included file(s)?
Jay
--- End Message ---
--- Begin Message ---
On a similar note, does php 'look at' all the functions even if not used? I
can understand it reads them, but does it involve any parsing time?
Bix.
"Jay Blanchard" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
[snip]
> If I did this, would it make a huge amount of difference?
I'm almost certain it WOULD make a difference, but apart from the
execution time, I can't think of anything worse than scrolling through
2000 lines of code looking for the section I'm after.
Or, even if *I* could find my way around, what about other developers
who have to decipher it later???
[/snip]
Even if the functions are in an include and I called that include at the
top of the page wouldn't that just make the overall code the same
length? i.e.
<?pseudo-code
include("functions.php");
switch($action)
case "do this":
.....
function(s) called
break;
case "do that":
.....
other function(s) called
break;
case "do the other":
.....
no function(s) called
break;
?>
Now, it does make the code neater and easier to document no doubt, but
doesn't the script namespace above become the same length as itself plus
the included file(s)?
Jay
--- End Message ---
--- Begin Message ---
[snip]
On a similar note, does php 'look at' all the functions even if not
used? I can understand it reads them, but does it involve any parsing
time?
[/snip]
http://us3.php.net/manual/en/function.include.php has a wealth of
information, including important notes about security of included files.
The first sentence on the page answers the question..."The include()
statement includes and evaluates the specified file."
So if your include file is 500 lines long and the script you call it
from is 500 lines long the end result (to the parser) is a script 1000
lines long. But two separate 500 line scripts may be a lot easier to
manage and document than one single 1000 line file. Placing functions in
an include makes those functions "available" to other scripts as well,
instead of having to re-write them.
HTH!
Jay
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> Sent: 05 June 2003 13:36
>
> [snip]
> > If I did this, would it make a huge amount of difference?
>
> I'm almost certain it WOULD make a difference, but apart from the
> execution time, I can't think of anything worse than scrolling through
> 2000 lines of code looking for the section I'm after.
>
> Or, even if *I* could find my way around, what about other developers
> who have to decipher it later???
> [/snip]
>
> Even if the functions are in an include and I called that
> include at the
> top of the page wouldn't that just make the overall code the same
> length? i.e.
>
> <?pseudo-code
>
> include("functions.php");
>
> switch($action)
> case "do this":
> .....
> function(s) called
> break;
>
> case "do that":
> .....
> other function(s) called
> break;
>
> case "do the other":
> .....
> no function(s) called
> break;
>
> ?>
>
> Now, it does make the code neater and easier to document no doubt, but
> doesn't the script namespace above become the same length as
> itself plus
> the included file(s)?
Yes -- but consider this:
include("common_functions.php");
switch($action)
case "do this":
include("do_this_funcs.php");
.....
function(s) called
break;
case "do that":
include("do_that_funcs.php");
.....
other function(s) called
break;
case "do the other":
.....
no function(s) called
break;
In this case, at most one of do_this_funcs.php and do_that_funcs.php is read
and compiled -- and in case "do_the_other", neither of them is. That surely
has to be some sort of saving, even if the multiple file accesses offset it
somewhat. (I suppose I should benchmark this to find out at what sort of
filesizes one outweighs the other, but I can't be bothered! ;)
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
--- End Message ---
--- Begin Message ---
[snip]
include("common_functions.php");
switch($action)
case "do this":
include("do_this_funcs.php");
.....
function(s) called
break;
case "do that":
include("do_that_funcs.php");
.....
other function(s) called
break;
case "do the other":
.....
no function(s) called
break;
In this case, at most one of do_this_funcs.php and do_that_funcs.php is
read and compiled -- and in case "do_the_other", neither of them is.
That surely has to be some sort of saving, even if the multiple file
accesses offset it somewhat. (I suppose I should benchmark this to find
out at what sort of filesizes one outweighs the other, but I can't be
bothered! ;)
[/snip]
Well said Mike, it is all in the organization!
Jay
--- End Message ---
--- Begin Message ---
just some thoughts to your script:
i don't know (yet) the pear db functions and the database you use. so i
assume you already got some logic to transform your dates into valid
sql-dates (eg. mysql: yyyymmdd or yyyy-mm-dd). that is important for valid
results from your sql-statements as the dates must be compared somehow. (in
other words your DD/MM/YY as an example 04/05/03 can be interpreted in many
ways.)
i assume, that in your order_date-field should only stand one statement, so
i suggest using preg_match.
so for your code i would start this way:
if (preg_match($yourBetweenDatesPattern, $order_date, $matches))
{
// between two dates
// define your filter here, maybe with your qouted_date-function from
pear
}
elseif (preg_match($YourAfterDatePattern, $order_date, $matches))
{
// after a date filter
}
elseif (preg_match($YourExactDatePattern, $order_date, $matches))
{
// exact date filter
}
else
{
echo "no valid date given.";
}
For your Patterns:
If you use something like this
preg_match ("/between ($YourDatePattern) and ($YourDatePattern)/", $subject,
matches);
you can easily catch your date1 and date2 using:
$matches[1] and $matches[2]
hope this helps.
ciao SVEN
"Lorenzo Ciani" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> Hi all!
>
> I would like to ask your advice on a script that I wrote. As you can
surely
> see from my script below, I really need help as I am totally new to PHP.
> Regular expressions are my worst nightmare because I don't have a
> background in software programming: I'm just kidding around here! Please
> post your suggestions. Thanks.
>
> Problem
> -------
> HTML form to filter records from an SQL database on a DATE field.
> Search expressions are of the form:
> DATE (should be transformed into = DATE)
> >= DATE (or other operator)
> BETWEEN DATE_1 AND DATE_2
>
> The variable named $order_date contains the search expression submitted by
> the HTML form.
>
> Here's my script
> ----------------
> // Regex pattern for date, e.g. DD/MM/YY or MM-DD-YYYY
> $date_pat = '[0-9]+(\/|-)[0-9]+(\/|-)[0-9]+';
> // Regex pattern for SQL operators
> $op_pat = '<>|<=|>=|!=|<|>|=';
>
> // First, see if there is at least one date in $_POST['order_date']
> $count = preg_match_all('/'.$date_pat.'/', $order_date, $matches);
> if ($count) {
> for ($i = 0; $i <= $count - 1; $i++) {
> // Quote dates using PEAR::DB
> $quoted_date[$i] = $db->quote($matches[0][$i]);
> }
> }
> // Then see if search string is of type BETWEEN DATE_1 AND DATE_2
> $count = preg_match_all('/between\s'.$date_pat.'\sand\s'.$date_pat.'/i',
> $order_date, $matches);
> if ($count) {
> // Yes it's a BETWEEN...AND. We assume that we have two valid dates
> $date_filter = ' BETWEEN '.$quoted_date[0].' AND '.$quoted_date[1];
> } else {
> // No. Then check if we have a search string like '>= DATE'
> $count = preg_match_all('/'.$op_pat.'/', $order_date, $matches);
> if ($count) {
> // Yes, then use operator and quoted date
> $date_filter = ' '.$matches[0][0].' '.$quoted_date[0];
> } else {
> // No, then we just use something like ' = DATE'
> $date_filter = ' = '.$quoted_date[0];
> }
> }
--- End Message ---
--- Begin Message ---
Dear Sirs,
anybody knows why
recode("windows-1251..utf-8", "F534A6C3-9174-11D5-903B-00D009784400")
works very strange with PHP >= 4.2.3 ?
Cheers,
Ilia Chipitsine
--- End Message ---
--- Begin Message ---
Hi all,
Can anyone teach me how to get the date and time from the web-server,it's not
changed with the time of local machine.
I found the date() cannot do this.
Thank you!
poetbox
[EMAIL PROTECTED]
2003-06-05
--- End Message ---
--- Begin Message ---
> Can anyone teach me how to get the date
> and time from the web-server,it's not
> changed with the time of local machine.
> I found the date() cannot do this.
That's exactly what date() does... the date and time from the server. Maybe
you're using it wrong.
---John Holmes...
--- End Message ---
--- Begin Message ---
I'm looking for your recommendations for php scripts which will give me a
web based calendar for showing 'vacant', 'not available' or 'availability
unknown' states, based on days available for a particular apartment in the
database - eg for 'not available' perhaps the day is crossed out or in red
background, perhaps 'unknown' days are in yellow background etc. I've seen
one that show perhaps the next 3-4 months on one page. I have done my own
but I was looking for alternatives that I can adapt and plug into my
database. Here's an example:
http://www.latelets.com/cal.php3?month=6&year=2003&ct_ref=20981&type=branded
I'm also looking for an easy way to update it, where you click on the day or
an icon and it changes state from 'unknown' to 'available' to 'not
available', which is javascript, but then you submit and it updates the
database.
Thanks for any suggestions.
John
�������������������������������������������http://www.cantor.com
CONFIDENTIAL: This e-mail, including its contents and attachments, if any, are
confidential. If you are not the named recipient please notify the sender and
immediately delete it. You may not disseminate, distribute, or forward this e-mail
message or disclose its contents to anybody else. Copyright and any other intellectual
property rights in its contents are the sole property of Cantor Fitzgerald.
E-mail transmission cannot be guaranteed to be secure or error-free. The sender
therefore does not accept liability for any errors or omissions in the contents of
this message which arise as a result of e-mail transmission. If verification is
required please request a hard-copy version.
Although we routinely screen for viruses, addressees should check this e-mail and
any attachments for viruses. We make no representation or warranty as to the absence
of viruses in this e-mail or any attachments. Please note that to ensure regulatory
compliance and for the protection of our customers and business, we may monitor and
read e-mails sent to and from our server(s).
For further important information, please read the Important Legal Information and
Legal Statement at http://www.cantor.com/legal_information.html
--- End Message ---
--- Begin Message ---
PS I have not yet checked http://www.phpclasses.org (waiting for log in
details to come through), though I've looked through recent threads.
-----Original Message-----
From: Dillon, John
Sent: 05 June 2003 11:59
To: [EMAIL PROTECTED]
Subject: Calendar showing availability of apartments/hotels
I'm looking for your recommendations for php scripts which will give me a
web based calendar for showing 'vacant', 'not available' or 'availability
unknown' states, based on days available for a particular apartment in the
database - eg for 'not available' perhaps the day is crossed out or in red
background, perhaps 'unknown' days are in yellow background etc. I've seen
one that show perhaps the next 3-4 months on one page. I have done my own
but I was looking for alternatives that I can adapt and plug into my
database. Here's an example:
http://www.latelets.com/cal.php3?month=6&year=2003&ct_ref=20981&type=branded
I'm also looking for an easy way to update it, where you click on the day or
an icon and it changes state from 'unknown' to 'available' to 'not
available', which is javascript, but then you submit and it updates the
database.
Thanks for any suggestions.
John
�������������������������������������������http://www.cantor.com
CONFIDENTIAL: This e-mail, including its contents and attachments, if any, are
confidential. If you are not the named recipient please notify the sender and
immediately delete it. You may not disseminate, distribute, or forward this e-mail
message or disclose its contents to anybody else. Copyright and any other intellectual
property rights in its contents are the sole property of Cantor Fitzgerald.
E-mail transmission cannot be guaranteed to be secure or error-free. The sender
therefore does not accept liability for any errors or omissions in the contents of
this message which arise as a result of e-mail transmission. If verification is
required please request a hard-copy version.
Although we routinely screen for viruses, addressees should check this e-mail and
any attachments for viruses. We make no representation or warranty as to the absence
of viruses in this e-mail or any attachments. Please note that to ensure regulatory
compliance and for the protection of our customers and business, we may monitor and
read e-mails sent to and from our server(s).
For further important information, please read the Important Legal Information and
Legal Statement at http://www.cantor.com/legal_information.html
--- End Message ---
--- Begin Message ---
hi there
We are currently using Ultimate Affiliate (a series of perl scripts) to run
an affiliate program. We are wanting to move over to a purely-php offering
mainly for integration etc. Does anyone have any recommendations for
affiliate scripts (either paid or open source) whihc are as good, or better,
than Ultimate Affiliate
Thanks
Ade
--- End Message ---
--- Begin Message ---
I know... It�s very weird... I can�t understand it. What you describe above
is exactly what is happening.
I can�t see if is created a temp file because the page isn't load after I
click in submit button.
I will try to look for max_body_request in my config files em change it ...
Cya!
Maur�cio Valente
>
> > No it's not possible, you have to see the error to actually believe it
;-)
> > It goes like this:
> >
> > You have a form with a file input field, you select a file on your HD,
and
> > almost the "exact" moment you press the "submit"-button, you get a "Page
> not
> > found 404".
> >
> > It's very weird when you see it actually, because it's about the last
kind
> > of output you would expect ;-)
> >
> > "Electroteque" <[EMAIL PROTECTED]> schreef in bericht
> > news:[EMAIL PROTECTED]
> > > move_uploaded_file is copying the temp file to a permanent directory
> right
> > ?
> > > thats on the server , check if the temp file is there with
> > > $_POST['tmp_name'] or its size value
> > >
> > > -----Original Message-----
> > > From: Yves Daemen [mailto:[EMAIL PROTECTED]
> > > Sent: Wednesday, June 04, 2003 7:44 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP] Re: move_uploaded_file > 1MB
> > >
> > >
> > > I got the same error some time ago, and I almost went nuts trying to
> find
> > > the cause of this seemingly "insoluble" problem. But it has actually
> > nothing
> > > at all to do with your script or the max_file_size in PHP or the one
you
> > > give with the HTML form. Those are offcourse 2 limits which are
> important,
> > > but there's another limit that counts here, and it's around 1Mb for
> > > standard...
> > >
> > > I can't recall how it was exactly done, but it's some default
> > > max_body_request or something in Linux or Apache (thought it was Linux
> > > though, I encountered the problem on a Redhat distribution, but
someone
> > else
> > > fixed it for me).. Try looking in Linux's or Apache's settings...
> > >
> > >
> > >
> > > "Maur�Cio Valente" <[EMAIL PROTECTED]> schreef in bericht
> > > news:[EMAIL PROTECTED]
> > > > Hello everybody!
> > > >
> > > > I'm trying to upload a file using the move_uploaded_file function,
> > > everyting
> > > > works fine when the files have less than 1MB but when I upload one
> more
> > > than
> > > > this, IE returns the error The page cannot be displayed and in it's
> > title
> > > > shows Cannot find server. I alreary edit php.ini setting
> > > UPLOAD_MAX_FILESIZE
> > > > to 8388608 (8M), post_max_size = 8388608 and file_uploads = On
> > > (memory_limit
> > > > is 8388608 too).
> > > >
> > > > Someone could help me?
> > > >
> > > > Thanks in advance!
> > > >
> > > > Maur�cio Valente
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
>
>
--- End Message ---
--- Begin Message ---
Hello Everybody,
I need a PHP program to convert Ascii values to
Decimal values.
May i get heLp from anybody?
Thank You,
- Chinmoy
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> Hello Everybody,
> I need a PHP program to convert Ascii values to
> Decimal values.
> May i get heLp from anybody?
> Thank You,
> - Chinmoy
I think you want floatval()
--
Quod subigo farinam
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Ryan A [mailto:[EMAIL PROTECTED]
> Sent: 03 June 2003 23:25
> I am getting values from a form's checkboxes
> (eg
> <input type=checkbox name='id[]' value=1>
> <input type=checkbox name='id[]' value=2>
> etc)
>
> When i get these values I want to enter them into the database but
> 1)I should enter only the first 5 (and ignore the rest) into
> the database
> 2)it has to enter 1 record for every every "id" picked
> eg:
> if id[1], id[2],id[3] and id[4] were picked it should enter this as 4
> differient records
>
>
> How do i do this? I have tried using a for loop but somewhere
> the logic is
> very very bad :-) and so i deleted the whole damn thing.
Only the values for boxes which are checked are sent, so the best way of
accessing these is with a foreach loop over the id[] array (you should also
check for no values, as then you won't even have an array at all!!). So:
if (is_array($_POST['id'])):
foreach ($_POST['id'] as $id):
// do an INSERT for the current $id
endforeach;
endif;
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
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Ed Gorski [mailto:[EMAIL PROTECTED]
> Sent: 04 June 2003 13:37
>
> You need to append the session name and id to the header
> location everytime
> you redirect that way. So your header redirect should read:
>
> header('Location:
> researchpapers2.php?'.session_name().'='.session_id());
This always puts the session id in the URL, even when cookies are enabled
and it's not needed. As I've pointed out just in the last couple of days,
the SID predefined constant is provided for just this situation, so the
above should be:
header('Location: researchpapers2.php?'.SID);
The HTTP spec also demands a full absolute URL in the Location header (and
some browsers don't seem to work properly with relative URLs), so you
*really* should have:
header('Location:
http:/your.site.name/path/to/researchpapers2.php?'.SID);
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
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: CPT John W. Holmes [mailto:[EMAIL PROTECTED]
> Sent: 04 June 2003 14:33
>
> > I've been getting a warning on one of my scripts since I
> upgraded from
> 4.1.2
> > to the most recent version of PHP. The warning is:
> >
> > Warning: setlocale(): Passing locale category name as string is
> deprecated.
> > Use the LC_* -constants instead
> >
> >
> > The script at the line that is failing sez:
> >
> > setlocale ("LC_TIME", "$locale");
>
> "LC_TIME" is a string... LC_TIME is a constant...
>
> Like the warning says, use a constant.
Also remove the quotes round $locale -- why force PHP to do the extra work of decoding
the string and *then* deciding it needs to fetch the value of $locale, when you can
just ask it to fetch the value directly?
setlocale (LC_TIME, $locale);
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
--- End Message ---
--- Begin Message ---
LS,
I am looking for a way to replace "." (=dot) to "," in a string with either
ereg_replace or preg_match . I read the manual in PHP on Pattern matching
for preg_match but could not immediately trace it.
All help appreciated.
Wim
--- End Message ---
--- Begin Message ---
> I am looking for a way to replace "." (=dot) to "," in a string with
either
> ereg_replace or preg_match . I read the manual in PHP on Pattern matching
> for preg_match but could not immediately trace it.
> All help appreciated.
If that's all you need to do, use str_replace().
---John Holmes...
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Esteban Fernandez [mailto:[EMAIL PROTECTED]
> Sent: 04 June 2003 16:09
>
> Also works... :)
>
> <?php
> $array = get_loaded_extensions();
> for ($i=0;$i<=count($array);$i++) {
> if ("gd" == $array[$i]) $installed = true;
> else $installed = false;
> }
This will only work if the "gd" entry is last in the array, as you don't exit the loop
after setting $installed to true. Plus a foreach loop would be better; and
initialising before the loop would be more efficient, too:
$installed = false;
foreach ($array as $extn):
if ("gd" == $extn):
$installed = true;
break;
endif;
endforeach;
But, even better, why not just use in_array():
$installed = in_array("gd", $array);
> if ($installed = true) echo "yeah... GD installed";
Arrgh! Firstly, this will assign true to $installed, then decide that's true (!) and
echo "yeah" -- you should have used == not =. Secondly, there is *never* any need to
use the comparison "== true" -- again that's just forcing PHP to do unnecessary work
(since the thing you're comparing to true must evaluate to true for the comparison to
succeed and return true, you can omit the comparison and just use the raw value in the
test).
> else echo "shit.. GD not installed.";
> ?>
if ($installed) echo "yeah";
else echo "nope";
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
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Svein Larsen [mailto:[EMAIL PROTECTED]
> Sent: 04 June 2003 16:22
>
> $gd_loaded = (extension_loaded('gd'))?1:0;
Well, this also fails the simple-as-possible test: if the value returned by
extension_loaded() can be used to drive the ?: operator, it must be
evaluable as a Boolean; this means you can use it directly for later use in
an if() or similar context:
$gd_loaded = extension_loaded('gd');
(And, indeed, a quick look at the manual reveals that extension_loaded
returns a bool, which is exactly what you want without any further ado.)
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
--- End Message ---
--- Begin Message ---
Thats true, but its more overhead calling a function than compare a variable.
Thats why i want to calll the function only once.
- Svein
On Thursday 05 June 2003 14:03, Ford, Mike [LSS] wrote:
> > -----Original Message-----
> > From: Svein Larsen [mailto:[EMAIL PROTECTED]
> > Sent: 04 June 2003 16:22
> >
> > $gd_loaded = (extension_loaded('gd'))?1:0;
>
> Well, this also fails the simple-as-possible test: if the value returned by
> extension_loaded() can be used to drive the ?: operator, it must be
> evaluable as a Boolean; this means you can use it directly for later use in
> an if() or similar context:
>
> $gd_loaded = extension_loaded('gd');
>
> (And, indeed, a quick look at the manual reveals that extension_loaded
> returns a bool, which is exactly what you want without any further ado.)
>
> 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
--- End Message ---
--- Begin Message ---
> > > $gd_loaded = (extension_loaded('gd'))?1:0;
> >
> > Well, this also fails the simple-as-possible test: if the value returned
by
> > extension_loaded() can be used to drive the ?: operator, it must be
> > evaluable as a Boolean; this means you can use it directly for later use
in
> > an if() or similar context:
> >
> > $gd_loaded = extension_loaded('gd');
> >
> > (And, indeed, a quick look at the manual reveals that extension_loaded
> > returns a bool, which is exactly what you want without any further ado.)
>
> Thats true, but its more overhead calling a function than compare a
variable.
> Thats why i want to calll the function only once.
Umm... the function is only called once in both examples...
---John Holmes...
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: esctoday.com | wouter van vliet [mailto:[EMAIL PROTECTED]
> Sent: 04 June 2003 16:11
>
> I'm working on quite a large website with a lot of php
> pages.. And a lot of
> includable functions (modules).. Sometimes one of those modules gets
> included twice accidently and then it generates an error ..
> of course.. This
> made me wonder of there's any way to prevent the function
> from being defined
> again..
include_once() / require_once()
> Or what I sometimes want to do is overrule a function .. the
> manual just
> told me PHP does not support this, is that really true?
Yes.
>
> And then for my last question at this moment... things like
> "print" and
> "require" are considered langauge construct and therefore
> don't need the
> parentheses .. Can I make stuff like that myself too, so I can make
> something like a function which does not use parentheses ??
Not that I can think of, no.
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
--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> Will someone ban this f***ing spam...
>
> Anyone believing this is an idiot!
>
> regards,
> Dark Angel
>
>
> -----Original Message-----
<SNIP Nigerian scam>
If you have to respond about this sort of crap, please consider deleting
the original spam so we don't have to put up with it yet again.
--
Quod subigo farinam
--- End Message ---
--- Begin Message ---
Hi All,
Just curious to know if anyone knows of a way of displaying a set of
links on a page only when that page is loaded on my local development
machine and not when it's loaded by the general internet public on my
remote host's machine?
I have several background content editing pages which would be handy to
be able to access when previewing pages locally, but which wouldn't be
applicable to the 'live' site, since the content editing pages
themselves are only available locally...
Any thoughts or suggestions very much appreciated!
Much warmth,
Murray
http://www.planetthoughtful.org
Building a thoughtful planet,
one snide comment at a time...
--- End Message ---
--- Begin Message ---
> Just curious to know if anyone knows of a way of displaying a set of
> links on a page only when that page is loaded on my local development
> machine and not when it's loaded by the general internet public on my
> remote host's machine?
>
> I have several background content editing pages which would be handy to
> be able to access when previewing pages locally, but which wouldn't be
> applicable to the 'live' site, since the content editing pages
> themselves are only available locally...
I'm sure there's something in the $_SERVER array that you could check...
---John Holmes...
--- End Message ---
--- Begin Message ---
Hi all,
I am looking into learning PHP, I have a good understanding of HTML, JS and
I know a little Perl. Firstly I know PHP is all server side and so a damn
sight different from the above, but will they help me at all?
Secondly where do I start? Are there any good on-line resources and or books
that anyone knows? I am plannig to develop an E-comm solution us Oscommerce,
does anyone know if this is any good or is naff?
Any hints, tips or pointers would be greatly appreciated.
Thanks,
Simon
--- End Message ---
--- Begin Message ---
[snip]
I am looking into learning PHP, I have a good understanding of HTML, JS
and I know a little Perl. Firstly I know PHP is all server side and so a
damn sight different from the above, but will they help me at all?
Secondly where do I start? Are there any good on-line resources and or
books that anyone knows? I am plannig to develop an E-comm solution us
Oscommerce, does anyone know if this is any good or is naff? Any hints,
tips or pointers would be greatly appreciated.
[/snip]
Google is your friend! There are tons o' tutorials out there.
Programming PHP (O'Reilly) and Core PHP (Atkinson) are two good books to
start with. Good luck!
Jay
--- End Message ---
--- Begin Message ---
www.php.net is a beauty for function reference
Your best place to start is here:
http://www.devshed.com/Server_Side/PHP/PHP101/PHP101_1/page1.html
5 tutorials on the basics, plus devshed has 100s of tutorials on everything.
"Simon Thurtle" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
> I am looking into learning PHP, I have a good understanding of HTML, JS
and
> I know a little Perl. Firstly I know PHP is all server side and so a damn
> sight different from the above, but will they help me at all?
> Secondly where do I start? Are there any good on-line resources and or
books
> that anyone knows? I am plannig to develop an E-comm solution us
Oscommerce,
> does anyone know if this is any good or is naff?
> Any hints, tips or pointers would be greatly appreciated.
>
> Thanks,
>
> Simon
>
>
>
--- End Message ---
--- Begin Message ---
Is there a way to determine the amount of memory that a script is consuming
at a certain point? Maybe a function that would return this?
The reason is, I get this:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 46080 bytes) in /home/httpd/vhosts/aaa/httpdocs/bbb/ccc/script.php
on line 20
I know why I get the error but would like to know when and why my script is
consuming so much.
Thanks!
Shawn
--- End Message ---
--- Begin Message ---
If your using an array, how big is it, what's it's dimensions?
--
Chris Edwards
Web Application Developer
Outer Banks Internet, Inc.
252-441-6698
[EMAIL PROTECTED]
http://www.OuterBanksInternet.com
----- Original Message -----
From: "Shawn McKenzie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 05, 2003 8:45 AM
Subject: [PHP] Determine memory used from script
> Is there a way to determine the amount of memory that a script is
consuming
> at a certain point? Maybe a function that would return this?
>
> The reason is, I get this:
>
> Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
> allocate 46080 bytes) in
/home/httpd/vhosts/aaa/httpdocs/bbb/ccc/script.php
> on line 20
>
> I know why I get the error but would like to know when and why my script
is
> consuming so much.
>
> Thanks!
> Shawn
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Hello,
If anyone have expamples of displaying tree structure.
Say I have array $result[x][y] with folloowing data
X Y["ID"] Y["OWNER"]
0 1 0
1 2 1
2 3 2
3 4 2
4 5 3
5 6 2
6 7 2
So, I want it displayed like
ID1
ID2
ID3
ID5
ID4
ID6
ID7
========================
Please, help I tryed to do it with recursing but failed.
There is a test function which shows that php doesnt support recursing
well:-
function parse($id){
global $result;
$idarr=getChildren($id); // thsi function return indexes of child nodes
of $id or empt array.
for ($i=0;$i<count($idarr);$i++){
echo $result[$idarr[$i]]["id"];
$id=$result[$idarr[$i]]["id"];
parse($id);
}
}
Actually it should print me only nodes which has childs, like ID1, ID2 and
ID3 but it shows everything.
getChildren-
function getChildren($id){
global $result;
$children = array();
for ($i=0;$i<count($result);$i++){
if ($id==$result[$i]["owner"]){
while ($i<count($result)){
if ($id==$result[$i]["owner"]){
array_push($children,$i);
}
else{
break;
}
$i++;
}
break;
}
}
return $children;
}
--- End Message ---
--- Begin Message ---
test
--- End Message ---
--- Begin Message ---
HAH! I love it!
-Shawn
"Evan Nemerson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Clode? I like it. Really, who wants to say "closing php tag", "terminating
php
> tag", or whatever you say. Why not start calling it a clode? What does
> everyone else think?
>
> The only issue is if a "closing php tag" (or should it be a more general
> "closing tag", with php being able to serve as a modifier when required,
ie
> "php clode") is a clode, would an "opening [php] tag" be an ode?
>
> Comments?
>
>
>
>
> On Wednesday 04 June 2003 12:47 pm, Christian Ista wrote:
> > Hello,
> >
> > Look the code below. Is it an obligation to multiply the number of <?php
> > ?>. There is no other way ? not possible to use only an open php tag
> > (<?php) and a clode php tag (?>) ?
> >
> > Christian,
> >
> >
> > <?php
> > switch($constant_lastupdate[$i][3]){
> > case '1' :?>
> > <img src="design/logo_windows.gif" alt="" width="12" height="10"
> > border="0">
> > <?php
> > break;
> > case '2' :?>
> > <img src="design/logo_mac.gif" alt="" width="10" height="10"
> > border="0"> <?php
> > break;
> > case '3' :?>
> > <img src="design/logo_linux.gif" alt="" width="9" height="11"
> > border="0">
> > <?php
> > break;
> > }
> > ?>
>
> --
> "Two hands working can do more than a thousand clasped in prayer."
>
> -Unknown
>
--- End Message ---