php-general Digest 10 Aug 2005 05:58:22 -0000 Issue 3616
Topics (messages 220292 through 220322):
Re: blank page with PHP
220292 by: Bruce Gilbert
220293 by: Bruce Gilbert
220294 by: Sabine
Re: Generating a 404 status message with header()
220295 by: Jasper Bryant-Greene
220298 by: Sebastian
220310 by: Jasper Bryant-Greene
Re: PHP error tracking on new server
220296 by: Lawrence Kennon
select * from...
220297 by: afan.afan.net
220299 by: tg-php.gryffyndevelopment.com
php output to string
220300 by: Jesús Fernández
220302 by: Cafer Simsek
220303 by: Jesús Fernández
220304 by: Cafer ÅimÅek
220305 by: Jesús Fernández
220306 by: Cafer ÅimÅek
220308 by: Jesús Fernández
graph - dowloads/hr
220301 by: Sebastian
220309 by: Philip Hallstrom
220311 by: Sebastian
220317 by: Philip Hallstrom
Insert one or many chekbox values in a db mysql
220307 by: Jesús Alain Rodríguez Santos
Server-Client connection via TCP port with PHP
220312 by: Eli
220313 by: Richard Davey
220316 by: Marco Tabini
Problem detecting HTTPS connection
220314 by: Wee Keat
220315 by: Marco Tabini
220318 by: Wee Keat
220319 by: Marco Tabini
220320 by: Wee Keat
N/A
220321 by: R. Ragunathan
220322 by: Jasper Bryant-Greene
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 ---
I guess this would help. The URL to my PHP config is
http://www.wealthdevelopmentmortgage.com/test/form_test/info.php
--
::Bruce::
--- End Message ---
--- Begin Message ---
I have a form which displays fine with html, but when I add the php
thew page is blank. I am re-using code which I have on another form so
I know it works. I was wondering if there might be something in the
PHP confuration which may be preventing the page from displaying. IE
error reporting .
Can someone take a look at my configuration settings and see if there
may be something to cause this? Of course there may be something I
missed in the code as weel, but it the past I always got some sort of
error, not just a blank page.
thanks,
--
::Bruce::
--- End Message ---
--- Begin Message ---
Hi Bruce,
the error_reporting level in your php.ini is set to 81, that means only
a few sorts of errors will be shown on your site. Even parse-errors are
hidden.
But you can set it to a different level in your script.
Have a look at error_reporting in the manual.
Best regards
Sabine
Bruce Gilbert schrieb:
I guess this would help. The URL to my PHP config is
http://www.wealthdevelopmentmortgage.com/test/form_test/info.php
--- End Message ---
--- Begin Message ---
Sebastian wrote:
Paul Waring wrote:
On Mon, Aug 08, 2005 at 04:37:12PM -0400, Eric Gorr wrote:
Should it? Is it possible to write a doesexists.php script which
would cause the 404 directive to be triggered?
I also tried: header("Status: 404 Not Found"); but this did not work
either.
Try searching the archives for this list, I'm sure this question, or one
very similar to it, was asked and answered fairly recently.
Paul
header('HTTP/1.0 404 Not Found');
I'm afraid you missed the original point of the question. His problem
was that Apache does not display the ErrorDocument if PHP sends a 404
status header.
This behaviour is by design (Apache checks to see if the PHP script
handling the request exists; it does, so Apache does not display the
ErrorDocument)
What I would recommend is to send the 404 header and then include() the
ErrorDocument as specified in Apache's config.
Jasper
--- End Message ---
--- Begin Message ---
Jasper Bryant-Greene wrote:
Sebastian wrote:
Paul Waring wrote:
On Mon, Aug 08, 2005 at 04:37:12PM -0400, Eric Gorr wrote:
Should it? Is it possible to write a doesexists.php script which
would cause the 404 directive to be triggered?
I also tried: header("Status: 404 Not Found"); but this did not
work either.
Try searching the archives for this list, I'm sure this question, or
one
very similar to it, was asked and answered fairly recently.
Paul
header('HTTP/1.0 404 Not Found');
I'm afraid you missed the original point of the question. His problem
was that Apache does not display the ErrorDocument if PHP sends a 404
status header.
This behaviour is by design (Apache checks to see if the PHP script
handling the request exists; it does, so Apache does not display the
ErrorDocument)
What I would recommend is to send the 404 header and then include()
the ErrorDocument as specified in Apache's config.
Jasper
yeah sorry, i must of deleted the original topic and all i had was the
followups..
anyway, what do you want, the cake and eat it too?
why two types of 404's?
i mean you either use ErrorDocument or use php headers..
i guess i dont understand why use both..
to send 404 header and then display a custom document you might as well
use the ErrorDocument in apache, it would be the same affect.
might as well set ErrorDocument in apache to point to a php file and do
whatever you want in the php script.. like send more 404 headers..
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.4/66 - Release Date: 8/9/2005
--- End Message ---
--- Begin Message ---
Sebastian wrote:
yeah sorry, i must of deleted the original topic and all i had was the
followups..
anyway, what do you want, the cake and eat it too?
why two types of 404's?
i mean you either use ErrorDocument or use php headers..
i guess i dont understand why use both..
to send 404 header and then display a custom document you might as well
use the ErrorDocument in apache, it would be the same affect.
might as well set ErrorDocument in apache to point to a php file and do
whatever you want in the php script.. like send more 404 headers..
Because Apache's ErrorDocument will only handle the case when the PHP
script (or other file) that is being called doesn't exist in the filesystem.
However, if, for example, your PHP file retrieves records from a
database based on the querystring passed to it, and returns a 404 Not
Found error when the requested record doesn't exist in the DB, Apache
will not automatically display the ErrorDocument. So my suggestion is
simply to include() it in that case.
Jasper
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Terry Romine" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, August 07, 2005 10:03 AM
Subject: [PHP] PHP error tracking on new server
... The problem is that when an error occurs, the page just comes up
blank,
Does your hosting service give you access to the PHP error log? Mine lists
it under "CGI Errors" or something like that, but I can go to a web page and
refresh it and see my PHP errors.
lk
--- End Message ---
--- Begin Message ---
Hi to all,
It's more mysql question than php, but I like you more than mysql guys! :)
Let's say I have a table called "orders" and other table called
"special_orders_instructions".
Logically, one column in "orders" table should be link to
"special_order_instructions" (foreign key ?) and if that one is checked
go and grab special instructions after order_id.
But, since "orders" table doesn't have such a column (and I CANNOT add
it - long story...) I have to check for every order does that order_id
exists in "special_order_instructions" table. And, if yes - print.
Table "special_order_instructions" has about 25 columns and I have to
show EVERY ONE. Means, have to use
select * from special_order_instructions...
But, just to check does such an order have any special instruction
$query = mysql_query("select * from special_order_instructions...");
is bad idea. It would be "more" correct
$query = mysql_query("select spec_inst_id from
special_order_instructions...");
and then
if (mysql_num_rows($query) > 0)
{
// Show instructions
}
Does this make a sense:
$query = mysql_query("select spec_inst_id from
special_order_instructions...");
if (mysql_num_rows($query) > 0)
{
$query = mysql_query("select * from special_order_instructions...");
while( ... )
{
// show instructions here...
}
}
Thanks for any help!
-afan
--- End Message ---
--- Begin Message ---
Sounds like you want to do an inner(?) join on the two tables. This will show
you where you have matches between the two tables but also show you the items
that don't match (no special instructions). If I understand right, you have an
"order_id" in both "orders" and "special_orders_instructions" right? You can
just link on that without needed to add any special columns. Try something
like this:
SELECT o.order_id, o.otherordercolumn, soi.order_id,j
soi.otherinstructioncolumns
FROM orders AS o LEFT JOIN special_orders_instructions AS soi ON o.order_id =
soi.order_id
Then in PHP just check to see if soi.order_id is blank or not. If it is,
there's no special orders to be found. If it's not blank, then check out the
SOI variables.
Hope that helped a little. Forgive any typos... wanted to respond quick so I
could go home. :)
-TG
= = = Original message = = =
Hi to all,
It's more mysql question than php, but I like you more than mysql guys! :)
Let's say I have a table called "orders" and other table called
"special_orders_instructions".
Logically, one column in "orders" table should be link to
"special_order_instructions" (foreign key ?) and if that one is checked
go and grab special instructions after order_id.
But, since "orders" table doesn't have such a column (and I CANNOT add
it - long story...) I have to check for every order does that order_id
exists in "special_order_instructions" table. And, if yes - print.
Table "special_order_instructions" has about 25 columns and I have to
show EVERY ONE. Means, have to use
select * from special_order_instructions...
But, just to check does such an order have any special instruction
$query = mysql_query("select * from special_order_instructions...");
is bad idea. It would be "more" correct
$query = mysql_query("select spec_inst_id from
special_order_instructions...");
and then
if (mysql_num_rows($query) > 0)
// Show instructions
Does this make a sense:
$query = mysql_query("select spec_inst_id from
special_order_instructions...");
if (mysql_num_rows($query) > 0)
$query = mysql_query("select * from special_order_instructions...");
while( ... )
// show instructions here...
Thanks for any help!
-afan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--- End Message ---
--- Begin Message ---
Hi there,
i'm a little newbie you know.
I have a php that returns some xml, and i want to parse that xml through
php. the xml returned depends on the variable passed thru the url. what i
need is to get the output of that php file and store it in a string. i have
tried everything i have though, readfile, include, file_get_contents even
eval. also i have tried with ob_start and so. but no luck.
how can i do this?
thanks
--- End Message ---
--- Begin Message ---
Hi,
You may make it with fopen() like that;
$fd = fopen($url, "r");
$returnString = ""
while (!feof($fd)) {
$returnString .= fgets($fd);
}
fclose($fd);
Jesús Fernández <[EMAIL PROTECTED]> writes:
> Hi there,
> i'm a little newbie you know.
> I have a php that returns some xml, and i want to parse that xml through
> php. the xml returned depends on the variable passed thru the url. what i
> need is to get the output of that php file and store it in a string. i have
> tried everything i have though, readfile, include, file_get_contents even
> eval. also i have tried with ob_start and so. but no luck.
>
> how can i do this?
> thanks
--
Cafer Simsek
http://cafer.org
--- End Message ---
--- Begin Message ---
thanks, it works, but that returns the php code.
what i actually need is the output of that php code evaluated.
--
"El único error real es aquel en el que no hemos aprendido nada."
--- End Message ---
--- Begin Message ---
Ok,
Has the remote machine configured to run the php? So, the remote
machine is your $url variable's host.
Or, you may try browse the URL via any browser (etc; IE, Firefox). If
you see the PHP codes, the remote machine has not been configured to
run PHP.
Jesús Fernández <[EMAIL PROTECTED]> writes:
> thanks, it works, but that returns the php code.
> what i actually need is the output of that php code evaluated.
>
> --
> "El nico error real es aquel en el que no hemos aprendido nada."
--
Cafer Şimşek
http://cafer.org
--- End Message ---
--- Begin Message ---
yes, the remote machine runs php (its my hosting's server)
--
"El único error real es aquel en el que no hemos aprendido nada."
--- End Message ---
--- Begin Message ---
Your $url variable's content like what?
So, if you using like ftp://foo.bar.... it's the generally normal that
you see the codes.
If not, would you like to give me the $url's content?
(Sorry for my bad English)
Jesús Fernández <[EMAIL PROTECTED]> writes:
> yes, the remote machine runs php (its my hosting's server)
>
> --
> "El nico error real es aquel en el que no hemos aprendido nada."
--
Cafer Şimşek
http://cafer.org
--- End Message ---
--- Begin Message ---
well, i found a little problem with this.
when $url looks like "http://myhosting/xml.php" and i upload it to my
hosting, it times out before getting the content.
that php needs includes and when i try $url="/dir/xml.php" it gives me a not
found error. the file it doesnt find is one of those includes.
ps: im not english either ;)
--
"El único error real es aquel en el que no hemos aprendido nada."
--- End Message ---
--- Begin Message ---
i'd like to create a graph with the amount of downloads per hour, i am a
little confused how i should go about this.
i know i can use rrdtool/mrtg, but im looking for more 'user friendly'
graphs with custom colors,etc.
each time someone downloads a file it is incremented in the db and the
last time the file was downloaded. i am unsure about the data i would
need to store to create and if what i am storing is enough to do this.
any suggestions or tools that already exists to create this types of graph?
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.4/66 - Release Date: 8/9/2005
--- End Message ---
--- Begin Message ---
i'd like to create a graph with the amount of downloads per hour, i am a
little confused how i should go about this.
i know i can use rrdtool/mrtg, but im looking for more 'user friendly' graphs
with custom colors,etc.
each time someone downloads a file it is incremented in the db and the last
time the file was downloaded. i am unsure about the data i would need to
store to create and if what i am storing is enough to do this. any
suggestions or tools that already exists to create this types of graph?
jpgraph can do it... as can a lot of other graph/chart libraries...
http://www.aditus.nu/jpgraph/
--- End Message ---
--- Begin Message ---
Philip Hallstrom wrote:
i'd like to create a graph with the amount of downloads per hour, i
am a little confused how i should go about this.
i know i can use rrdtool/mrtg, but im looking for more 'user
friendly' graphs with custom colors,etc.
each time someone downloads a file it is incremented in the db and
the last time the file was downloaded. i am unsure about the data i
would need to store to create and if what i am storing is enough to
do this. any suggestions or tools that already exists to create this
types of graph?
jpgraph can do it... as can a lot of other graph/chart libraries...
http://www.aditus.nu/jpgraph/
yeah, i found that, but i dont know what type of data i would need to
store to get the downloads an hour (24 hours).
likewise, i only increment a counter and last time file was download and
im pretty sure this isn't enough to generate such graphs.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.4/66 - Release Date: 8/9/2005
--- End Message ---
--- Begin Message ---
i'd like to create a graph with the amount of downloads per hour, i am a
little confused how i should go about this.
i know i can use rrdtool/mrtg, but im looking for more 'user friendly'
graphs with custom colors,etc.
each time someone downloads a file it is incremented in the db and the
last time the file was downloaded. i am unsure about the data i would need
to store to create and if what i am storing is enough to do this. any
suggestions or tools that already exists to create this types of graph?
jpgraph can do it... as can a lot of other graph/chart libraries...
http://www.aditus.nu/jpgraph/
yeah, i found that, but i dont know what type of data i would need to store
to get the downloads an hour (24 hours).
likewise, i only increment a counter and last time file was download and im
pretty sure this isn't enough to generate such graphs.
Ah... then in that case you need to keep a log of downloads by hour. If I
were you I'd create a database with a table that kept track of this stuff.
Each row would contain the downloaded file ID, the date, the hour (set
minutes to 00) and the number of times downloaded.
You could then query this table to get a downloads by hour graph or a
downloads by date graph or whatever else you might want.
good luck!
--- End Message ---
--- Begin Message ---
Hi, I have 5 chekboxes in a page, I would like insert the values of all
chekboxes checked in a mysql db.
--
Este mensaje ha sido analizado por MailScanner
en busca de virus y otros contenidos peligrosos,
y se considera que está limpio.
--- End Message ---
--- Begin Message ---
Hi,
I got a PHP program on my server. I want to open a live TCP port
connection between my server to a client (client is developed in .NET,
not regular HTTP browser).
How can I do this using PHP?
-thanks in advance!
--- End Message ---
--- Begin Message ---
Hello Eli,
Wednesday, August 10, 2005, 2:40:07 AM, you wrote:
E> I got a PHP program on my server. I want to open a live TCP port
E> connection between my server to a client (client is developed in
E> .NET, not regular HTTP browser). How can I do this using PHP?
Look in the manual at the quite considerable chapter on "Socket
Functions".
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
Zend Certified Engineer
"I do not fear computers. I fear the lack of them." - Isaac Asimov
--- End Message ---
--- Begin Message ---
Hi Eli--
On 8/9/05 9:40 PM, "Eli" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I got a PHP program on my server. I want to open a live TCP port
> connection between my server to a client (client is developed in .NET,
> not regular HTTP browser).
> How can I do this using PHP?
You can use the socket functions in conjunction with TCP wrappers.
For example, take a look at fsockopen() in the manual:
http://ca.php.net/fsockopen
The resulting resource can be used with fwrite() and fread() and the likes
as if it were a file resource.
For more complex applications, you can use the actual socket API:
http://beeblex.com/manual/ref.sockets.html?s=man%3Asocket
Finally (since you mention you're connecting to a .Net app), maybe what you
need is a web service protocol like SOAP, in which case if you're using PHP
5 there is a built-in extension, whereas PHP 4 requires you to use a
userland library like the one provided by PEAR:
http://pear.php.net/package/soap/redirected
Cheers,
Marco
--
Marco Tabini
President & CEO
Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada
Phone: +1 (416) 630-6202
Fax: +1 (416) 630-5057
--- End Message ---
--- Begin Message ---
Hi all,
I've been struggling to detect HTTPS connection for a shopping cart.
I've used $_SERVER['SERVER_PORT'] to check for 443 and it kept on
showing up as 80.
Does anyone have any idea why this is happening? Is it the server
config? I've called the server administrator and he said that it is
running through port 443 for https connections.
Here's an output of $_SERVER['SERVER_PORT'] on the site that I'm working on:
https://www.axentonline.com.au/port_test.php
http://www.axentonline.com.au/port_test.php
Both the above are showing server_port as 80. Please assist.
Thanks.
PHPInfo:
-------
Apache-AdvancedExtranetServer/2.0.50
Mandrakelinux/7.2.101mdk
mod_ssl/2.0.50
OpenSSL/0.9.7d
PHP/4.3.8
--
Wee Keat Chin
Protocol Networks
p: 1300 131 932
e: [EMAIL PROTECTED]
h: www.pn.com.au
--- End Message ---
--- Begin Message ---
Hello Wee--
That's been discussed a few times on the list. For example:
http://beeblex.com/lists/index.php/php.general/190410
Cheers,
Marco
On 8/9/05 8:59 PM, "Wee Keat" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I've been struggling to detect HTTPS connection for a shopping cart.
> I've used $_SERVER['SERVER_PORT'] to check for 443 and it kept on
> showing up as 80.
>
> Does anyone have any idea why this is happening? Is it the server
> config? I've called the server administrator and he said that it is
> running through port 443 for https connections.
>
> Here's an output of $_SERVER['SERVER_PORT'] on the site that I'm working on:
>
> https://www.axentonline.com.au/port_test.php
> http://www.axentonline.com.au/port_test.php
>
> Both the above are showing server_port as 80. Please assist.
>
>
> Thanks.
>
>
> PHPInfo:
> -------
> Apache-AdvancedExtranetServer/2.0.50
> Mandrakelinux/7.2.101mdk
> mod_ssl/2.0.50
> OpenSSL/0.9.7d
> PHP/4.3.8
>
--
Marco Tabini
President & CEO
Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada
Phone: +1 (416) 630-6202
Fax: +1 (416) 630-5057
--- End Message ---
--- Begin Message ---
Hi Marco,
Thanks for taking the time to answer my questions.
Marco Tabini wrote:
> That's been discussed a few times on the list. For example:
>
> http://beeblex.com/lists/index.php/php.general/190410
Yes. I'm truly aware of that and have tried it but to no avail. I've
added the code provided in the list to the following for your review:
http://www.axentonline.com.au/port_test.php
https://www.axentonline.com.au/port_test.php
I've done a var dump before of $_SERVER and $_ENV and did not find any
HTTPS key in the array.
Is there another way that I can do this?
Thanks again.
--
Wee Keat Chin
Protocol Networks
p: 1300 131 932
e: [EMAIL PROTECTED]
h: www.pn.com.au
--- End Message ---
--- Begin Message ---
On 8/9/05 10:30 PM, "Wee Keat" <[EMAIL PROTECTED]> wrote:
> Hi Marco,
>
> Thanks for taking the time to answer my questions.
>
> Marco Tabini wrote:
>> That's been discussed a few times on the list. For example:
>>
>> http://beeblex.com/lists/index.php/php.general/190410
>
> Yes. I'm truly aware of that and have tried it but to no avail. I've
> added the code provided in the list to the following for your review:
>
> http://www.axentonline.com.au/port_test.php
> https://www.axentonline.com.au/port_test.php
>
Unfortunately, I can't seem to be able to connect to your server right now.
What server software are you using? I have never heard of this approach not
working on a properly configured Apache... But maybe you're using something
else?
Marco
> I've done a var dump before of $_SERVER and $_ENV and did not find any
> HTTPS key in the array.
>
> Is there another way that I can do this?
>
>
> Thanks again.
>
>
--
Marco Tabini
President & CEO
Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada
Phone: +1 (416) 630-6202
Fax: +1 (416) 630-5057
--- End Message ---
--- Begin Message ---
Marco Tabini wrote:
> Unfortunately, I can't seem to be able to connect to your server right now.
>
> What server software are you using? I have never heard of this approach not
Info:
-------
Apache-AdvancedExtranetServer/2.0.50
Mandrakelinux/7.2.101mdk
mod_ssl/2.0.50
OpenSSL/0.9.7d
PHP/4.3.8
The server is not handled by me and I'm not sure if
Apache-AdvancedExtranetServer is different from Apache 2. Could this be
the source of the problem?
> working on a properly configured Apache... But maybe you're using something
> else?
Is there a list of common mis-configurations of Apache that may lead to
this problem? It looks like this may not be a problem with PHP at all.
I'll have to talk to the server administrator to see if there's a chance
his server is configured wrongly. If the answer lies there, I'll close
this thread.
Thanks again.
--
Wee Keat Chin
Protocol Networks
p: 1300 131 932
e: [EMAIL PROTECTED]
h: www.pn.com.au
--- End Message ---
--- Begin Message ---
hi,
can we implement lock to a table using postgres with php.
if any of u all knows the solution do reply back.
--- End Message ---
--- Begin Message ---
R. Ragunathan wrote:
can we implement lock to a table using postgres with php.
if any of u all knows the solution do reply back.
Please, for the second time, simply read the manual.
http://www.php.net/pgsql
It explains both the issues you have recently posted about very well. If
you have a specific question then post back to the list.
Oh, and a descriptive subject rather than "N/A" may help if you want
people to read your message.
Jasper
--- End Message ---