[PHP] RE: [PHP-DB] Dynamic Website Question!

2003-11-30 Thread Bronislav Klucka
> I want to have a PHP website that feeds information
> off a mysql database.  But generally changes occour
> and instead of asking users to refresh the page to get
> the updates is there a way to provide the updates
> without them needing to refresh the page?
>
> E.G. For like shooping Carts, Chat rooms, etc...
>
> Is there a way in PHP or something to make updates
> show up live as they happen instead of the yucky meta
> refresh tag in HTML?
>
> Thanks for your time in advance.

I'm sorry, I always dissapoint you, but what ever you want to send to
browser must be demend by the browser. I mean you can tell browser to reload
part of the page, browser has to ask for it, you can send more information
to the browser and then use DHTML to provide the showing, or hiding...

There is only one way how to do, what you want (but it always ask the
server, only user will not see reloading). The way is to have 2 frames: 1st
for showing the content and the second to refresh every 1 min. (or as you
want), receive informations and using DHTML change the content of the first
frame, the secomd frame could be at the bootom of the browser, 1pixel
height, to be "invisible"



Brona

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



[PHP] RE: [PHP-DB] Dynamic Website Question!

2003-11-30 Thread JeRRy
Hi,

I am not familiar with DHTML and how it can be used to
talk to PHP to update a certain part of a page.  That
is all I need, is one section of the page, not the
entire page, to be refreshed.  The part is just text
from a database.  However on the page I want
backgrounds, images etc but I don't want these to
refresh, just the text from the database.

What you have said below seems exactly what I want. 
But I have never used DHTML.  Could you show me a
example of both frames (just the source) of how one
talks to another please?

Jerry

 --- Bronislav Klucka <[EMAIL PROTECTED]>
wrote: > > I want to have a PHP website that feeds
> information
> > off a mysql database.  But generally changes
> occour
> > and instead of asking users to refresh the page to
> get
> > the updates is there a way to provide the updates
> > without them needing to refresh the page?
> >
> > E.G. For like shooping Carts, Chat rooms, etc...
> >
> > Is there a way in PHP or something to make updates
> > show up live as they happen instead of the yucky
> meta
> > refresh tag in HTML?
> >
> > Thanks for your time in advance.
> 
> I'm sorry, I always dissapoint you, but what ever
> you want to send to
> browser must be demend by the browser. I mean you
> can tell browser to reload
> part of the page, browser has to ask for it, you can
> send more information
> to the browser and then use DHTML to provide the
> showing, or hiding...
> 
> There is only one way how to do, what you want (but
> it always ask the
> server, only user will not see reloading). The way
> is to have 2 frames: 1st
> for showing the content and the second to refresh
> every 1 min. (or as you
> want), receive informations and using DHTML change
> the content of the first
> frame, the secomd frame could be at the bootom of
> the browser, 1pixel
> height, to be "invisible"
> 
> 
> 
> Brona
>  

http://personals.yahoo.com.au - Yahoo! Personals
New people, new possibilities. FREE for a limited time.

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



[PHP] RE: [PHP-DB] Dynamic Website Question!

2003-11-30 Thread Bronislav Klucka
index.php
  



 

first.php





second.php




function PSBrowser(){
this.ns4 = (window.document.layers);
this.ie4 = (window.document.all && !window.document.getElementById);
this.ie5 = (window.document.all && window.document.getElementById);
this.ns6 = (!window.document.all && window.document.getElementById);
this.op = window.navigator.appName.indexOf('Opera')!=-1;
}

function PSGetElementById(frame,id){
var b=new PSBrowser();
var new_obj=null;
if(b["ns4"]){
new_obj=frame.document.layers[id];
} else if(b["ie4"]){
new_obj=frame.document.all[id];
} else if(b["ie5"] || b["ns6"]){
new_obj=frame.document.getElementById(id);
}   
return new_obj;
}

function DoOnLoad(){
ele=PSGetElementById(parent.frames[0],"text");
ele.innerHTML="";
}
   



 



is that clear?

> 
> Hi,
> 
> I am not familiar with DHTML and how it can be used to
> talk to PHP to update a certain part of a page.  That
> is all I need, is one section of the page, not the
> entire page, to be refreshed.  The part is just text
> from a database.  However on the page I want
> backgrounds, images etc but I don't want these to
> refresh, just the text from the database.
> 
> What you have said below seems exactly what I want. 
> But I have never used DHTML.  Could you show me a
> example of both frames (just the source) of how one
> talks to another please?
> 
> Jerry
> 
>  --- Bronislav Klucka <[EMAIL PROTECTED]>
> wrote: > > I want to have a PHP website that feeds
> > information
> > > off a mysql database.  But generally changes
> > occour
> > > and instead of asking users to refresh the page to
> > get
> > > the updates is there a way to provide the updates
> > > without them needing to refresh the page?
> > >
> > > E.G. For like shooping Carts, Chat rooms, etc...
> > >
> > > Is there a way in PHP or something to make updates
> > > show up live as they happen instead of the yucky
> > meta
> > > refresh tag in HTML?
> > >
> > > Thanks for your time in advance.
> > 
> > I'm sorry, I always dissapoint you, but what ever
> > you want to send to
> > browser must be demend by the browser. I mean you
> > can tell browser to reload
> > part of the page, browser has to ask for it, you can
> > send more information
> > to the browser and then use DHTML to provide the
> > showing, or hiding...
> > 
> > There is only one way how to do, what you want (but
> > it always ask the
> > server, only user will not see reloading). The way
> > is to have 2 frames: 1st
> > for showing the content and the second to refresh
> > every 1 min. (or as you
> > want), receive informations and using DHTML change
> > the content of the first
> > frame, the secomd frame could be at the bootom of
> > the browser, 1pixel
> > height, to be "invisible"
> > 
> > 
> > 
> > Brona
> >  
> 
> http://personals.yahoo.com.au - Yahoo! Personals
> New people, new possibilities. FREE for a limited time.

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



Re: [PHP] Suggestions for optimization?

2003-11-30 Thread Eugene Lee
On Sat, Nov 29, 2003 at 09:32:19AM -0800, Galen wrote:
: 
: I'm working on some database search ranking code. It currently 
: represents 95-98% of the time spent when doing fuzzy seaches. I have 
: tried my best to optimize my code - algorithmic shortcuts, eliminating 
: session variables, unsetting irrelevant results, etc and benchmarking 
: to find the best techniques. That's given me over a 10x improvement. 
: Unfortunately, because of the number of results it must process (up to 
: 20,000), it is still somewhat slow. I think it could use some code 
: structure/formating tweaks to eek out that last bit of performance, but 
: I don't know much about optimizing PHP code in that way. Does anybody 
: have suggestions?

You should profile your code a bit more and see how much time getting
spent in your foreach loops and your usort().  You could always rewrite
your foreach loops into for loops and manually iterate through the array
itself instead of a copy.  And you use strtolower() and trim() on every
pass through the data.  That's a lot of work that can be pre-massaged in
the database so that you don't need to do it within your loops (granted,
this doubles your needed storage space in the hopes of speeding your
fuzzy searches).

Also, I noticed that your usort() was doing a normal numeric sort.  That
being the case, why not switch the line:

usort($search_results, "cmp");

and use:

sort($search_results, SORT_NUMERIC);

: Here's my code:
: 
:   if ($search_results[0]["relevancy"] == "")
:   {   
:   function cmp($a, $b)
:   {
:   if($a["relevancy"]  < $b["relevancy"])
:   {
:   return 1;
:   }
:   elseif($a["relevancy"] > $b["relevancy"])
:   {
:   return -1;
:   }
:   else
:   {
:   return 0;
:   }
:   }
:   
:   $search_statements = $_SESSION["search"]["statements"];
:   
:   foreach($search_results as $key1 => $value1)
:   {
:   $num_fields_matched = 0;
:   $result_score = 0;
:   $metaphone_ratio = 0;
:   foreach($search_statements as $key => $value)
:   {
:   if ($value != "" AND $value1[$key] != $value)
:   {
:   $value = strtolower(trim($value));
:   $value1[$key] = 
:   strtolower(trim(($value1[$key])));
:   $num_fields_matched++;
:   $value_metaphone = 
:   metaphone($value1[$key]);
:   $search_metaphone = 
:   metaphone($value);
:   $search_position = 
:   strpos($value1[$key], $value);
:   $string_count = 
:   substr_count($value1[$key], $value);
:   $levenshtein = levenshtein($value, 
:   $value1[$key], "0.5", 1, 1);
:   
:   if ($search_metaphone == 
:   $value_metaphone AND 
:   $value_metaphone != "")
:   {
:   $metaphone_ratio = 1;
:   }
:   elseif ($search_metaphone != 0)
:   {
:   $metaphone_ratio = 0.6 * (1 
:   / 
:   levenshtein($search_metaphone, 
$value_metaphone));
:   }
:   
:   $result_score = $result_score + 
:   ($levenshtein + (8 * $search_position)) - (2 * 
($string_count - 1)) - (1.1 
: * $metaphone_ratio * $levenshtein);
:   }
:   elseif ($value1[$key] == $value)
:   {
:   $result_score = $result_score - 5;
:   }
:   }
:   if ($num_fields_matched == 0)
:   {
:   $num_fields_matched = 1;
:   }
:

[PHP] RE: [PHP-DB] Dynamic Website Question!

2003-11-30 Thread Bronislav Klucka
>
> Okay I see how that works.  However I have a heap of
> mysql queries to do and only want the output from the
> database to show.
>
> > ele.innerHTML="";
>
> So is the section I need to change?
>
> Now I have 2 options, I can include the code in that
> file but it appears it don't like spaces and enters
> and outputs an error and wont do anything or I could
> add a require function to get it from another
> filename?
>
> How can I do it?
>
> The queries are about 25 lines long with varies
> queries.  How can I make it work with the code you
> sent me?
>
> The code works fine on it's own so it works. :)
>
> Jerry
>

Hi,
This is only sample how to change content od this element, where you get
data is your problem:

1/

.
.
.
ele.innerHTML="";
.
.
.
2/
$res=mysql_query("select crap from table'');
$row=mysql_fetch_array($res);
.
.
.
ele.innerHTML="";
.
.

3/
if ($fd=fOpen('file.ext","r")){
$var=fread ($fd, filesize ($filename));
fClose($fd);
}
.
.
.
.
ele.innerHTML="";

.
.


clear?


Brona

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



[PHP] Export data

2003-11-30 Thread Rosen
Hi,
Is it possible to export some data to MSOffice format ( .doc and .xls ) ,
OOffice ( .sxw and sxc ) or .rtf format with PHP

Thanks in advance !
Rosen

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



[PHP] PHP or PEAR MEETING on FOSDEM 2004 (belgium) ?

2003-11-30 Thread Christophe Gesché
http://www.fosdem.org/

21 and 22 feb 2004 in Brussel ( Belgium - a little country 
in north of France, with good beer and chocolate. don't 
forget this argument :-) )

- -- Announcement -- -
The __Free and Open source Software Developers' European 
Meeting__  is a 2 days event, organized by volunteers, to 
promote the widespread use of Free and Open Source software. 
Taking place in the beautiful city of Brussels, Belgium 
FOSDEM meetings are recognised as the best Free and Open 
Source events in Europe.

Important Note: Entrance and attendance to FOSDEM talks and 
tutorials are free, but donations to help us organizing and 
keeping the event free are welcome.

- - PHP & PEAR --- -
As  nobody was come last year.
the  Fosdem team have removed theDevelopers' room PHP/PEAR
In 2002 Derick and Sterling had make a good speach.

I can discuss to have one room.
If some contributor would come and work.
-
So
If you tell go to fosdem, reply to this message.
If you want work on pear during fosdem, reply to this message.
If you  want  prupose a topic, reply to this message
The target of  meeting  is for dev
-
Christophe Gesché // Moosh_at_phpFrance_dot_com	

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


[PHP] Undefined offset on Windows not on Apache?

2003-11-30 Thread Chris Williams
I've created a script to parse through a data file which contains coma
separated fields of data. The script works on Apache, however when I run it
on under Windows (running PHP as a CGI) the script produces an Undefined
offset notice. What is strange about this notice is that the line of code
which contains the array element never gets executed.

Here is what I have:
A data file containing:
=== START OF FILE =

1,01545,"01612,01545,01505,01609,01606,01562"

=== END OF FILE =
The first and last lines contain carriage returns. The second or middle line
contains sample data.

The script that reads and parses the data is:

  $countLines = fopen("data.txt", "r");
  while (!feof($countLines))
  {
   $newLine = fgets($countLines, 1024);
   echo "line length:  " . strlen($newLine) . "";
   if(strlen($newLine) > 0)
   {
   $newLine = ereg_replace ("\"", "", $newLine);
   $zip_forward = explode(",",$newLine);
   $location_id = trim($zip_forward[0]);
   echo "array size: " . count($zip_forward) . "  ID: $location_id";
   $zip_to = trim(substr($zip_forward[1], 0, 5));
   }
  }
  fclose($countLines);

What's odd here is that the last line, which has a length of 0, should never
cause the if(strlen($newLine) > 0) to execute the lines of script contained
within the if conditional. And in fact the lines DON'T get executed.
However, on the Windows server I get the following error
PHP Notice: Undefined offset: 1 in \debug.php on line 20. This points to my
code that evaluates the second element of the array $zip_to =
trim(substr($zip_forward[1], 0, 5));

If I never evaluate the $zip_forward[1] array element within the if
conditional, why would PHP test the array $zip_forward for the proper number
of elements?

This script works fine under Apache.

I haven't a clue what is going on.

Comments welcome,
Chris

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



[PHP] Undefined offset on Windows not on Apache?

2003-11-30 Thread Chris Williams
I've created a script to parse through a data file which contains coma
separated fields of data. The script works on Apache, however when I run it
on under Windows (running PHP as a CGI) the script produces an Undefined
offset notice. What is strange about this notice is that the line of code
which contains the array element never gets executed.

Here is what I have:
A data file containing:
=== START OF FILE =

1,01545,"01612,01545,01505,01609,01606,01562"

=== END OF FILE =
The first and last lines contain carriage returns. The second or middle line
contains sample data.

The script that reads and parses the data is:

  $countLines = fopen("data.txt", "r");
  while (!feof($countLines))
  {
   $newLine = fgets($countLines, 1024);
   echo "line length:  " . strlen($newLine) . "";
   if(strlen($newLine) > 0)
   {
   $newLine = ereg_replace ("\"", "", $newLine);
   $zip_forward = explode(",",$newLine);
   $location_id = trim($zip_forward[0]);
   echo "array size: " . count($zip_forward) . "  ID: $location_id";
   $zip_to = trim(substr($zip_forward[1], 0, 5));
   }
  }
  fclose($countLines);

What's odd here is that the last line, which has a length of 0, should never
cause the if(strlen($newLine) > 0) to execute the lines of script contained
within the if conditional. And in fact the lines DON'T get executed.
However, on the Windows server I get the following error
PHP Notice: Undefined offset: 1 in \debug.php on line 20. This points to my
code that evaluates the second element of the array $zip_to =
trim(substr($zip_forward[1], 0, 5));

If I never evaluate the $zip_forward[1] array element within the if
conditional, why would PHP test the array $zip_forward for the proper number
of elements?

This script works fine under Apache.

I haven't a clue what is going on.

Comments welcome,
Chris

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



[PHP] Radius question

2003-11-30 Thread Robin Kopetzky
Has anyone seen or know of a PHP implementation of a RADIUS server??

Please reply off list - [EMAIL PROTECTED]

Robin 'Sparky' Kopetzky
Black Mesa Computers/Internet Service
Grants, NM 87020 

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



Re: [PHP] Undefined offset on Windows not on Apache?

2003-11-30 Thread John W. Holmes
Chris Williams wrote:
The first and last lines contain carriage returns. The second or middle line
contains sample data.
The script that reads and parses the data is:

  $countLines = fopen("data.txt", "r");
  while (!feof($countLines))
  {
   $newLine = fgets($countLines, 1024);
   echo "line length:  " . strlen($newLine) . "";
   if(strlen($newLine) > 0)
   {
   $newLine = ereg_replace ("\"", "", $newLine);
   $zip_forward = explode(",",$newLine);
   $location_id = trim($zip_forward[0]);
   echo "array size: " . count($zip_forward) . "  ID: $location_id";
   $zip_to = trim(substr($zip_forward[1], 0, 5));
   }
  }
  fclose($countLines);
What's odd here is that the last line, which has a length of 0, should never
cause the if(strlen($newLine) > 0) to execute the lines of script contained
within the if conditional. And in fact the lines DON'T get executed.
However, on the Windows server I get the following error
PHP Notice: Undefined offset: 1 in \debug.php on line 20. This points to my
code that evaluates the second element of the array $zip_to =
trim(substr($zip_forward[1], 0, 5));
If I never evaluate the $zip_forward[1] array element within the if
conditional, why would PHP test the array $zip_forward for the proper number
of elements?
Okay, if you're getting that NOTICE then the line of code is executing. 
So even though you think the strlen() line is failing, it's not.

Anyhow, the whole issue here is just that your two servers have 
different error_reporting() levels. One is set to show NOTICES while the 
other is not. If you use @trim(...), you can suppress this warning.

The code is running the same on both servers, though...

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

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


[PHP] Accessing .bat file from PHP

2003-11-30 Thread Reidar Solberg
I want to start a .bat file on my local pc from my webpage -  to download
some .txt files.
I run PHP in my webpage - how can I make contact with the .bat file? Anyone
tried this?

Reidar Solberg

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



Re: [PHP] Accessing .bat file from PHP

2003-11-30 Thread Nathan Taylor
I believe... that the .bat file MUST be on the server for PHP to execute it.

Nathan
  - Original Message - 
  From: Reidar Solberg 
  To: [EMAIL PROTECTED] 
  Sent: Sunday, November 30, 2003 1:10 PM
  Subject: [PHP] Accessing .bat file from PHP


  I want to start a .bat file on my local pc from my webpage -  to download
  some .txt files.
  I run PHP in my webpage - how can I make contact with the .bat file? Anyone
  tried this?

  Reidar Solberg

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



RE: [PHP] Accessing .bat file from PHP

2003-11-30 Thread Jeroen Serpieters
exec()?

http://php.net/exec

Jeroen

--
Thou shalt not follow the NULL pointer, for chaos and madness await thee at
its end. 
(Henry Spencer) 

Politics.be op imode!
http://i.politics.be/

-Original Message-
From: Reidar Solberg [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 30, 2003 7:10 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Accessing .bat file from PHP


I want to start a .bat file on my local pc from my webpage -  to download
some .txt files. I run PHP in my webpage - how can I make contact with the
.bat file? Anyone tried this?

Reidar Solberg

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

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



[PHP] How to see the table structure

2003-11-30 Thread narayanan
Title: Blank



Can any body tell how to view the structure of a table from php.  I 
was thinking around for the past two days.  I am using postgresql 
database.
 
 
thanks in advance
 


Re: [PHP] Undefined offset on Windows not on Apache?

2003-11-30 Thread Chris Williams
I don't believe the disputed line of script is being executed because just
before that line I include the following print statement,
echo "array size: " . count($zip_forward) . "  ID: $location_id";
which does not get executed when my conditional fails.

Right you are on the error reporting, I included error_reporting (E_ALL); in
my test script and can reproduce same error on Apache.

Chris


"John W. Holmes" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Chris Williams wrote:
> > The first and last lines contain carriage returns. The second or middle
line
> > contains sample data.
> >
> > The script that reads and parses the data is:
> >
> >   $countLines = fopen("data.txt", "r");
> >   while (!feof($countLines))
> >   {
> >$newLine = fgets($countLines, 1024);
> >echo "line length:  " . strlen($newLine) . "";
> >if(strlen($newLine) > 0)
> >{
> >$newLine = ereg_replace ("\"", "", $newLine);
> >$zip_forward = explode(",",$newLine);
> >$location_id = trim($zip_forward[0]);
> >echo "array size: " . count($zip_forward) . "  ID: $location_id";
> >$zip_to = trim(substr($zip_forward[1], 0, 5));
> >}
> >   }
> >   fclose($countLines);
> >
> > What's odd here is that the last line, which has a length of 0, should
never
> > cause the if(strlen($newLine) > 0) to execute the lines of script
contained
> > within the if conditional. And in fact the lines DON'T get executed.
> > However, on the Windows server I get the following error
> > PHP Notice: Undefined offset: 1 in \debug.php on line 20. This points to
my
> > code that evaluates the second element of the array $zip_to =
> > trim(substr($zip_forward[1], 0, 5));
> >
> > If I never evaluate the $zip_forward[1] array element within the if
> > conditional, why would PHP test the array $zip_forward for the proper
number
> > of elements?
>
> Okay, if you're getting that NOTICE then the line of code is executing.
> So even though you think the strlen() line is failing, it's not.
>
> Anyhow, the whole issue here is just that your two servers have
> different error_reporting() levels. One is set to show NOTICES while the
> other is not. If you use @trim(...), you can suppress this warning.
>
> The code is running the same on both servers, though...
>
> --
> ---John Holmes...
>
> Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
>
> php|architect: The Magazine for PHP Professionals – www.phparch.com

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



php-general Digest 30 Nov 2003 18:30:47 -0000 Issue 2446

2003-11-30 Thread php-general-digest-help

php-general Digest 30 Nov 2003 18:30:47 - Issue 2446

Topics (messages 171389 through 171405):

Re: require_once() or die(); = fatal error
171389 by: Rasmus Lerdorf

Re: [PHP-DB] Dynamic Website Question!
171390 by: Bronislav Klucka
171391 by: JeRRy
171392 by: Bronislav Klucka
171394 by: Bronislav Klucka

Re: Suggestions for optimization?
171393 by: Eugene Lee

Export data
171395 by: Rosen

PHP or PEAR MEETING on FOSDEM 2004 (belgium) ?
171396 by: Christophe Gesché

Undefined offset on Windows not on Apache?
171397 by: Chris Williams
171398 by: Chris Williams
171400 by: John W. Holmes
171405 by: Chris Williams

Radius question
171399 by: Robin Kopetzky

Accessing  .bat file from PHP
171401 by: Reidar Solberg
171402 by: Nathan Taylor
171403 by: Jeroen Serpieters

How to see the table structure
171404 by: narayanan

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 ---
By default the CLI version turns off the html in the error messages.  And 
no, really, there is no bug here.  You are testing the return code of 
something that doesn't have one.  It doesn't make sense.

-Rasmus

On Fri, 28 Nov 2003, Daevid Vincent wrote:

> Hmm... Well Rasmus, I do see your point, however it still seems to me it
> 'should' at least compile and work as I expect it to.
> 
> My way, the logic is that the file *is* 'required' (whereas I view 'include'
> files as optional), and I want to exit the program with a graceful message
> instead of the fatal error (which doesn't really doesn't tell me what the
> problem is -- "Failed opening required '1'" doesn't mean anything to me or
> the user) that is shown. My intent was to put a  @require_once() so that I
> could do just that. Especially since I'm running my script on the command
> line, and your stock fatal error message uses HTML tags.
> 
> Not a critical bug or a show stopper, but I do still feel it is a bug.
> 
> > -Original Message-
> > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday, November 26, 2003 8:55 PM
> > To: Daevid Vincent
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] BUG: require_once() or die(); = fatal error
> > 
> > This code doesn't make much sense.  By definition, if require 
> > cannot open
> > a file it throws a fatal error, so you would never hit the "or" case
> > anyway.  Hence there is no return code from require and you 
> > can't write
> > code like this.  If you want to test the return code you need to use
> > 'include' instead.
> > 
> > -Rasmus
> > 
> > On Wed, 26 Nov 2003, Daevid Vincent wrote:
> > 
> > > Using PHP 4.2.2 on Linux RH8:
> > >
> > > In a PHP script run from command line,
> > >
> > >   require_once("gibberator_data.php") or die("No Data 
> > file found\n");
> > >
> > > Causes:
> > >
> > > [EMAIL PROTECTED] gibberator]# ./gibberator.php
> > > 
> > > Fatal error:  Failed opening required '1'
> > > (include_path='.:/php/includes;/usr/share/phpwebtools') in
> > > /home/gibberator/gibberator.php on line 13
> > >
> > > However
> > >
> > >   require_once("gibberator_data.php");
> > >
> > > Works just fine.
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > 
> 
--- End Message ---
--- Begin Message ---
> I want to have a PHP website that feeds information
> off a mysql database.  But generally changes occour
> and instead of asking users to refresh the page to get
> the updates is there a way to provide the updates
> without them needing to refresh the page?
>
> E.G. For like shooping Carts, Chat rooms, etc...
>
> Is there a way in PHP or something to make updates
> show up live as they happen instead of the yucky meta
> refresh tag in HTML?
>
> Thanks for your time in advance.

I'm sorry, I always dissapoint you, but what ever you want to send to
browser must be demend by the browser. I mean you can tell browser to reload
part of the page, browser has to ask for it, you can send more information
to the browser and then use DHTML to provide the showing, or hiding...

There is only one way how to do, what you want (but it always ask the
server, only user will not see reloading). The way is to have 2 frames: 1st
for showing the content and the second to refresh every 1 min. (or as you
want), receive informations and using DHTML change the content of the first
frame, the secomd frame could be at the bootom of the browser, 1pixel
height, to be "invisible"



Brona
--- End Message ---
--- Begin Message ---
Hi,

I am not familiar with DHTML and how it can be used to
talk to PHP to update a certain part of a page.  That
is all I need, is one section of the page, no

[PHP] Stumped

2003-11-30 Thread Brian V Bonini
Warning: Invalid argument supplied for foreach() in
/usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
line 42

Warning: Invalid argument supplied for foreach() in
/usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
line 57

42: foreach ($_GET as $secvalue) {
57: foreach ($_POST as $secvalue) {

%less php.ini
register_globals = On

%./php -i | grep -i globals
register_globals => On => On

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



[PHP] Variables - showing onpage

2003-11-30 Thread Biph
I have a question, and maybe I'm an idiot (alright not maybe). I can't get
the damned variables to stop showing their variable names on the screen,
like a variable $stock_quote appears in the HTML as $stock_quote, what the
hell am I doing wrong? I'm using Win2K to test a site on my own computer
using Apache2, but all variables from MySQL to PHP are just showing up as
the variable name and not the value in the HTML.Any help would be nice.
example:

is apprearing as:
the price is $price
in the HTML instead of:
the price is 1.00

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



Re: [PHP] Stumped

2003-11-30 Thread Jason Wong
Please use a DESCRIPTIVE subject!

On Monday 01 December 2003 02:51, Brian V Bonini wrote:
> Warning: Invalid argument supplied for foreach() in
> /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> line 42
>
> Warning: Invalid argument supplied for foreach() in
> /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> line 57
>
> 42: foreach ($_GET as $secvalue) {
> 57: foreach ($_POST as $secvalue) {
>
> %less php.ini
> register_globals = On
>
> %./php -i | grep -i globals
> register_globals => On => On

What does phpversion() show? 

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
"Indecision is the basis of flexibility"
-- button at a Science Fiction convention.
*/

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



Re: [PHP] Variables - showing onpage

2003-11-30 Thread Jason Wong
On Sunday 30 November 2003 15:54, Biph wrote:
> I have a question, and maybe I'm an idiot (alright not maybe). I can't get
> the damned variables to stop showing their variable names on the screen,
> like a variable $stock_quote appears in the HTML as $stock_quote, what the
> hell am I doing wrong? I'm using Win2K to test a site on my own computer
> using Apache2, but all variables from MySQL to PHP are just showing up as
> the variable name and not the value in the HTML.Any help would be nice.
> example:
>  $price = 1.00
> print('the price is: $price')
> ?>
> is apprearing as:
> the price is $price
> in the HTML instead of:
> the price is 1.00

manual > Chapter 7 > Strings

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
I had the rare misfortune of being one of the first people to try and
implement a PL/1 compiler.
-- T. Cheatham
*/

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



RE: [PHP] Variables - showing onpage

2003-11-30 Thread Jeroen Serpieters
You have to put it between double quotes.

Jeroen

--
Thou shalt not follow the NULL pointer, for chaos and madness await thee at
its end. 
(Henry Spencer) 

Politics.be op imode!
http://i.politics.be/

-Original Message-
From: Biph [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 30, 2003 8:54 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Variables - showing onpage


I have a question, and maybe I'm an idiot (alright not maybe). I can't get
the damned variables to stop showing their variable names on the screen,
like a variable $stock_quote appears in the HTML as $stock_quote, what the
hell am I doing wrong? I'm using Win2K to test a site on my own computer
using Apache2, but all variables from MySQL to PHP are just showing up as
the variable name and not the value in the HTML.Any help would be nice.
example:

is apprearing as:
the price is $price
in the HTML instead of:
the price is 1.00

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

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



[PHP] How to view the structure of a table

2003-11-30 Thread narayanan
Title: Blank



Can any tell me how to view the structure of a table from php.  I am 
using postgresql database.
 
thanks in advance
narayanan
 
[EMAIL PROTECTED]
 


Re: [PHP] Variables - showing onpage

2003-11-30 Thread John Nichel
Biph wrote:

I have a question, and maybe I'm an idiot (alright not maybe). I can't get
the damned variables to stop showing their variable names on the screen,
like a variable $stock_quote appears in the HTML as $stock_quote, what the
hell am I doing wrong? I'm using Win2K to test a site on my own computer
using Apache2, but all variables from MySQL to PHP are just showing up as
the variable name and not the value in the HTML.Any help would be nice.
example:

is apprearing as:
the price is $price
in the HTML instead of:
the price is 1.00
PHP will not interpret variables inside of single quotes.  Use double 
quotes, or break out of the quotes...

print("the price is: $price")
print('the price is: ' . $price)
http://us3.php.net/manual/en/language.types.string.php

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] How to view the structure of a table

2003-11-30 Thread Chris Garaffa
On Nov 30, 2003, at 2:07 PM, narayanan wrote:

Can any tell me how to view the structure of a table from php.  I am 
using postgresql database.
A Google search for postgresql describe table revealed this as the 
first result:

http://forums.devshed.com/t38544/s.html

Quote:
"To get fields from a table unfortunately, there is no simple command. 
But, you can query the PostgreSQL internal tables such as pg_class for 
that info:"

You can then use the PostgreSQL functions (documentation at 
) to go through the 
results.

HTH

--
Chris Garaffa
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] getting an variable value from an array entry

2003-11-30 Thread Ian Truelsen
I am trying to do the following:

I have a text file to read in that contains something like "The
temperature is $temp"

This gets read into an array so that I can parse it out word by word
(the only way I could think to do this, any other ideas are welcome). I
do a test to see whether the first letter is a $ and then pull try to
print $temp.

What I can't figure out is how to have the value of $temp printed as
opposed to "$temp" which is where I am at the moment. I have tried the
complex {} approach from the manual, but it doesn't get me what I am
looking for.

Can anyone tell me what the appropriate syntax would be for doing this?
Or some other way to deal with the issue would be good as well.

Thanks in advance.

-- 
Ian Truelsen
Email: [EMAIL PROTECTED]
AIM: ihtruelsen
Homepage: http://www.ihtruelsen.dyndns.org
Signature key (742B740D) available at pgp.mit.edu



pgp0.pgp
Description: PGP signature


[PHP] Script help about array dimension

2003-11-30 Thread orlandopozo
I have this array definition:

$array['ojpp'][1][][] = 'ferrer';
$array['test'][0] = 'ojpp';
$array['test'][1] = 'ferrer';

How could I do a script that give me this output:

Array
(
[0] => Array
(
[0] => ojpp
[1] => 1
[2] => 0
[3] => 0
)

[1] => Array
(
[0] => test
[1] => 0
)

[2] => Array
(
[0] => test
[1] => 1
)

)

Thanks in advanced for any help :).


RE: [PHP] getting an variable value from an array entry

2003-11-30 Thread Bronislav Klucka
The temperature is $$temp

Brona

> -Original Message-
> From: Ian Truelsen [mailto:[EMAIL PROTECTED]
> Sent: Sunday, November 30, 2003 9:27 PM
> To: php
> Subject: [PHP] getting an variable value from an array entry
> 
> 
> I am trying to do the following:
> 
> I have a text file to read in that contains something like "The
> temperature is $temp"
> 
> This gets read into an array so that I can parse it out word by word
> (the only way I could think to do this, any other ideas are welcome). I
> do a test to see whether the first letter is a $ and then pull try to
> print $temp.
> 
> What I can't figure out is how to have the value of $temp printed as
> opposed to "$temp" which is where I am at the moment. I have tried the
> complex {} approach from the manual, but it doesn't get me what I am
> looking for.
> 
> Can anyone tell me what the appropriate syntax would be for doing this?
> Or some other way to deal with the issue would be good as well.
> 
> Thanks in advance.
> 
> -- 
> Ian Truelsen
> Email: [EMAIL PROTECTED]
> AIM: ihtruelsen
> Homepage: http://www.ihtruelsen.dyndns.org
> Signature key (742B740D) available at pgp.mit.edu
> 
> 

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



RE: [PHP] BUG: fatal error uses html in cgi version (WAS: require_once() or die(); = fatal error)

2003-11-30 Thread Daevid Vincent
Hmm.. It's not turning it off for me. Hence the reason I tried to handle it
gracefully myself. ;-)

I get exactly what you see there below for the fatal error. This is from an
RPM package for RH8. perhaps it is fixed in a version since 4.2.2? 

> -Original Message-
> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, November 29, 2003 10:48 PM
> To: Daevid Vincent
> Cc: [EMAIL PROTECTED]
> Subject: RE: [PHP] BUG: require_once() or die(); = fatal error
> 
> By default the CLI version turns off the html in the error 
> messages.  And no, really, there is no bug here.  You are testing the
return code of 
> something that doesn't have one.  It doesn't make sense.
> 
> -Rasmus
> 
> On Fri, 28 Nov 2003, Daevid Vincent wrote:
> 
> > Hmm... Well Rasmus, I do see your point, however it still 
> seems to me it
> > 'should' at least compile and work as I expect it to.
> > 
> > My way, the logic is that the file *is* 'required' (whereas 
> I view 'include'
> > files as optional), and I want to exit the program with a 
> graceful message
> > instead of the fatal error (which doesn't really doesn't 
> tell me what the
> > problem is -- "Failed opening required '1'" doesn't mean 
> anything to me or
> > the user) that is shown. My intent was to put a  
> @require_once() so that I
> > could do just that. Especially since I'm running my script 
> on the command
> > line, and your stock fatal error message uses HTML tags.
> > 
> > Not a critical bug or a show stopper, but I do still feel 
> it is a bug.
> > 
> > > -Original Message-
> > > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] 
> > > Sent: Wednesday, November 26, 2003 8:55 PM
> > > To: Daevid Vincent
> > > Cc: [EMAIL PROTECTED]
> > > Subject: Re: [PHP] BUG: require_once() or die(); = fatal error
> > > 
> > > This code doesn't make much sense.  By definition, if require 
> > > cannot open
> > > a file it throws a fatal error, so you would never hit 
> the "or" case
> > > anyway.  Hence there is no return code from require and you 
> > > can't write
> > > code like this.  If you want to test the return code you 
> need to use
> > > 'include' instead.
> > > 
> > > -Rasmus
> > > 
> > > On Wed, 26 Nov 2003, Daevid Vincent wrote:
> > > 
> > > > Using PHP 4.2.2 on Linux RH8:
> > > >
> > > > In a PHP script run from command line,
> > > >
> > > > require_once("gibberator_data.php") or die("No Data 
> > > file found\n");
> > > >
> > > > Causes:
> > > >
> > > > [EMAIL PROTECTED] gibberator]# ./gibberator.php
> > > > 
> > > > Fatal error:  Failed opening required '1'
> > > > (include_path='.:/php/includes;/usr/share/phpwebtools') in
> > > > /home/gibberator/gibberator.php on line 13
> > > >
> > > > However
> > > >
> > > > require_once("gibberator_data.php");
> > > >
> > > > Works just fine.
> > > >
> > > > --
> > > > PHP General Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> > > 
> > 
> 

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



[PHP] Script help about array dimension

2003-11-30 Thread orlandopozo
I have this array definition:

$array['ojpp'][1][][] = 'ferrer';
$array['test'][0] = 'ojpp';
$array['test'][1] = 'ferrer';

How could I do a script that give me this output:

Array
(
[0] => Array
(
[0] => ojpp
[1] => 1
[2] => 0
[3] => 0
)

[1] => Array
(
[0] => test
[1] => 0
)

[2] => Array
(
[0] => test
[1] => 1
)

)

Thanks in advanced for any help :).

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



Re: [PHP] getting an variable value from an array entry

2003-11-30 Thread Ian Truelsen
On Sun, 30 Nov 2003 21:44:50 +0100
"Bronislav Klucka" <[EMAIL PROTECTED]> wrote:

> The temperature is $$temp
> 
Unfortunately, that is not working for me. I have tried changing it in
the text file, but that just outputs $$temp instead of the value of
$temp. What I have is the array words, for which the relevant entry is
words[3] being equal to "$temp". What I need to be able to do is to
print $words[3]; in such a way that it outputs the value of $temp and
not the value of $words[3]. 

I also tried print $$words[3] but that outputs nothing. I tried print
$($words[3]); but that gives a parse error. And print ${$words[3]}
prints out nothing.

Thanks for the help though.

-- 
Ian Truelsen
Email: [EMAIL PROTECTED]
AIM: ihtruelsen
Homepage: http://www.ihtruelsen.dyndns.org
Signature key (742B740D) available at pgp.mit.edu



pgp0.pgp
Description: PGP signature


Re: [PHP] getting an variable value from an array entry

2003-11-30 Thread zhuravlev alexander
On Sun, Nov 30, 2003 at 01:04:08PM -0800, Ian Truelsen wrote:
> On Sun, 30 Nov 2003 21:44:50 +0100
> "Bronislav Klucka" <[EMAIL PROTECTED]> wrote:
> 
> > The temperature is $$temp
> > 
> Unfortunately, that is not working for me. I have tried changing it in
> the text file, but that just outputs $$temp instead of the value of
> $temp. What I have is the array words, for which the relevant entry is
> words[3] being equal to "$temp". What I need to be able to do is to
> print $words[3]; in such a way that it outputs the value of $temp and
> not the value of $words[3]. 
> 
> I also tried print $$words[3] but that outputs nothing. I tried print
> $($words[3]); but that gives a parse error. And print ${$words[3]}
> prints out nothing.

Use eval. http://www.php.net/eval

% cat temp.txt
Temperature $temp degree.
% cat temp.php
";
eval("\$result = \"".addslashes($code)."\";");
echo $result;
?>

 -- zhuravlev alexander
   u l s t u  n o c
 ([EMAIL PROTECTED])

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



Re: [PHP] getting an variable value from an array entry

2003-11-30 Thread Ian Truelsen
On Mon, 1 Dec 2003 00:16:07 +0300
zhuravlev alexander <[EMAIL PROTECTED]> wrote:


>   Use eval. http://www.php.net/eval
> 
> % cat temp.txt
> Temperature $temp degree.
> % cat temp.php
>  
>   $temp = '5';
>  
>   $filename = "./temp.txt"; 
>   $handle = fopen ($filename, "r"); 
>   $code = fread ($handle, filesize ($filename)); 
>   fclose ($handle);
>   print $code."";
>   eval("\$result = \"".addslashes($code)."\";");
>   echo $result;
> ?>
> 
Thanks a lot. That is exactly what I hoped I could do.

-- 
Ian Truelsen
Email: [EMAIL PROTECTED]
AIM: ihtruelsen
Homepage: http://www.ihtruelsen.dyndns.org
Signature key (742B740D) available at pgp.mit.edu



pgp0.pgp
Description: PGP signature


[PHP] config/compile problems

2003-11-30 Thread Brian V Bonini
'./configure' '--with-apxs=/usr/local/www/bin/apxs'
'--with-config-file-path=/usr/local/www/etc' '--enable-versioning'
'--with-system-regex' '--disable-debug' '--enable-track-vars'
'--with-gd=/usr/local' '--with-freetype-dir=/usr/local'
'--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-zlib'
'--with-imap=/usr/local' '--with-mysql=/usr/local'
'--with-imap=/usr/local' '--prefix=/usr/local/www' 'i386--freebsd4.4'

Couple secs into make:

/root/php-4.3.4/ext/imap/php_imap.c:342: syntax error before `QUOTALIST'
/root/php-4.3.4/ext/imap/php_imap.c: In function `mail_getquota':
/root/php-4.3.4/ext/imap/php_imap.c:351: `qlist' undeclared (first use
in this function)
/root/php-4.3.4/ext/imap/php_imap.c:351: (Each undeclared identifier is
reported only once
/root/php-4.3.4/ext/imap/php_imap.c:351: for each function it appears
in.)
/root/php-4.3.4/ext/imap/php_imap.c: In function `zif_imap_get_quota':
/root/php-4.3.4/ext/imap/php_imap.c:889: `SET_QUOTA' undeclared (first
use in this function)
/root/php-4.3.4/ext/imap/php_imap.c: In function
`zif_imap_get_quotaroot':
/root/php-4.3.4/ext/imap/php_imap.c:917: `SET_QUOTA' undeclared (first
use in this function)
*** Error code 1

Stop in /root/php-4.3.4.


%uname -a
FreeBSD gfx-design.com 4.4-RELEASE FreeBSD 4.4-RELEASE #0: Wed Aug 28
19:41:18 GMT 2002 [EMAIL PROTECTED]:/usr/src/sys/compile/SERVER  i386
%

Current install:

Server Version: Apache/1.3.22 (Unix) PHP/4.0.6 mod_perl/1.26
   FrontPage/5.0.2.2623 AuthMySQL/2.20 mod_ssl/2.8.5 OpenSSL/0.9.6a
   Server Built: Sep 24 2002 17:50:11

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



[PHP] Stumped

2003-11-30 Thread Brian V Bonini
Warning: Invalid argument supplied for foreach() in
/usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
line 42

Warning: Invalid argument supplied for foreach() in
/usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
line 57

42: foreach ($_GET as $secvalue) {
57: foreach ($_POST as $secvalue) {

%less php.ini
register_globals = On

%./php -i | grep -i globals
register_globals => On => On

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



Re: [PHP] Stumped

2003-11-30 Thread Robert Cummings
On Sun, 2003-11-30 at 18:45, Brian V Bonini wrote:
> Warning: Invalid argument supplied for foreach() in
> /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> line 42
> 
> Warning: Invalid argument supplied for foreach() in
> /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> line 57
> 
> 42: foreach ($_GET as $secvalue) {
> 57: foreach ($_POST as $secvalue) {
> 
> %less php.ini
> register_globals = On
> 
> %./php -i | grep -i globals
> register_globals => On => On

Which version of PHP?

Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Stumped

2003-11-30 Thread Brian V Bonini
On Sun, 2003-11-30 at 19:21, Robert Cummings wrote:
> On Sun, 2003-11-30 at 18:45, Brian V Bonini wrote:
> > Warning: Invalid argument supplied for foreach() in
> > /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> > line 42
> > 
> > Warning: Invalid argument supplied for foreach() in
> > /usr/local/www/vhosts/pa.eastcoastbicycles.com/htdocs/mainfile.php on
> > line 57
> > 
> > 42: foreach ($_GET as $secvalue) {
> > 57: foreach ($_POST as $secvalue) {
> > 
> > %less php.ini
> > register_globals = On
> > 
> > %./php -i | grep -i globals
> > register_globals => On => On
> 
> Which version of PHP?


Yup, that was the issue.. ;-) It was 4.0.something (old) so I installed
a 4.3.x version and it's good to go. Thanks!

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



Re: [PHP] move_uploaded_file, umask, and permissions

2003-11-30 Thread David T-G
Hi, all --

...and then David T-G said...
% 
...
% I have set my umask to 117 (and I change it when making a directory) and
% I use move_uploaded_file to handle submitted files.
...
% Must I really run chmod() on every move_uploaded_file() I process?  Isn't
% there a better way?

Wow, it's not often that a post falls completely on deaf ears here.
Maybe I'm the first person who's ever reported this problem.  I'll be
famous!  Men of all nations will bow down before me!!!

Nah; more likely that it just isn't that important.  Does *nobody* else
have this problem, really?!?


TIA & HAND

:-D
-- 
David T-G  * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp0.pgp
Description: PGP signature


Re: [PHP] How to see the table structure

2003-11-30 Thread Eugene Lee
On Sun, Nov 30, 2003 at 11:53:41PM +0530, narayanan wrote:
: 
: BlankCan any body tell how to view the structure of a table from php.
: I was thinking around for the past two days.  I am using postgresql
: database.

>From the command line psql monitor, do a "\d ".

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



Re: [PHP] getting an variable value from an array entry

2003-11-30 Thread Curt Zirzow
* Thus wrote zhuravlev alexander ([EMAIL PROTECTED]):
> 
> % cat temp.txt
> Temperature $temp degree.
> % cat temp.php
>  
>   $temp = '5';
>  
>   $filename = "./temp.txt"; 
>   $handle = fopen ($filename, "r"); 
>   $code = fread ($handle, filesize ($filename)); 
>   fclose ($handle);
>   print $code."";
>   eval("\$result = \"".addslashes($code)."\";");
>   echo $result;
> ?>

- or -

$code = file_get_contents($filename);
$result = str_replace('$temp', $temp, $code);
echo $results;

Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



[PHP] RE: [PHP-DB] Dynamic Website Question!

2003-11-30 Thread JeRRy
Hi,

Okay let me explain what I want to do.

Now I have a variety of queries to do to the database
and echo's to echo out and how to output on the PHP
page.  But I am not sure how to get my code (below)
sucessfully to work in the example in the previous
email.  (found lower)  Could someone point me in the
right direction please?  I need the echo's shown in
the queries to be outputed on the page as it says. 
But I need only that part of the page to be refreshed
once every 5 seconds and not the enitre page to
reload.. Just the data from the database.

Here is my code:

 '$username'";

$result=mysql_query($sql, $conn);

// toon lijst met users

while ($myrow =
mysql_fetch_array($result))

{

// show name of friend

echo "$myrow[naam]";

// count all mesages for this user

$sql = "SELECT count(*) as
aantal FROM message where recipient =
'$username' AND sender = '$myrow[naam]'";

   
$messageresult=mysql_query($sql, $conn);

// toon aantal messsages per vriend

$myrow2 =
mysql_fetch_array($messageresult);

if ($myrow2[aantal] <> 0)

{

// kijk of er nog nieuwe messages zijn

$sql = "SELECT isread
FROM message where recipient =
'$username' AND sender = '$myrow[naam]' AND isread=0";

   
$readmessageresult=mysql_query($sql, $conn);

$myrow3 =
mysql_fetch_array($readmessageresult);

echo " ";

if ($myrow3[isread] ==
null)

{

echo "(".
$myrow2[aantal] . ")";

}else{

echo "(".
$myrow2[aantal] . ")";

}

}

// show online/offline status

if ($timestamp -
totime($myrow[lastlogin]) > $isonlineseconds)

{

echo " $langisoffline";

}else{

echo " $langisonline";

}

// give admin delete possibility

if ($adminloginname ==
$username)

{

echo " x";

}else{

echo "";

}

}


?>

Now maybe I need to do each query seperately to work
in the example below?  But how.. And remembering to
output the echo's and not what the database provides. 
As I need it to be formated as in the echo.  Unless I
remove the echo's and put the results as defined in
the example below.

> function DoOnLoad(){
>   ele=PSGetElementById(parent.frames[0],"text");
>   ele.innerHTML="";
   ^

With "myrow['whatever']"

I'm not sure, new to this stuff, but thought I'd post
my code, maybe someone could whack up a code that
functions The code of the refreshing part is below
with all pages relevant to it.

(please note i emailed the person that gave me the
code below and replied with my code but they have not
replied as of yet of how to get it to function so that
is why i posted on here also.)

Jerry

 --- Bronislav Klucka <[EMAIL PROTECTED]>
wrote: > index.php
> 
>frameborder="no">
>   
>   
>
> 
> first.php
> 
> 
>   
> 
> 
> second.php
> 
> 
>content="10;URL=second.php">
> 
> function PSBrowser(){
>   this.ns4 = (window.document.layers);
>   this.ie4 = (window.document.all &&
> !window.document.getElementById);
>   this.ie5 = (window.document.all &&
> window.document.getElementById);
>   this.ns6 = (!window.document.all &&
> window.document.getElementById);
>   this.op =
> window.navigator.appName.indexOf('Opera')!=-1;
> }
> 
> function PSGetElementById(frame,id){
>   var b=new PSBrowser();
>   var new_obj=null;
>   if(b["ns4"]){
>   new_obj=frame.document.layers[id];
>   } else if(b["ie4"]){
>   new_obj=frame.document.all[id];
>   } else if(b["ie5"] || b["ns6"]){
>   new_obj=frame.document.getElementById(id);
>   }   
>   return new_obj;
> }
> 
> function DoOnLoad(){
>   ele=PSGetElementById(parent.frames[0],"text");
>   ele.innerHTML="";
> }
>  
> 
> 
> 
>
> 
> 
> 
> is that clear?
> 
> > 
> > Hi,
> > 
> > I am not familiar with DHTML and how it can be
> used to
> > talk to PHP to update a certain part of a page. 
> That
> > is all I need, is one section of the page, not the
> > entire page, to be refreshed.  The part is just
> text
> > 

Re: [PHP] Script help about array dimension

2003-11-30 Thread Curt Zirzow
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
> $array['ojpp'][1][][] = 'ferrer';
> $array['test'][0] = 'ojpp';
> $array['test'][1] = 'ferrer';
> 
> How could I do a script that give me this output:
> 
> Array
> (
> [0] => Array
> (
> [0] => ojpp
> [1] => 1
> [2] => 0
> [3] => 0
> )
I'm not sure what your asking this makes no sense to me. Try and
explain what you are trying to do.

Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



Re: [PHP] config/compile problems

2003-11-30 Thread Curt Zirzow
* Thus wrote Brian V Bonini ([EMAIL PROTECTED]):
> './configure' '--with-apxs=/usr/local/www/bin/apxs'
> '--with-config-file-path=/usr/local/www/etc' '--enable-versioning'
> '--with-system-regex' '--disable-debug' '--enable-track-vars'
> '--with-gd=/usr/local' '--with-freetype-dir=/usr/local'
> '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local' '--with-zlib'
> '--with-imap=/usr/local' '--with-mysql=/usr/local'
> '--with-imap=/usr/local' '--prefix=/usr/local/www' 'i386--freebsd4.4'

Any reson why you have two --with-imaps's?

> 
> Couple secs into make:
> 
> /root/php-4.3.4/ext/imap/php_imap.c:342: syntax error before `QUOTALIST'

It seems you might have a issue with the version of headers found
vs the actual libraries being used. The function mail_getquota()
should only be define if you have imap2000 or imap2001 libraries.

HTH,

Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



Re: [PHP] RE: [PHP-DB] Dynamic Website Question!

2003-11-30 Thread JeRRy
I am using frames.  As mentioned in the email(s)... If
you read it it shows 3 different php files.  One is
the index to display 1 frame and hide the second
frame.  The displaying frame has the outputed
information and a section defined to be refreshed by
the hidden frame.  The hidden frame consists of the
parameters to refresh frame showing and tell frame
showing to update a set area with updated information.

The email(s) state that, read all emails.

Jerry

 --- Jason Sheets <[EMAIL PROTECTED]> wrote:
> JeRRy wrote:
> 
> >Hi,
> >
> >Okay let me explain what I want to do.
> >
> >Now I have a variety of queries to do to the
> database
> >and echo's to echo out and how to output on the PHP
> >page.  But I am not sure how to get my code (below)
> >sucessfully to work in the example in the previous
> >email.  (found lower)  Could someone point me in
> the
> >right direction please?  I need the echo's shown in
> >the queries to be outputed on the page as it says. 
> >But I need only that part of the page to be
> refreshed
> >once every 5 seconds and not the enitre page to
> >reload.. Just the data from the database.
> >
> >Here is my code:
> >
> > >
> >require('header.php');
> >
> >// delete user if user=admin and action=deleteuser
> >
> >if ($username == $adminloginname AND
> $action
> >== "deleteuser")
> >
> >{
> >
> >$sql = "DELETE from user WHERE
> >naam='$delname'";
> >
> >mysql_query($sql, $conn);
> >
> >//also delete his/her messages
> >
> >$sql = "DELETE from message WHERE
> >sender = '$delname' OR recipient = '$delname'";
> >
> >mysql_query($sql, $conn);
> >
> >}
> >
> >
> >
> >//get all users
> >
> >$sql = "SELECT naam, lastlogin FROM
> >user where naam <> '$username'";
> >
> >$result=mysql_query($sql, $conn);
> >
> >// toon lijst met users
> >
> >while ($myrow =
> >mysql_fetch_array($result))
> >
> >{
> >
> >// show name of friend
> >
> >echo " >href=send.php?recipientname=" .
> >htmlentities(urlencode($myrow[naam])) . "> >color=\"$linkcolor\">$myrow[naam]";
> >
> >// count all mesages for this user
> >
> >$sql = "SELECT count(*) as
> >aantal FROM message where recipient =
> >'$username' AND sender = '$myrow[naam]'";
> >
> >   
> >$messageresult=mysql_query($sql, $conn);
> >
> >// toon aantal messsages per vriend
> >
> >$myrow2 =
> >mysql_fetch_array($messageresult);
> >
> >if ($myrow2[aantal] <> 0)
> >
> >{
> >
> >// kijk of er nog nieuwe messages
> zijn
> >
> >$sql = "SELECT
> isread
> >FROM message where recipient =
> >'$username' AND sender = '$myrow[naam]' AND
> isread=0";
> >
> >   
> >$readmessageresult=mysql_query($sql, $conn);
> >
> >$myrow3 =
> >mysql_fetch_array($readmessageresult);
> >
> >echo "  >href=\"messages.php?sender=" .
> >htmlentities(urlencode($myrow[naam])) . "\">";
> >
> >if ($myrow3[isread]
> ==
> >null)
> >
> >{
> >
> >echo " >color=\"$oldmessagecolor\">(".
> >$myrow2[aantal] . ")";
> >
> >}else{
> >
> >echo " >color=\"$newmessagecolor\">(".
> >$myrow2[aantal] . ")";
> >
> >}
> >
> >}
> >
> >// show online/offline status
> >
> >if ($timestamp -
> >totime($myrow[lastlogin]) > $isonlineseconds)
> >
> >{
> >
> >echo "  >color=\"$offlinecolor\">$langisoffline";
> >
> >}else{
> >
> >echo "  >color=\"$onlinecolor\">$langisonline";
> >
> >}
> >
> >// give admin delete possibility
> >
> >if ($adminloginname ==
> >$username)
> >
> >{
> >
> >echo "  >href=\"index.php?action=deleteuser&delname=" .
> >htmlentities(urlencode($myrow[naam])) . "\"> >color=\"$linkcolor\">x";
> >
> >}else{
> >
> >echo "";
> >
> >}
> >
> >}
> >
> >
> >?>
> >
> >Now maybe I need to do each query seperately to
> work
> >in the example below?  But how.. And remembering to
> >output the echo's and not what the database
> provides. 
> >As I need it to be formated as in the echo.  Unless
> I
> >remove the echo's and put the results as defined in
> >the example below.
> >
> >  
> >
> >>function DoOnLoad(){
> >>ele=PSGetElementById(paren

Re: [PHP] move_uploaded_file, umask, and permissions

2003-11-30 Thread Curt Zirzow
* Thus wrote David T-G ([EMAIL PROTECTED]):
> Hi, all --
> 
> I have set my umask to 117 (and I change it when making a directory) and
> I use move_uploaded_file to handle submitted files.
> 
> The temporary file is mode 600 when it lands in /var/tmp but somehow gets
> changed to 666 during the move.  It seems that move_uploaded_file changes
> the file perms and yet does not honor the umask.
> 
> Must I really run chmod() on every move_uploaded_file() I process?  Isn't
> there a better way?

I believe it does, move_uploaded_file() uses the current
envirionment's umask which seems to be set at an awkward stage.

what is the output of:
  echo `umask`;

I bet its '11'. I'm not sure how your system is configured but it
seems the user apache is running under has that umask set that way
which, IMO, is a bad thing (tm).


Curt
-- 
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP

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



Re: [PHP] Script help about array dimension

2003-11-30 Thread Robert Cummings
On Mon, 2003-12-01 at 00:33, Curt Zirzow wrote:
> * Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
> > $array['ojpp'][1][][] = 'ferrer';
> > $array['test'][0] = 'ojpp';
> > $array['test'][1] = 'ferrer';
> > 
> > How could I do a script that give me this output:
> > 
> > Array
> > (
> > [0] => Array
> > (
> > [0] => ojpp
> > [1] => 1
> > [2] => 0
> > [3] => 0
> > )

If I understand correctly you want:

print_r( $array );

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] test

2003-11-30 Thread Xiao Fang
pls disregard. thx,

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