php-general Digest 14 Aug 2007 04:35:51 -0000 Issue 4960
Topics (messages 260766 through 260796):
Re: Generating executable code
260766 by: Tijnema
260783 by: Richard Lynch
Re: OT Re: [PHP] javascript in <head> or in <body> ?
260767 by: Daniel Brown
Re: problem in <tr>
260768 by: Jim Lucas
260792 by: Richard Lynch
260796 by: shivendra
Re: Friday morning brain farts....
260769 by: tedd
Re: phpinfo problem
260770 by: Rick Knight
260771 by: Stut
260774 by: Richard Heyes
260776 by: Lester Caine
260777 by: Richard Heyes
260778 by: Rick Knight
260779 by: Robert Cummings
260786 by: Richard Lynch
Re: PHP Books - A poll of sorts
260772 by: tedd
260773 by: tedd
260787 by: Richard Lynch
Re: Move and rename help...
260775 by: Joker7
Date Problem with \n
260780 by: Kevin Murphy
260781 by: Jim Lucas
260782 by: Richard Lynch
Re: apache content negotiation and $_GET
260784 by: Richard Lynch
Re: Server Process
260785 by: Richard Lynch
Re: very strange behavior.... incomplete query performed
260788 by: Richard Lynch
Re: PostgreSQL and select nextval
260789 by: Richard Lynch
Re: question about note on php.net
260790 by: Richard Lynch
Re: php.ini of PHP 5.2.3
260791 by: Richard Lynch
Re: Concatenation vs. Interpolation
260793 by: Richard Lynch
Re: manual vs. meta refresh
260794 by: Richard Lynch
260795 by: Kevin Murphy
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 ---
On 8/13/07, Chris Boget <[EMAIL PROTECTED]> wrote:
> Currently, I have an XML file that I load in, parse manually and iterate
> through the nodes to create objects, etc, using the node values as
> parameters. This works all well and fine but is a little resource
> intensive.
>
> Now, I can create a XSL template to transform the XML file and output
> all the PHP code that we are doing manually. However, when the
> transformation occurs, the result is pretty much just a string as far as
> PHP is concerned; it isn't executable PHP code.
>
> I know I can output the result to a temporary file then include it or I
> can pass the result to eval() to execute the code, but neither is ideal.
> Is there another way I can do what I need? Is there a way to 'include'
> (for the lack of a better term) the result of the XSL transformation
> such that PHP processes it as it would any other source code?
>
> thnx,
> Chris
>
Well, that's exactly what eval does, why isn't it ideal for you?
Tijnema
--
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
--- End Message ---
--- Begin Message ---
On Mon, August 13, 2007 8:03 am, Chris Boget wrote:
> Currently, I have an XML file that I load in, parse manually and
> iterate
> through the nodes to create objects, etc, using the node values as
> parameters. This works all well and fine but is a little resource
> intensive.
>
> Now, I can create a XSL template to transform the XML file and output
> all the PHP code that we are doing manually. However, when the
> transformation occurs, the result is pretty much just a string as far
> as
> PHP is concerned; it isn't executable PHP code.
>
> I know I can output the result to a temporary file then include it or
> I
> can pass the result to eval() to execute the code, but neither is
> ideal.
> Is there another way I can do what I need? Is there a way to
> 'include'
> (for the lack of a better term) the result of the XSL transformation
> such that PHP processes it as it would any other source code?
99.9% of the time, eval is the wrong answer.
You may have found one of the 0.1% of the times where it is the right
answer. :-)
That said, you would want to be EXTREMELY security-conscious of how
the XML is generated and read, if you are going to execute it as PHP,
regardless of whether it's via include or eval.
You wouldn't want a giant gaping hole for Bad Guys to cram random bits
of PHP source into your server to be executed, eh?
Though, I guess if you are validating the XML with an XSLT, you have a
fairly good choke-hold at that point.
Just be thinking about how else the Bad Guy could inject some PHP code
-- Perhaps as some CDATA or, if you use a /tmp/ file and include, by
replacing your /tmp/ file with their own contents.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On 8/12/07, tedd <[EMAIL PROTECTED]> wrote:
> For example, if your wife says (and you're not listening as usual)
> "Do these pants make my butt look big?" Neither answer is going to
> help much. But, if said separately, you at least have a chance of
> surviving the ordeal.
And I'll also point out that they will work in either order in
most cases - including the one Tedd gave as an example. To
demonstrate:
"Do these pants make my butt look big?"
"Yes, dear."
"WHAT?!?"
"I'm sorry!"
- or -
"Do this pants make my butt look big?"
"I'm sorry.... yes, dear."
However, note that it is NEVER alright to say one of the following:
"No, your fat ass makes it look big."
"No, but that second piece of cheesecake did."
"Hell yeah!"
"How the hell did you pull those up?"
"I didn't want to say anything, but that's why I always want to be on top."
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Hey, PHP-General list....
50% off for life on web hosting plans $10/mo. or more at
http://www.pilotpig.net/.
Use the coupon code phpgeneralaug07
Register domains for about $0.01 more than what it costs me at
http://domains.pilotpig.net/.
--- End Message ---
--- Begin Message ---
shivendra wrote:
hello friends,
i need your ehlp,actually i have a tablbe in my php page,the format is
something like this:
<table>
<tr name="t1" id="t1">
<td>monu</td><td>23</td>
</tr>
<tr name="t2" id="t2">
<td>monu</td><td>23</td>
</tr>
</table>
What i want,when i click a row like row "t1" the values of this particuler
row,i means to say the value in <td>s((monu,23) of this row is send to some
other page
similarly,when i click the row2 "t2" same function perform.pls help me its
urgent
This isn't the correct list for your question.
This is an HTML problem.
But, since most of us have to deal with HTML too when working with PHP...
you will want to use an onclick="" in the <tr>
Mind you that this will not work in IE, unless you put use a behavior script that adds onclick
ability to the <tr> tag. Here is a link to the one that I use.
http://www.cmsws.com/examples/css/behaviors/example.html
check out the guts of the file to see all that is in use
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--- End Message ---
--- Begin Message ---
On Sat, August 11, 2007 4:58 am, shivendra wrote:
>
> hello friends,
> i need your ehlp,actually i have a tablbe in my php page,the format is
> something like this:
> <table>
> <tr name="t1" id="t1">
> <td>monu</td><td>23</td>
> </tr>
> <tr name="t2" id="t2">
> <td>monu</td><td>23</td>
> </tr>
> </table>
> What i want,when i click a row like row "t1" the values of this
> particuler
> row,i means to say the value in <td>s((monu,23) of this row is send to
> some
> other page
> similarly,when i click the row2 "t2" same function perform.pls help me
> its
> urgent
You'd really be better off just wrapping the values in A link tags...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
Sir,u r not getting what i m trying to say,my problem is how can i send the
values of <td>s in a perticuler row,by a function in onClick event of that
row.actuallly the values are coming from database,and i what i want when i
click a perticuler row the values are sent to some other page:
<table>
<tr name="t1" id="t1">
<td>monu</td><td>23</td>
</tr>
<tr name="t2" id="t2">
<td>suman</td><td>24</td>
</tr>
</table>
like the values in <td>s of <tr name="t1"> is "monu" and "23" ,i want when i
click on <tr name="t1"> ,"monu" and "23" is sent to some other
page,similarly same procedure follows when i click the <tr name="t2"> but
this time the value would be "suman" and "24",i think u r getting what i m
try to say.pls send the code for this:
--
View this message in context:
http://www.nabble.com/problem-in-%3Ctr%3E-tf4253021.html#a12138652
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
At 12:10 PM +0200 8/13/07, Tijnema wrote:
On 8/13/07, tedd <[EMAIL PROTECTED]> wrote:
But, if I see this:
>
if(!isset($argv[1],$argv[2],$argv[3])))
My first thought is "Is this OR or AND"? And my second thought is "If
this is OR, then what's AND?"
Being dyslexic I'm easily confused that way (seriously, that's the
reason I never use an else-if).
Cheers,
tedd
Well, actually,
if(!isset($argv[1],$argv[2],$argv[3])))
is AND.
As it is the same as this:
if( ! ( isset($argv[1]) && isset($argv[2]) && isset($argv[3]) ) )
Which most of us write
if (!isset($argv[1]) || !isset($argv[2]) || !isset($argv[3]))
All three have the same result ;)
Could be for most of you, but that would still be a stumbling block
for me. However, I can always find a way that works.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Thanks Chris,
That was the problem. Is this new php5? I've used 3 prior php4 version
and didn't have this problem.
Thanks,
Rick
Chris wrote:
You probably just have short_open_tags set to Off in your php.ini
file. If so, either turn it On, or change the file to be:
<?php phpinfo(); ?>
Chris
Rick Knight wrote:
I have just installed PHP-5.2.3 on my Kubuntu Feisty box. I removed
all the debian php first and then compiled php with the options I
needed. Now everything seems to be working except phpinfo.php which
consists of one line.
<? phpinfo(); ?>
I get a blank screen.
If I delete the php.ini file it get the usual phpinfo output.
php -r "phpinfo();" works as does php -i and my php scripts run fine.
What would cause phpinfo.php to not work? It's set rw for the apache2
user so I think the permissions are right. Is there a phpinfo
enable/disable in the php.ini? Or in ./configure?
Thanks.
Rick Knight
--- End Message ---
--- Begin Message ---
Rick Knight wrote:
Thanks Chris,
That was the problem. Is this new php5? I've used 3 prior php4 version
and didn't have this problem.
The default value for short_open_tags was flipped a while back. Might I
suggest you read the changelog next time you upgrade to a newer version
- it tells you important stuff like that.
-Stut
--
http://stut.net/
Chris wrote:
You probably just have short_open_tags set to Off in your php.ini
file. If so, either turn it On, or change the file to be:
<?php phpinfo(); ?>
Chris
Rick Knight wrote:
I have just installed PHP-5.2.3 on my Kubuntu Feisty box. I removed
all the debian php first and then compiled php with the options I
needed. Now everything seems to be working except phpinfo.php which
consists of one line.
<? phpinfo(); ?>
I get a blank screen.
If I delete the php.ini file it get the usual phpinfo output.
php -r "phpinfo();" works as does php -i and my php scripts run fine.
What would cause phpinfo.php to not work? It's set rw for the apache2
user so I think the permissions are right. Is there a phpinfo
enable/disable in the php.ini? Or in ./configure?
Thanks.
Rick Knight
--- End Message ---
--- Begin Message ---
The default value for short_open_tags was flipped a while back. Might I
suggest you read the changelog next time you upgrade to a newer version
- it tells you important stuff like that.
And, FWIW, never use short tags. Always use <?php
--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software
that can cut the cost of online support
--- End Message ---
--- Begin Message ---
Stut wrote:
Rick Knight wrote:
Thanks Chris,
That was the problem. Is this new php5? I've used 3 prior php4 version
and didn't have this problem.
The default value for short_open_tags was flipped a while back. Might I
suggest you read the changelog next time you upgrade to a newer version
- it tells you important stuff like that.
The problem people will have is having to go through ALL the PHP5 changes when
converting from PHP4. That particular one adds a lot of characters to files on
some PHP4 upgrades, where there are lots of <? ?> - so switching it is the
quicker fix.
--
Lester Caine - G8HFL
-----------------------------
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird - http://www.firebirdsql.org/index.php
--- End Message ---
--- Begin Message ---
The default value for short_open_tags was flipped a while back. Might
I suggest you read the changelog next time you upgrade to a newer
version - it tells you important stuff like that.
The problem people will have is having to go through ALL the PHP5
changes when converting from PHP4.
Why is that a problem? I would have thought that that is automatic.
Surely you're not suggesting that people are upgrading from PHP4 to PHP5
without exhaustive testing?
> That particular one adds a lot of
characters to files on some PHP4 upgrades, where there are lots of <? ?>
- so switching it is the quicker fix.
^ on ?
--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk
Knowledge Base and HelpDesk software
that can cut the cost of online support
--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
The default value for short_open_tags was flipped a while back.
Might I suggest you read the changelog next time you upgrade to a
newer version - it tells you important stuff like that.
The problem people will have is having to go through ALL the PHP5
changes when converting from PHP4.
Why is that a problem? I would have thought that that is automatic.
Surely you're not suggesting that people are upgrading from PHP4 to
PHP5 without exhaustive testing?
> That particular one adds a lot of
characters to files on some PHP4 upgrades, where there are lots of <?
?> - so switching it is the quicker fix.
^ on ?
Most of my tags are the long type, justa very, very few that are not,
but I have turned short tag support on.
Also, this was not a planned upgrade. I run Slackware 9.0, PHP4 & MySQL4
on my server, Kubuntu on my workstations. Debian has dropped support for
MySQL 4. I needed to add mysql 4 to my workstation (to solve a server
problem) and found that the mysql4 binary was not compatible with the
debian packaged php5 so I had to remove that and install php5 from
source. Kind of a domino effect. I do much more reading and testing when
do a planned upgrade, I just didn't have the time this time.
Thanks,
Rick
--- End Message ---
--- Begin Message ---
On Mon, 2007-08-13 at 17:07 +0100, Lester Caine wrote:
> Stut wrote:
> > Rick Knight wrote:
> >> Thanks Chris,
> >>
> >> That was the problem. Is this new php5? I've used 3 prior php4 version
> >> and didn't have this problem.
> >
> > The default value for short_open_tags was flipped a while back. Might I
> > suggest you read the changelog next time you upgrade to a newer version
> > - it tells you important stuff like that.
>
> The problem people will have is having to go through ALL the PHP5 changes
> when
> converting from PHP4. That particular one adds a lot of characters to files
> on
> some PHP4 upgrades, where there are lots of <? ?> - so switching it is the
> quicker fix.
Sure it's quicker. But search and replace is pretty damn fast too. Not
to mention future proof.
Cheers,
Rob.
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
--- End Message ---
--- Begin Message ---
On Sun, August 12, 2007 10:32 pm, Rick Knight wrote:
> I have just installed PHP-5.2.3 on my Kubuntu Feisty box. I removed
> all
> the debian php first and then compiled php with the options I needed.
> Now everything seems to be working except phpinfo.php which consists
> of
> one line.
>
> <? phpinfo(); ?>
>
>
> I get a blank screen.
>
> If I delete the php.ini file it get the usual phpinfo output.
>
> php -r "phpinfo();" works as does php -i and my php scripts run fine.
> What would cause phpinfo.php to not work? It's set rw for the apache2
> user so I think the permissions are right. Is there a phpinfo
> enable/disable in the php.ini? Or in ./configure?
You probably have short_open_tags OFF and so you need <?php
phpinfo();?> instead of just <? ... ?>
You'd know for sure if you looked at "View Source" and saw <?
phpinfo();?> for the short-tag version, but the <?php version worked.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
At 8:52 PM -0500 8/12/07, Jay Blanchard wrote:
Evening all! (at least it is evening here in Texas)
We all have our favorite PHP books and resources but there is one tome
that seems to be missing from the group...a "best practices" book. We
all have our preferences for what we call best practices and it seems at
this stage in the life of PHP that there would be a guide to the best of
the best.
I am not talking about the holy wars here (like bracket placement) I am
talking about things like testing variable in conditional situations or
the proper use of constructors or ways to leverage the power of PHP with
databases.
If there was a best practices book would you buy it? (I am showing
complete disregard for the thread on copyright infringement v. theft.)
Or do you rely on other sources like this list, articles, etc to derive
your own set of practices? Thanks for indulging me.
Thanks
Jay
Jay:
That might be a good subject, but I find that "best practices" is a
moving target. By the time you finish the book, some of your "best
practices" will be "old practices".
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
At 8:06 PM -0700 8/12/07, Janet Valade wrote:
Jay Blanchard wrote:
If there was a best practices book would you buy it?
I would buy it. But, I buy tons of books.
Janet
Same here.
In college, if I didn't have time to read something I Xeroxed it --
now I just buy the book. :-)
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Sun, August 12, 2007 8:52 pm, Jay Blanchard wrote:
> Evening all! (at least it is evening here in Texas)
>
> We all have our favorite PHP books and resources but there is one tome
> that seems to be missing from the group...a "best practices" book. We
> all have our preferences for what we call best practices and it seems
> at
> this stage in the life of PHP that there would be a guide to the best
> of
> the best.
>
> I am not talking about the holy wars here (like bracket placement) I
> am
> talking about things like testing variable in conditional situations
> or
> the proper use of constructors or ways to leverage the power of PHP
> with
> databases.
>
> If there was a best practices book would you buy it? (I am showing
> complete disregard for the thread on copyright infringement v. theft.)
> Or do you rely on other sources like this list, articles, etc to
> derive
> your own set of practices? Thanks for indulging me.
I personally would not buy it.
But I suppose it might sell as well as any of the other zillion PHP
books.
But you'd have a heck of a time getting even a large minority of PHP
developers to agree on "best practices" for an lot of stuff...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
In news: [EMAIL PROTECTED] - "Joker7" wrote :
>> Hi All-seeing All-knowing Ones :)
Thanks for all the suggestion I will have a play and see where it leads.
It's for a time stamp picture from a cam I wish to keep the time stamp ones
but use the newest one for a web-cam photo on a site.
Chris
--
Cheap As Chips Broadband http://yeah.kick-butt.co.uk
Superb hosting & domain name deals http://host.kick-butt.co.uk
--- End Message ---
--- Begin Message ---
Small issue with formatting a date. If I type in this:
echo date("g:i:s a \o\n l F j, Y");
the "n" character in the word "on" doesn't appear, but instead what I
get is a new line in the source code. If I type it as:
echo date("g:i:s a \on l F j, Y");
I get the number 8 (current month) where the n is supposed to be.
Is there any way to get an "n" in there?
--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada College
www.wnc.edu
775-445-3326
P.S. Please note that my e-mail and website address have changed from
wncc.edu to wnc.edu.
--- End Message ---
--- Begin Message ---
Kevin Murphy wrote:
Small issue with formatting a date. If I type in this:
echo date("g:i:s a \o\n l F j, Y");
the "n" character in the word "on" doesn't appear, but instead what I
get is a new line in the source code. If I type it as:
echo date("g:i:s a \on l F j, Y");
I get the number 8 (current month) where the n is supposed to be.
Is there any way to get an "n" in there?
Use single quotes, then your \n will not be converted to a NL char
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--- End Message ---
--- Begin Message ---
On Mon, August 13, 2007 12:50 pm, Kevin Murphy wrote:
> Small issue with formatting a date. If I type in this:
>
> echo date("g:i:s a \o\n l F j, Y");
>
> the "n" character in the word "on" doesn't appear, but instead what I
> get is a new line in the source code. If I type it as:
>
> echo date("g:i:s a \on l F j, Y");
>
> I get the number 8 (current month) where the n is supposed to be.
>
> Is there any way to get an "n" in there?
As noted, apostrophes will work in this case.
If you need to embed a variable, however, you may want to re-read this
from the manual a couple times:
"You can prevent a recognized character in the format string from
being expanded by escaping it with a preceding backslash. If the
character with a backslash is already a special sequence, you may need
to also escape the backslash."
So, for example:
date("g:i:s a \o\\n l F j, Y");
Here's what happens:
PHP's string parser "eats" the "\\" and turns it into a single
back-slash: "\"
*THEN* you have "\n" being passed to the C date() function, which then
"eats" the "\n" and says:
This is then not the "n" for "Numeric representation of a month,
without leading zeros" but just a regular old "n" as text.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Mon, August 13, 2007 4:45 am, Per Jessen wrote:
> I've got a weird issue concerning $_GET and apaches content
> negotiation.
>
> situation one:
>
> files in htdocs/:
>
> phpinfo.phtml.en (all it does is call phpinfo()).
> phpinfo.html - apache type-map
>
> if I load URL = https://server/phpinfo?klop=99, I see no _GET
> variables
> listed. (with the URL, apache will pick the phpinfo.html file, treat
> it as a type-map and load phpinfo.phtml.en)
>
> if instead I skip the content negotation, and use URL =
> https://server/phpinfo.phtml.en?klop=99, the $_GET variable is
> available.
>
> Any suggestions?
PHP pretty much just blindly passes on whatever is in the REQUEST_URI
into $_GET.
So the GET data isn't surviving the type-map forwarding.
So your question boils down to:
Why isn't Apache's type-map propagating the GET arguments?
This question has no PHP in it; You'll probably find the answer
faster/better in an Apache milieu.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Mon, August 13, 2007 4:37 am, Nathan Wallis wrote:
> Just a follow up to my post about running an application server side
> and the
> introduction of sockets.
>
> My application is really just to modify a series of images on the
> server and
> combine them into a collage of images as a single file name. So I
> just say
> go and wait for it to build the final file, then it is done.
>
> So in this case are sockets an advantage? I really just want to start
> the
> application and let it go, without transferring data back and forth
> between
> PHP and the app.
>
> Any more help would be great.
Who is doing the waiting, and when, and just how long will they need
to wait?...
I suspect you are over-engineering this, and could just write a single
script to do the collaging and not even have it ever be in a file.
<img src="collage.php" />
<?php
//collage.php
//something not unlike this:
$files = array('1.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg');
$image = imagecreatetruecolor(600, 400);
reset($files);
for ($column = 0; $column < 3; $column++){
for ($row = 0; $row < 2; $row++){
$img = imagecreatefromjpg('/full/path/to/images/' . next($files));
imagecopyresampled($image, $img, $column * 200, $row * 200, 0,
0, 200, 200, imagesx($img), imagesy($img));
}
}
header("Content-type: image/jpeg");
imagejpeg($image);
?>
We can't really tell you if you should use a daemon, a cache, or
whatever, unless you tell us more about the Big Picture of your
application.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
Are you using E_ALL?
Any error messages?
My first suspect is you are hitting php.ini time_limit setting, or
possibly the memory_limit.
On Sun, August 12, 2007 7:09 am, Alain Roger wrote:
> Hi,
>
> I'm still working on importing CSV file content (20.000 records) to
> database
> PostgreSQL.
>
> when i run the query, once i stored into my table 5218 records,
> another
> time 5231 another time 4713 and so on....
> every time the amount of records imported to DB is different.
>
> Do you have any idea from where it could come ?
>
> Here is my PHP code :
>
>> while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
>> {
>> $num = count($data);
>>
>> if($row>1)
>> {
>>
>> $charsetIN ='windows-1250';
>> $charsetOUT = 'UTF-8';
>>
>> $publisher = iconv($charsetIN, $charsetOUT,
>> $data[0]);
>> $program = iconv($charsetIN,
>> $charsetOUT,
>> $data[1]);
>> $version = iconv($charsetIN,
>> $charsetOUT,
>> $data[2]);
>> $path = iconv($charsetIN,
>> $charsetOUT, $data[4]);
>> $path =
>> str_replace("\\","\\\\",$path);
>> $licensing_file = iconv($charsetIN, $charsetOUT,
>> $data[5]);
>> $barcode = iconv($charsetIN,
>> $charsetOUT,
>> $data[6]);
>> $pcinfo_id = iconv($charsetIN,
>> $charsetOUT,
>> $data[8]);
>>
>> $date_audit = iconv($charsetIN,
>> $charsetOUT,
>> trim(str_replace(" ","",$data[11])));
>>
>> $locality = iconv($charsetIN,
>> $charsetOUT,
>> $data[13]);
>> $area = iconv($charsetIN,
>> $charsetOUT, $data[12]);
>> $username = iconv($charsetIN,
>> $charsetOUT,
>> $data[14]);
>> $personal_number = iconv($charsetIN, $charsetOUT,
>> $data[15]);
>>
>>
>> $result = pg_query($dbconn,"set search_path = sw_audit;");
>> echo "result (set search_path) = ".$result."<br/><br/>";
>> $res=pg_query("SELECT nextval('tmp_importedxls_rec_id_seq')
>> as
>> key");
>> $row=pg_fetch_array($res, 0);
>> $key=$row['key'];
>>
>> $sql = "INSERT INTO tmp_importedxls (rec_id, publisher,
>> program,
>> version, path, licensing_file, date_audit, barcode, pcinfo_ident,
>> area,
>> locality, users, personal_number)
>> VALUES ($key,
>> '$publisher',
>> '$program',
>> '$version',
>> '$path',
>>
>> '$licensing_file','".SplitDate(".",$date_audit)."',
>> '$barcode',
>> '$pcinfo_id',
>> '$area',
>> '$locality',
>> '$username',
>> '$personal_number');";
>>
>> //echo "SQL : " .$sql."<br/><br/>";
>>
>> $result = pg_query($dbconn,$sql);
>> if (!$result)
>> {
>> die("Error in SQL query: " . pg_last_error());
>> }
>> else
>> {
>> echo "result (INSERT INTO) = ".$result."<br />";
>> }
>>
>> }
>> $row++;
>> }
>> fclose($handle);
>>
>> pg_close($dbconn);
>
>
>
> thanks a lot for any help.
>
>
> --
> Alain
> ------------------------------------
> Windows XP SP2
> PostgreSQL 8.2.3
> Apache 2.2.4
> PHP 5.2.3
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Sun, August 12, 2007 2:35 am, Alain Roger wrote:
> I'm getting an error message when i run the following SQL request :
> $sql = "INSERT INTO tmp_importedxls (rec_id, publisher) VALUES (SELECT
> nextval('tmp_importedxls_rec_id_seq'),'$pb')";
>
> Error in SQL query: ERROR: syntax error at or near "SELECT" LINE 2:
> VALUES
> (SELECT nextval('tmp_importedxls_rec_id_seq'),' ^
>
> I have the feeling that we can not use the select nextval(...) SQL
> request
> in an INSERT INTO one under PHP.
> Is it true?
No.
PHP doesn't care diddly-squat what is in your query -- It just sends
it to PostgreSQL.
The query you have written just plain won't work in PostgreSQL, period.
Try it in the psql monitor.
OT:
Almost for sure, you just need to strip out the "VALUES (" bit and the
closing paren for it.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Sat, August 11, 2007 1:54 pm, Michael Cooper wrote:
> Hello, I have a question--is the note from equazcion here correct? It
> is left unchallenged on the page but I can't see how it is correct
> since I am under the impression that the environment is refreshed each
> page load and the function or method definitions (including those for
> session_set_save_handler) would need to be re-established each page,
> not each session. I am having tremendous difficulty debugging some
> code I wrote and eliminating my uncertainty regarding this point would
> be greatly helpful. Any advice would be appreciated. Thanks!
If I could remember/find the URL to login, I could delete that bogus
note...
It's about as wrong as it gets.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
OpenSSL has a secondary dependency on libeay or whatever it is.
PHP might *think* it has OpenSSL, but until OpenSSL can also load in
the libeay thingie, it ain't gonna work.
It can be confusing, especially when the error log shows something
about openssl but doesn't say what openssl is missing, and folks think
it's still missing openssl itself, when it's really missing libeay.
On Sat, August 11, 2007 6:02 am, Alain Roger wrote:
> I've discovered that when i type "php -m", openssl is already loaded
> as
> module.
> It seems that PHP 5.2.3 was compiled with "--with-openssl" command.
>
> So, why modules with which ones PHP has been compiled do not appear in
> the
> phpinfo() report ?
>
> thanks a lot,
>
> Al.
>
> On 8/11/07, Stut <[EMAIL PROTECTED]> wrote:
>>
>> Alain Roger wrote:
>> > I have a stupid problem.
>> > At work i installed the PHP 5.2.1 and it works fine.
>> > i uncomment extension = php_opensll and i see that extension is
>> activated
>> > because phpinfo show me information about such extension.
>> >
>> > However, at homw i've just installed PHP 5.2.3 and i did the same
>> as at
>> work
>> > but i'm not able to get any table information about openssl via
>> phpinfo();
>> > function.
>> >
>> > could you help me please ?
>>
>> OpenSSL requires a DLL file to be in the path on Windows. From the
>> manual page (http://php.net/openssl)...
>>
>> "Note to Win32 Users: In order for this extension to work, there
>> are
>> DLL files that must be available to the Windows system PATH. See the
>> FAQ
>> titled "How do I add my PHP directory to the PATH on Windows" for
>> information on how to do this. Although copying DLL files from the
>> PHP
>> folder into the Windows system directory also works (because the
>> system
>> directory is by default in the systems PATH), it is not recommended.
>> This extension requires the following files to be in the PATH:
>> libeay32.dll"
>>
>> -Stut
>>
>> --
>> http://stut.net/
>>
>
>
>
> --
> Alain
> ------------------------------------
> Windows XP SP2
> PostgreSQL 8.2.3
> Apache 2.2.4
> PHP 5.2.3
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Sat, August 11, 2007 2:21 am, AmirBehzad Eslami wrote:
> I know that the performance here is not very much, but is it
> considerable in a high-traffic website?
It's almost for sure meaningless in any real-world website.
Use "valgrind callgrind" to find your real bottlenecks, and focus on
those instead of wasting your time optimizing meaningless snippets of
code.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Sat, August 11, 2007 9:39 pm, Robert Cummings wrote:
> On Sat, 2007-08-11 at 19:36 -0700, Geoff Nicol wrote:
>> Rob,
>>
>> What you suggested, which matches the theory of what I and others
>> suggested, would certainly work as an ID that changes is involved.
>>
>> If you read the specific posting by Richard Lynch, which is what I
>> was
>> replying to, you will note he suggest refreshing to a static
>> 'was_meta_refresh_before' link which of course won't work as
>> refreshing manually at that point will be indistinguishable from a
>> true meta-refresh after the redirect has occurred.
>>
>> Anyways; this thread seems done, there are several solid suggestions
>> on how to do it properly.
>>
>> I just didn't want it to close on an incomplete solution, as people
>> apparently don't read the thread history ;)
>
> Ah ok, I see what you're saying. Yeah, Richard must have missed that
> you
> can't just redirect to a URL and all is well.
Actually, Richard was thinking that you MIGHT be able to do whatever
you need to do in the "forwarding" script...
If you're just logging the fact that the user got the refresh, or
updating something somewhere, for example.
If the actual output to the user needs to be different based on META
versus RELOAD, then, yeah, I was wrong, and you'll need a counter or
something...
Of course, the question of whether it's a Good Idea to show something
different for a manual Refresh versus META refresh springs to mind...
I can't see why you'd want to do this for anything other than
educational purposes...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--- End Message ---
--- Begin Message ---
On Aug 13, 2007, at 2:16 PM, Richard Lynch wrote:
Of course, the question of whether it's a Good Idea to show something
different for a manual Refresh versus META refresh springs to mind...
I can't see why you'd want to do this for anything other than
educational purposes...
Well, as the OP, I can first tell you all that I don't actually need
to do this anymore quite like this. Basically, what I was trying to
accomplish was that I have an application that has access to
sensitive student data (like grades and stuff), and I wanted to write
it so that it would log you out and display a different screen after
a specified period of time.... just in case the instructor walked
away from their computer we didn't want it displaying whatever the
instructor was last looking at forever.
So what I was doing was refreshing the page every 31 minutes and
comparing with the last time the page was accessed (set via a session
variable), and if longer than 30 minutes, it would log you out and
show you a login form rather than the page you were looking at. The
problem came in the fact that if you had 2 windows open
simultaneously, the PHP couldn't tell if it was the background window
or the front window doing the loading, so therefore it would never
log you our.
The solution, which came to me from some of the early comments, was
to create a new page that the META refresh sent to (logout.php) and
then anytime you hit that page, it logs you out. So if the background
or foreground window now refreshes and gets sent to that page.
Thanks everyone for their help on this.
--
Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada College
www.wnc.edu
775-445-3326
P.S. Please note that my e-mail and website address have changed from
wncc.edu to wnc.edu.
--- End Message ---