Re: [PHP] Generating a 404 status message with header()

2005-08-09 Thread Paul Waring
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

-- 
Rogue Tory
http://www.roguetory.org.uk

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] parallel execution of php code?

2005-08-09 Thread Marcus Bointon

On 8 Aug 2005, at 16:07, Martin van den Berg wrote:


$query = SELECT id FROM mytable WHERE bla LIKE  . $x .;
$rows = execute( $query )
if ( $rows == 0 )
{
   /* some more processing */
  $query = INSERT INTO mytable .. etc etc
  execute( $query )
}


I have lots of places where I used to do this. Since MySQL 4.1 I've  
changed it to something like:


INSERT INTO mytable SET id = 123, bla = '$x' ON DUPLICATE KEY UPDATE  
bla='$x'


This saves you a query, and makes it easier to isolate the insert/ 
update as it will play nicely with autocommit.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Session-problem? Simple counter won't work

2005-08-09 Thread Sabine

Hello to all,

I'm working on a server where even a simple counter-script won't work.

session_start();
if (isset($HTTP_SESSION_VARS['counter'])) {
   $HTTP_SESSION_VARS['counter']++;
} else {
   $HTTP_SESSION_VARS['counter']=1;
}

On every refresh the counter is set to 1.

I dont' know, where to search for the reasons.
The server is a normal service providers server. My customers site is 
using sessions and they are working on his site.
My script lays in a subdirectory of my costumers site, protected with a 
.htaccess.:

The PHP-Version is 4.0.6.
The values for the session-parameters are, as far as I see, standard:
session.save_handler: files
session.save_path: /tmp

Register-globals is set to on.

Has anybody an idea where the problem lays?
Is it possible that I don' have the right to write into the /tmp-directory?

It would be very nice of you to give me some tips. I don't want to ask 
my customer silly questions.


Thanks in advance
Sabine

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] download snippet

2005-08-09 Thread Roger Thomas
Am looking for code snippet to download file. It should be able to detect 
mime-types. Thanks.

--
Roger


---
Sign Up for free Email at http://ureg.home.net.my/
---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] download snippet

2005-08-09 Thread Burhan Khalid

Roger Thomas wrote:

Am looking for code snippet to download file. It should be able to detect 
mime-types. Thanks.


http://www.php.net/manual/en/function.header.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Class / app for reading web pages and storing in a mySQL DB

2005-08-09 Thread Burhan Khalid

Alan Milnes wrote:
I'm interested in extracting a series of web pages from a Yahoo forum 
and storing them in a MySQL database so I can generate things like most 
number of posts etc.  I've searched on Google but most of the links seem 
to be for email harversters!


Anyone have any tips for where to look?


Well, you'd need something like cURL, HTTP_Client or Snoopy to get you 
started at fetching files from the web.


Then its a matter of extracting the information (parsing out the tags). 
Snoopy has this function that returns the plain text version of a page, 
or you can use regular expressions or strip_tags.


From here on out, its just normal PHP tasks of connecting to the 
database, running your queries, etc.


Oh, Snoopy is snoopy.sf.net.  HTTP_Client is in PEAR. cURL is at 
php.net/curl


Regards,
Burhan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] re: parallel execution of code

2005-08-09 Thread hope

U might try omthing like this::

$query = SELECT id FROM mytable WHERE bla LIKE  . $x .;

$result = mysql_query($query, $cnn) or die(mysql_error());

$totalRows_result = mysql_num_rows($result);

if($totalRows_result0) 
		
{ 


  //display error tht id already exists
}
else
{

  //insert code goes here
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] N/A

2005-08-09 Thread R. Ragunathan


hi,

  can we implement postgres transactions with php.
if anyone knows the solution please reply back.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] N/A

2005-08-09 Thread Jay Blanchard
[snip]
  can we implement postgres transactions with php.
if anyone knows the solution please reply back.
[/snip]

Have you read http://www.php.net/postgres ?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to search products on my site

2005-08-09 Thread virtualsoftware
Hi,

I have a site with some phone products.  I want to search for a specific 
products. I use this:

SELECT product_id, product_name FROM products  WHERE product_name LIKE 
'%$search_string%'

It works fine if the search string counts 1 word. But if the search string id 
counts 2 or 3 or more words it's not working.. How can i do this kind of 
search. I do not want a boolean search or a fulltext search.

Thabks for any help!

RE: [PHP] How to search products on my site

2005-08-09 Thread Jay Blanchard
[snip]
I have a site with some phone products.  I want to search for a specific
products. I use this:

SELECT product_id, product_name FROM products  WHERE product_name LIKE
'%$search_string%'

It works fine if the search string counts 1 word. But if the search
string id counts 2 or 3 or more words it's not working.. How can i do
this kind of search. I do not want a boolean search or a fulltext
search.
[/snip]

If you don't want to do fulltext or boolean then you may have to
construct your query with several OR statements based on the number of
words entered into the search criteria.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How to search products on my site

2005-08-09 Thread Miles Thompson

At 08:54 AM 8/9/2005, [EMAIL PROTECTED] wrote:

Hi,

I have a site with some phone products.  I want to search for a specific 
products. I use this:


SELECT product_id, product_name FROM products  WHERE product_name LIKE 
'%$search_string%'


It works fine if the search string counts 1 word. But if the search string 
id counts 2 or 3 or more words it's not working.. How can i do this kind 
of search. I do not want a boolean search or a fulltext search.


Thabks for any help!



A lot of this depends on how your site is constructed and the kind of 
products you're offering.


split() the string, strip out any noise words, then use the array 
processing features of PHP to build the WHERE condition so you end up with
WHERE product_name LIKE 'arrSearch[1]' OR product_name LIKE 
'arrSeach[2]'  ... and so forth


I think that would be deadly slow -- you're essentially abandoning any 
indexes and doing a sequential read of the database. If MySQL, does it have 
string  search functions - InString() or InArray()


You might also reconsider your search criteria - offer a series of combo 
boxes from which user makes a selection. Then you can construct the query 
from the combo box choices.


If the database is MySQL, and you have general description fields, what's 
wrong with indexed text search? It's pretty fast.


Or abandon search altogether, and present groups of products, user clicks 
on a group which opens up the sub-group with more detailed choices - 
usually specific products. See http://www.leevalley.com .  The advantage of 
this is it exposes the user to associated products.


By the way - how is a search not Boolean? Except for fairly sophisticated 
fuzzy logic applications you're either found something or not. (How about 
search with three levels? Teenage child - goes out, thrashes around, comes 
back with something close, or nothing; Father - more purposeful, but unless 
the item is where he last laid it down no hope of retrieval; Mother- here 
it is.)


Of semi-fuzzy - you asked for gray, but here's the same thing in a 
wonderful orange.


Cheers - Miles 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] How to search products on my site

2005-08-09 Thread Jim Moseby
 
 I have a site with some phone products.  I want to search for 
 a specific products. I use this:
 
 SELECT product_id, product_name FROM products  WHERE 
 product_name LIKE '%$search_string%'
 
 It works fine if the search string counts 1 word. But if the 
 search string id counts 2 or 3 or more words it's not 
 working.. How can i do this kind of search. I do not want a 
 boolean search or a fulltext search.

If you have decided to abandon MySQL's search functions, you will probably
need to do something like this:

$searchtype = OR; // Ask the user for preference 'AND' or 'OR'
$pieces=explode(' ',$searchstring);
$sql=select * from inventory where ;
foreach($pieces as $thispiece){
  $sql .= description like '%.$thispiece.%' .$searchtype;
}

...to build a query string.  Of course you will probably want to look at the
search terms for unnecessary words and definately protect yourself from SQL
injection, but this is the general idea.

 
 Thabks for any help!

Thabk you for askibg!  ;-)

JM

 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] rename an uploaded file.

2005-08-09 Thread Bosky, Dave
I seem to be having some trouble renaming a file after uploading it.

It always returns a warning message indicating I have an invalid
attribute in my rename statement.

 

Thanks,

Dave

 

---

Example:

 

$old = 'C:\\homedirectory\uploadedfiles\\newfile.gif';

$new = 'C:\\homedirectory\\uploadedfiles\\2005-08-05-09:00:00.gif';

move_uploaded_file(temp fileuploaded, $old); 

rename($old,$new);

 

 

 

 

 

 



HTC Disclaimer: The information contained in this message may be privileged and 
confidential and protected from disclosure. If the reader of this message is 
not the intended recipient, or an employee or agent responsible for delivering 
this message to the intended recipient, you are hereby notified that any 
dissemination, distribution or copying of this communication is strictly 
prohibited.  If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your computer.  
Thank you.


Re: [PHP] rename an uploaded file.

2005-08-09 Thread Stut

Bosky, Dave wrote:

I seem to be having some trouble renaming a file after uploading it.

It always returns a warning message indicating I have an invalid
attribute in my rename statement.

snip

$old = 'C:\\homedirectory\uploadedfiles\\newfile.gif';

$new = 'C:\\homedirectory\\uploadedfiles\\2005-08-05-09:00:00.gif';

move_uploaded_file(temp fileuploaded, $old); 


rename($old,$new);


Colons (:) are not allowed in Windows filenames.

Also, you don't need to escape the backslashes when using single quotes.

-Stuart

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Generating a 404 status message with header()

2005-08-09 Thread Eric Gorr

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.


I believe I found the thread you were referring to, but it does not 
provide the answer that I found actually works.


Since my goal is _strictly_ and _only_ to get the 404 directive 
triggered and _absolutely_ nothing more, the solution I found was for 
doesexists.php to use the Location directive to redirect to a page which 
I know does not exist.


This, obviously, triggers the 404 directive as I wanted.

Problem solved.


--
== Eric Gorr === http://www.ericgorr.net ===
Those who would sacrifice a little freedom for temporal safety
deserve neither to be safe or free. - Benjamin Franklin
== Insults, like violence, are the last refuge of the incompetent... ===

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] parallel execution of php code?

2005-08-09 Thread Martin van den Berg
 I have lots of places where I used to do this. Since MySQL 4.1 I've
 changed it to something like:

 INSERT INTO mytable SET id = 123, bla = '$x' ON DUPLICATE KEY UPDATE
 bla='$x'

 This saves you a query, and makes it easier to isolate the insert/
 update as it will play nicely with autocommit.


Neat construction but in my case, id is an auto-increment field... so
I guess your example won't work since I never get a duplicate key.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Generating a 404 status message with header()

2005-08-09 Thread Sebastian

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');


--
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Session-problem? Simple counter won't work

2005-08-09 Thread Jochem Maas

Sabine wrote:

Hello to all,

I'm working on a server where even a simple counter-script won't work.

session_start();
if (isset($HTTP_SESSION_VARS['counter'])) {
   $HTTP_SESSION_VARS['counter']++;
} else {
   $HTTP_SESSION_VARS['counter']=1;
}

On every refresh the counter is set to 1.



I take it this is not inside a function? have you tried using var_dump()
to output $HTTP_SESSION_VARS?

you may be stuck with doing things the old session_register() way rather than
using $HTTP_SESSION_VARS (or preferably $_SESSION - if you had a version of php 
at
your disposal that had that.)


I dont' know, where to search for the reasons.
The server is a normal service providers server. My customers site is 
using sessions and they are working on his site.


I would suggest that you go thru his code line by line to figure out
how it works.

also check out this page:
http://php.net/manual/en/function.session-set-cookie-params.php

given that you want your own session on a specific subpath you will have to
do some more owkr than just start the session.


My script lays in a subdirectory of my costumers site, protected with a 
.htaccess.:

The PHP-Version is 4.0.6.


which idiot is setting 4.0.6 as a requirement - its old, has lots of bugs that
have been fixed in more recent versions and is full _known_ security issues
(which have also been fixed) ... upgrade is the sane thing to do.

if there is one other person on this list using 4.0.6 you'll be lucky. all
this means that your going to have a hard time getting things done - bottom line
this costs your customer more (you are passing on the cost right?)


The values for the session-parameters are, as far as I see, standard:
session.save_handler: files
session.save_path: /tmp

Register-globals is set to on.

Has anybody an idea where the problem lays?
Is it possible that I don' have the right to write into the /tmp-directory?


possible but unlikely, given that the main site works. try writing a file to 
/tmp.



It would be very nice of you to give me some tips. I don't want to ask 
my customer silly questions.


your customer is requiring 4.0.6 - nothing you can ask could be sillier than 
that ;-)
(other than maybe asking to downgrade to php3)



Thanks in advance
Sabine



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How to add .zip or gzip compression to the php module

2005-08-09 Thread Mauricio Pellegrini
Hi ,

This time I'm trying to add support for compressed files
into the PHP module version 4.3.4 running with Apache 1.3.29

I remember adding dbase and mysql support with the following command

 './configure' '--with-mysql' '--with-apxs=/usr/local/apache/bin/apxs'
 '-enable-dbase' 

Now I need to be able to create .zip files from within my php scripts,so
my questions are:

1 ) Which command should I use when recompiling ?

2 ) Is it possible to save my actual compiled module just in case the
new one has any problem? 


Thanks a lot
Mauricio

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] re: blank page with PHP

2005-08-09 Thread Bruce Gilbert
I guess this would help. The URL to my PHP config is
http://www.wealthdevelopmentmortgage.com/test/form_test/info.php


-- 
::Bruce::

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] blank page with PHP

2005-08-09 Thread Bruce Gilbert
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::

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] re: blank page with PHP

2005-08-09 Thread Sabine

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


 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Generating a 404 status message with header()

2005-08-09 Thread Jasper Bryant-Greene

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP error tracking on new server

2005-08-09 Thread Lawrence Kennon


- Original Message - 
From: Terry Romine [EMAIL PROTECTED]

To: php-general@lists.php.net
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] select * from...

2005-08-09 Thread [EMAIL PROTECTED]

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



Re: [PHP] Generating a 404 status message with header()

2005-08-09 Thread Sebastian

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] select * from...

2005-08-09 Thread tg-php
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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php output to string

2005-08-09 Thread Jesús Fernández
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


[PHP] graph - dowloads/hr

2005-08-09 Thread Sebastian
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php output to string

2005-08-09 Thread Cafer Simsek
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php output to string

2005-08-09 Thread Jesús Fernández
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.


Re: [PHP] php output to string

2005-08-09 Thread Cafer Şimşek
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php output to string

2005-08-09 Thread Jesús Fernández
yes, the remote machine runs php (its my hosting's server)

-- 
El único error real es aquel en el que no hemos aprendido nada.


Re: [PHP] php output to string

2005-08-09 Thread Cafer Şimşek
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Insert one or many chekbox values in a db mysql

2005-08-09 Thread Jesús Alain Rodríguez Santos
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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php output to string

2005-08-09 Thread Jesús Fernández
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.


Re: [PHP] graph - dowloads/hr

2005-08-09 Thread Philip Hallstrom
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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Generating a 404 status message with header()

2005-08-09 Thread Jasper Bryant-Greene

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] graph - dowloads/hr

2005-08-09 Thread Sebastian

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Server-Client connection via TCP port with PHP

2005-08-09 Thread Eli

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!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server-Client connection via TCP port with PHP

2005-08-09 Thread Richard Davey
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Problem detecting HTTPS connection

2005-08-09 Thread Wee Keat
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem detecting HTTPS connection

2005-08-09 Thread Marco Tabini
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Server-Client connection via TCP port with PHP

2005-08-09 Thread Marco Tabini
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] graph - dowloads/hr

2005-08-09 Thread Philip Hallstrom
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!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem detecting HTTPS connection

2005-08-09 Thread Wee Keat
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem detecting HTTPS connection

2005-08-09 Thread Marco Tabini
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Problem detecting HTTPS connection

2005-08-09 Thread Wee Keat

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] N/A

2005-08-09 Thread R. Ragunathan


hi,

can we implement lock to a table using postgres with php.
if any of u all knows the solution do reply back.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] N/A

2005-08-09 Thread Jasper Bryant-Greene

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php