php-general Digest 29 Nov 2004 20:38:01 -0000 Issue 3141

Topics (messages 203054 through 203083):

Re: Weird sessions problem
        203054 by: steve

Re: Problem with self join
        203055 by: Raditha Dissanayake
        203057 by: Robin Vickery
        203060 by: Raditha Dissanayake

Re: similar function like getimagesize for Quicktime?
        203056 by: Marek Kilimajer

Is this a bug in PHP 4.3.4?
        203058 by: Octavian Rasnita
        203062 by: Raditha Dissanayake
        203064 by: Octavian Rasnita
        203065 by: Greg Donald
        203066 by: Greg Donald
        203067 by: Raditha Dissanayake

Re: Go Back Problem
        203059 by: Philip Thompson

SELECT problem..Need urgent help !!!!
        203061 by: Phpu
        203063 by: Greg Donald

UNDEFINED VARIABLE ON LOCALHOST
        203068 by: Ross Hulford
        203070 by: John Nichel
        203071 by: Greg Donald

Problems with headers and downloading file
        203069 by: Christian Johansson
        203073 by: John Nichel
        203075 by: David Dickson

Turck mm_cache problem
        203072 by: Mirek Novak

Line breaks in form
        203074 by: Chris Farrugia
        203076 by: John Nichel
        203077 by: Greg Donald

[Off] - A way for PHP sites to get extreme Google rankings
        203078 by: Brian Dunning
        203079 by: Greg Donald
        203080 by: John Nichel
        203081 by: Brian Dunning

Re: PHP arrays and javascript
        203082 by: Nick Peters

PHP log 2 Apache log
        203083 by: David Zejda

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 ---
Andre Dubuc wrote:

> I gather that all of the script occurs on one page, and that the page is
> 'refreshed' by some action of the user (i.e. that the user has
> clicked/entered login info on some other page, and that this page then
> needs to detect that change.)

No, it's when moving from one page/script to another.
 
> What may be happening is that the refresh action triggers the script
> twice: once for the initial loading and again for the reset values. Hence,
> $ref_page gets reset by line 53 ($ref_page = get_ref_page();

Nope. There's no 'refresh' as such.

> Another question, by
> any chance, are you switching into https by any chance?

Nope.

Ah well. As I mentioned earlier, I have a workaround now - not ideal, but as
it's working it'll do. I don't make money from web programming so I'll
leave it at that and get on with my day job :-)

-- 
@+
Steve

--- End Message ---
--- Begin Message ---
suneel wrote:

Hi...
       Please take a look at the following...

I'm using MySQL 4.0.15


And what makes you think this is a mysql list?


--
Raditha Dissanayake.
------------------------------------------------------------------
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/ | Drag and Drop Upload

--- End Message ---
--- Begin Message ---
On Mon, 29 Nov 2004 14:12:23 +0530, suneel
<[EMAIL PROTECTED]> wrote:
> Hi...
>         Please take a look at the following...
> 
>         I'm using MySQL 4.0.15
>         I have the database like this....
> 
>                    Id     name         Owner
>                     1    Top Menu    0
>                     2    File               1
>                     3    Open            1
>                     4    Text File       2
>                     5    Dot Net        2
>                     6    ASP.Net       5
>                     7    C#.Net          5
> 
>           In the above data the Id's 6 & 7  are not owner to any one.So,I
> want to retrieve those Id's which are not owner to any one.

This should really go to a MySQL list, but...

If your table is called "menus", this should do the job.

SELECT a.* 
  FROM menus a LEFT JOIN menus b ON a.Id = b.Owner 
  WHERE b.Owner IS NULL

-robin

--- End Message ---
--- Begin Message ---
Robin Vickery wrote:

On Mon, 29 Nov 2004 14:12:23 +0530, suneel
<[EMAIL PROTECTED]> wrote:


Hi...
       Please take a look at the following...

I'm using MySQL 4.0.15
I have the database like this....


This should really go to a MySQL list, but...


please keep the discussion on topic.




--
Raditha Dissanayake.
------------------------------------------------------------------
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/ | Drag and Drop Upload

--- End Message ---
--- Begin Message --- Dustin Krysak wrote:
Hi there - I was wondering if there was some kind of PHP function to determine hte pixel size of a quicktime movie. Something like what GetImageSize() is to images, but for quicktime.

Not in php. Search for programs that you can execute from command line for your platform.

--- End Message ---
--- Begin Message ---
Hi all,

I use the  following program:

<?php

print_form();
print_quotes ();

function print_form () {
ob_start();

output_add_rewrite_var("sort", "sorting");

echo <<<EOF
<form>
...
</form>
EOF;

ob_flush();
}

function print_quotes () {
output_reset_rewrite_vars();

echo <<<EOF
<table>
...
</table>
EOF;
}

?>


The result printed is:

Content-type: text/html
X-Powered-By: PHP/4.3.4

<form><input type="hidden" name="sort" value="sorting" />
...
</<table>
...
</table>

Well, do you have any idea why PHP prints:

</<table>

...instead of:

</form><table>

I have tried this program under Fedora Core 2 in command line mode and on an
Apache web server with the same results.

Do you have suggestions for making this program work and why does this
happen?

Thank you.

Teddy

--- End Message ---
--- Begin Message ---
Octavian Rasnita wrote:

Hi all,

I use the  following program:




function print_quotes () {
output_reset_rewrite_vars();

echo <<<EOF
<table>
...
</table>
EOF;
}


I have tried this program under Fedora Core 2 in command line mode and on an Apache web server with the same results.

Do you have suggestions for making this program work and why does this
happen?


I think the problem is with your 'here document' this is the traditional way of doing things in perl but in php you could 'go back into HTML. by using the '?>' sequence. Thus your program might become

function print_quotes () {
output_reset_rewrite_vars();
?>
<table>
...
</table>
<?

}


There are pros and cons of both approach but the bit of code i have given will produce the expected result.







--
Raditha Dissanayake.
------------------------------------------------------------------
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/ | Drag and Drop Upload

--- End Message ---
--- Begin Message ---
Thank you. I will try that solution if it works, but the question still
remains...
Is PHP so buggy? The 'here document' should work without a problem in PHP
also.

My code works fine with PHP 5 (fortunately) under Windows, but it doesn't
work with PHP 4.3.4 under Linux.

I think I need to upgrade php under Linux also...

Teddy

----- Original Message ----- 
From: "Raditha Dissanayake" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, November 29, 2004 5:29 PM
Subject: Re: [PHP] Is this a bug in PHP 4.3.4?


Octavian Rasnita wrote:

>Hi all,
>
>I use the  following program:
>
>
>

>function print_quotes () {
>output_reset_rewrite_vars();
>
>echo <<<EOF
><table>
>...
></table>
>EOF;
>}
>
>
>I have tried this program under Fedora Core 2 in command line mode and on
an
>Apache web server with the same results.
>
>Do you have suggestions for making this program work and why does this
>happen?
>
>
I think the problem is with your 'here document' this is the traditional
way of doing things in perl but in php you could  'go back into HTML. by
using the '?>' sequence. Thus your program might become

function print_quotes () {
output_reset_rewrite_vars();
 ?>
 <table>
 ...
 </table>
<?

}


There are pros and cons of both approach but the bit of code i have
given will produce the expected result.

--- End Message ---
--- Begin Message ---
On Mon, 29 Nov 2004 17:58:27 +0200, Octavian Rasnita <[EMAIL PROTECTED]> wrote:
> Is PHP so buggy? The 'here document' should work without a problem in PHP
> also.

The latest stable PHP 4 is rock solid from where I'm sitting.  We have
a bunch of Debian servers running 4.3.9 with no issues.

> My code works fine with PHP 5 (fortunately) under Windows, but it doesn't
> work with PHP 4.3.4 under Linux.
> 
> I think I need to upgrade php under Linux also...

I would defiantly upgrade.  Hundreds of bugs have been fixed from
4.3.4 -> 4.3.9.

http://www.php.net/ChangeLog-4.php


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
On Mon, 29 Nov 2004 10:28:57 -0600, Greg Donald <[EMAIL PROTECTED]> wrote:
> I would defiantly upgrade.

Definitely too.  :)


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
Octavian Rasnita wrote:

Thank you. I will try that solution if it works, but the question still
remains...
Is PHP so buggy? The 'here document' should work without a problem in PHP
also.


It probably wasn't a bug in php 4.3.4 but as greg has pointed out you probably should upgrade anyway. Here documents are pretty hard to work with at the best of times and it's quite easy to make a teeny weeny hard to detect typo.,

My code works fine with PHP 5 (fortunately) under Windows, but it doesn't
work with PHP 4.3.4 under Linux.

I think I need to upgrade php under Linux also...




--
Raditha Dissanayake.
------------------------------------------------------------------
http://www.radinks.com/print/card-designer/ | Card Designer Applet
http://www.radinks.com/upload/ | Drag and Drop Upload

--- End Message ---
--- Begin Message ---
On Nov 26, 2004, at 7:59 PM, Cyrus wrote:

Dear All,

I have a problem of back to the previous page in php.....
I need to create a form let people to fill in .It can let user to preview the form, if information is not correct , user can back to previous page and correct it,
I have used the javascript : OnClick='history.go(-1)' and OnClick='history.back()' in php , but it can not works....pls help me.


Thanks and Regards,

Cyrus Chan

What I do is store all the fields in $_SESSION variables, so when you go back to the page, if they filled that particular field out, it should show what they have already completed.


------------------
<?php
session_start();

if ($_POST["submitted"] == 1) {
        $_SESSION["field1"] = $_POST["something"];
        $_SESSION["field2"] = $_POST["pizza"];
}
?>


<form action="wherever.php" method="post">
<input type="text" name="something" value="<? echo $_SESSION["field1"]; ?>"/>
<input type="text" name="pizza" value="<? echo $_SESSION["field2"]; ?>"/>
<input type="submit" value="GO"/>
<input type="hidden" name="submitted" value="1"/>
</form>
------------------


So, there's no need to use javascript or to actually "go back." You can just "redirect" to that page and have it "remember" the variables. To redirect back to it, use header("location: http://mysite.com/wherever.php";); It is not *always* necessary to use the absolute path to indicate that particular page in the header() function, but it doesn't hurt.

Sorry if I have rambled on or confused you - it's late and I'm sleepy. Good luck with that.

~Philip
--- End Message ---
--- Begin Message ---
Hi,

I have an array named $ex_array.

I want to search the database and find those ids that are different from the 
values in $ex_array.

I use this but didn't work

$sql = "SELECT product_id FROM products WHERE product_id <> '$ex_array' " ; 


Thanks for any help !!!!

--- End Message ---
--- Begin Message ---
On Mon, 29 Nov 2004 17:27:26 +0200, Phpu <[EMAIL PROTECTED]> wrote:
> I have an array named $ex_array.
> 
> I want to search the database and find those ids that are different from the 
> values in $ex_array.
> 
> I use this but didn't work
> 
> $sql = "SELECT product_id FROM products WHERE product_id <> '$ex_array' " ;

$sql = "
SELECT
    product_id
FROM
    products
WHERE
    product_id NOT IN ( "
    . implode( ', ', $ex_array )
    . " ) ";

This question would be more appropriate for the php-db list.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
I have a porblem with undefined variables on loacalhost. Any ideas why? I 
have turned registed variables on.


R. 

--- End Message ---
--- Begin Message --- Ross Hulford wrote:
I have a porblem with undefined variables on loacalhost. Any ideas why? I have turned registed variables on.


R.

Without seeing any code, I'm going to guess that you haven't defined a variable before trying to use it. Wanna make it go away? Turn off 'notices' in your error reporting, or make sure your variables are defined before you try to use them.


--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
On Mon, 29 Nov 2004 17:11:47 -0000, Ross Hulford <[EMAIL PROTECTED]> wrote:
> I have a porblem with undefined variables on loacalhost. Any ideas why? I
> have turned registed variables on.

Where's the code?



-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message ---
Hello.

 

I have a problem with downloads with the use of header()

I have this code at the start at the download site:

 

Header("Content-Type: application/download");

Header("Content-Disposition: attachment; filename=export.txt");

 

My problem is that the file which is downloaded contains HTML code which I
don't need, and don't want to have there.

Is there some way to take control on what should be written to the file?

I am almost there, I have all the data I want do generate on the file, but
in the start of the file HTML code are written.

Anyone who can help me?

 

I can't store a file on the server, and then download it, because of some
government rules.

 

 

 

Regards

 

Christian Johansson

 


--- End Message ---
--- Begin Message --- Christian Johansson wrote:
Hello.



I have a problem with downloads with the use of header()

I have this code at the start at the download site:



Header("Content-Type: application/download");

Header("Content-Disposition: attachment; filename=export.txt");



My problem is that the file which is downloaded contains HTML code which I
don't need, and don't want to have there.

Is there some way to take control on what should be written to the file?

I am almost there, I have all the data I want do generate on the file, but
in the start of the file HTML code are written.

Anyone who can help me?



I can't store a file on the server, and then download it, because of some
government rules.

http://us4.php.net/striptags

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- Christian Johansson wrote:
I have a problem with downloads with the use of header()
I have this code at the start at the download site:
Header("Content-Type: application/download"); Header("Content-Disposition: attachment; filename=export.txt");


My problem is that the file which is downloaded contains HTML code which I
don't need, and don't want to have there.

Is there some way to take control on what should be written to the file?

I am almost there, I have all the data I want do generate on the file, but
in the start of the file HTML code are written.

Christian Johansson

Anything you echo after sending the headers will be inserted into the downloaded file. For example:


<?php

header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=export.txt");

echo "This is the first line\n";
echo "This is the second line.";

?>

Will cause the users browser to download a text document that contains two lines of text. All you need to do is write your php code after the headers that generates your text file contents.

-- David Dickson
--- End Message ---
--- Begin Message ---
Hello people,

I've got into problem with compilation of turck mm_cache module.
Usual steps for mm_cache compilation were:

phpize
./configure
make

but now, when I run phpize (appropriate one from right directory) I've got this error:

[EMAIL PROTECTED] turck-mmcache]# phpize
NONE:0: /usr/bin/m4: ERROR: EOF in string
[EMAIL PROTECTED] turck-mmcache]#


PHP 4.3.9 no Linux MM_CACHE latest from CVS (latest "stable" from SF was the same problem)

is there anyone who have ever seen this?
Can anyone help?


thanks

Mirek
--- End Message ---
--- Begin Message ---
Greetings,

 

On one of my forms to send email, I have multiple line breaks with different
paragraphs.  I looked up the nl2br function and that looks like an option,
but I would ideally like to wrap these paragraphs inside <p></p> tags.  Is
there a way to do this easily?  Any advice would be greatly appreciated.

 

Thanks,

Chris

 


--- End Message ---
--- Begin Message --- Chris Farrugia wrote:
Greetings,



On one of my forms to send email, I have multiple line breaks with different
paragraphs.  I looked up the nl2br function and that looks like an option,
but I would ideally like to wrap these paragraphs inside <p></p> tags.  Is
there a way to do this easily?  Any advice would be greatly appreciated.

I'm sure somebody will have a 'cleaner' way, but...

$text = preg_split ( "/\n/", $inputText );
for ( $i = 0; $i < sizeof ( $text ); $i++ ) {
        if ( $text[$i] != "" ) {
                $text[$i] = "<p>" . $text[$i] . "</p>";
        }
}

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
On Mon, 29 Nov 2004 12:29:59 -0500, Chris Farrugia
<[EMAIL PROTECTED]> wrote:
> On one of my forms to send email, I have multiple line breaks with different
> paragraphs.  I looked up the nl2br function and that looks like an option,
> but I would ideally like to wrap these paragraphs inside <p></p> tags.  Is
> there a way to do this easily?  Any advice would be greatly appreciated.

explode() the text by the "\n" character, this will give you an array.
 Iterate over the array and add your <p> tags there.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message --- Check it out, in 2 weeks I got to #4 on Google for "ebay motors" - which, as you may know, translates into major affiliate dollars.

Completely free and easy to do (as long as your site is in PHP). It's all about backlinks generated from this free ad network:

  http://www.digitalpoint.com/tools/ad-network/?s=174

And now, back to our regularly scheduled programming.

Brian Dunning
http://www.briandunning.com/

--- End Message ---
--- Begin Message ---
On Mon, 29 Nov 2004 11:20:21 -0800, Brian Dunning
<[EMAIL PROTECTED]> wrote:
> It's all about backlinks generated from this free ad network:

In other news, scientists discovered wheels are indeed round.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

--- End Message ---
--- Begin Message --- Brian Dunning wrote:
Check it out, in 2 weeks I got to #4 on Google for "ebay motors" - which, as you may know, translates into major affiliate dollars.

Completely free and easy to do (as long as your site is in PHP). It's all about backlinks generated from this free ad network:

http://www.digitalpoint.com/tools/ad-network/?s=174

I'm guessing s=174 is your referral ID.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
I'm guessing s=174 is your referral ID.

Yes it is. Try it, you'll find it was well worth it. :)

--- End Message ---
--- Begin Message ---
Marek Kilimajer wrote:

> Nick Peters wrote:
>> Hey,
>> 
>> i know this probally a simple question, but it has been stumping me for
>> quite some time now. How do i pass a php array to a javascript?
>> 
>> i tryed:
>> <script language="javascript">
>> var myarray = new Array(<?PHP echo $myarray; ?>);
>> </script>
>> 
>> but it didn't work. Anybody got any ideas?
>> 
>> thanks in advance.
> 
> For integers and floats:
> 
> var myarray = new Array(<?PHP echo implode(', ', $myarray); ?>);
> 
> For strings:
> 
> var myarray = new Array(<?PHP echo '"'. implode('", "', $myarray) .'"';
> ?>);

Would this work the same for multidimensional arrays?

-- 
-Nick Peters

--- End Message ---
--- Begin Message --- Hi!
Is there any way to order the PHP (mod_php) to log everything to ErrorLog defined by Apache in VirtualHost section? In php.ini I see only the possibility to specify the concrete global logfile or syslog, but a such setup doesn't fit to virtual host scenario...


Thanks for your advice and excuse me, If i missed something trivial.

With regards
David

--- End Message ---

Reply via email to