Fw: [PHP] str_replace

2003-03-14 Thread Hugh Danaher

- Original Message - 
From: "Hugh Danaher" <[EMAIL PROTECTED]>
To: "Sebastian" <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 11:37 PM
Subject: Re: [PHP] str_replace


> I just though up a better idea,
> put your conditional statements in your included files not in the calling
> file.  That way, the parsing of the page will pick up the conditions and
> execute them properly.
> Really hope this helps.
> Hugh
> - Original Message -
> From: "Sebastian" <[EMAIL PROTECTED]>
> To: "php list" <[EMAIL PROTECTED]>
> Sent: Friday, March 14, 2003 9:15 PM
> Subject: [PHP] str_replace
> 
> 
> > This may seem weird:
> >
> > How do I str_replace an include function?
> >
> > I want to replace this line: include("$header");
> >
> > with nothing ..
> >
> > something like this:
> >
> > $footer = str_replace(" '. include("$header"); .' ", "", $footer);
> >
> > I get errors, any ideas?
> >
> > cheers,
> > - Sebastian
> >
> 


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



Re: [PHP] inserting parameters into URLs dynamically

2003-03-14 Thread Hugh Danaher
Mo,
"(we haven't found, in our initial research, a way to do this)"
You could format your variables before they're needed in the link
something like:
if(isset($x)) $x_link="&x=$x";
if(isset($y)) $y_link="&y=$y";
etc.
then your link would look like the following
someplace.com
"slug=1" is used so that none of the preformatted variables need to start
with a ? instead of an &.  if one, or several of the preformatted variables
are empty, the line just slides to the left and fills any vacancies.  If all
your pages start with the same if(isset()) table, then the variables will be
passed around as long as the user stays at your site.  No cookies or
sessions required.
Hope this helps,
Hugh
- Original Message -
From: "Maureen Roihl" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 1:31 PM
Subject: [PHP] inserting parameters into URLs dynamically


> We are looking for a way to set several key/value pairs (which will differ
> across  users)  such  that they will persist during the user's session
and
> be  logged  in  the  weblogs for every request that user makes. Some
> potential ways of doing this that occurred to us:
>
> -  implement functionality to programmatically append these parameters to
> the  querystring  of all urls displayed across our site (far too
cumbersome,
> we don't consider this a viable option)
>
> -  find  a  way  for PHP to automatically tack the parameters onto the
ends
> of url querystrings, the same way it can do with PHPSESSIONID (we haven't
> found, in our initial research, a way to do this)
>
> Our primary goal is to get these parameters logged in the weblogs, without
> having to programmatically/physically modify every link on our site. For
> example, if we wanted to track parameters called x and y, the link on the
> page would just point to:
>
> /index.php
>
> but the weblog would show something like the following hit:
>
> /index.php?x=foo&y=bar
>
> The parameter values would need to get set once at the beginning of a
user's
> session, and then would not change over the course of that session (but
> they'd need to get tracked with every request they made). We're planning
to
> implement persistent sessions across our servers as well.
>
> 
> Maureen Roihl
> Senior Web Developer
> Smarter Living
> [EMAIL PROTECTED]
>
> --
> 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] RE: Newbie MySQL INSERT Q

2003-03-14 Thread Uttam
PHP does not allow ';' character in query strings so you'll have to break
these.

regds,
-Original Message-
From: Charles Kline [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 20:34
To: [EMAIL PROTECTED]
Subject: Newbie MySQL INSERT Q


Can I have a single SQL string do INSERTS into multiple tables?

Like:

sql="INSERT INTO tbl_1 (id,
email_address_1)
VALUES ($v_personid,
'$v_email');
INSERT INTO tbl_2 (person_id,
interest_id)
VALUES ($v_personid,
$v_int1);";

Or do I need to break them up and use two of these?

$result = $db->query($sql)

Thanks
Charles



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



Re: [PHP] Re: str_replace

2003-03-14 Thread Hugh Danaher
if the header and footer info come from your config.php file, then you have
to get to that file before it's parsed by the server.  Perhaps, splitting
config.php into three files (header.php, config.php and footer.php), then
when you want to print just call the middle file.

if(isset($_GET['print'])) include("config.php");  // printer version
if(!isset($_GET['print'])) // regular page view
{
include("header.php");
include("config.php");
include("footer.php");
}
Hope this helps.
Hugh

- Original Message -
From: "Sebastian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 10:23 PM
Subject: Re: [PHP] Re: str_replace


> doesn't work but also doesn't give any errors, I will try to explain what
I
> am trying to do:
>
> I am trying to remove the header and footer to create a "printer friendly
> page" with just the content, here's what my pages look like, I need to
> remove header and footer when they visit: file.php?action=print
>
>  include("../config.php");
>
> if($_GET[action] == "print")
> {
>$header = str_replace('include("$header");', '', $header);
>$footer = str_replace('include("$footer");', '', $footer);
> }
>
> include("$header");
> ?>
>
> // html
>
> 
>
> cheers,
> - Sebastian
>
> - Original Message -
> From: "John Gray" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, March 15, 2003 12:31 AM
> Subject: [PHP] Re: str_replace
>
>
> | $footer = str_replace('include("$header");', '', $footer);
> |
> | The way you have it now, you're telling PHP to first include the file
> | named by the variable $header, then do an str_replace on the result; but
> | the parser is going to fail on that first semi-colon, and that's not
> | what you want to do anyway (as I understand it). Put the line you want
> | to replace inside single quotes (as above) and PHP won't attempt to
> | parse it, it'll just treat it as a string literal. Hope this helps, hope
> | it makes sense.
> |
> | - john
> |
> | Sebastian wrote:
> | > This may seem weird:
> | >
> | > How do I str_replace an include function?
> | >
> | > I want to replace this line: include("$header");
> | >
> | > with nothing ..
> | >
> | > something like this:
> | >
> | > $footer = str_replace(" '. include("$header"); .' ", "", $footer);
> | >
> | > I get errors, any ideas?
> | >
> | > cheers,
> | > - Sebastian
>
>
>
> --
> 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



Re: [PHP] Re: str_replace

2003-03-14 Thread Sebastian
doesn't work but also doesn't give any errors, I will try to explain what I
am trying to do:

I am trying to remove the header and footer to create a "printer friendly
page" with just the content, here's what my pages look like, I need to
remove header and footer when they visit: file.php?action=print



// html



cheers,
- Sebastian

- Original Message -
From: "John Gray" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 15, 2003 12:31 AM
Subject: [PHP] Re: str_replace


| $footer = str_replace('include("$header");', '', $footer);
|
| The way you have it now, you're telling PHP to first include the file
| named by the variable $header, then do an str_replace on the result; but
| the parser is going to fail on that first semi-colon, and that's not
| what you want to do anyway (as I understand it). Put the line you want
| to replace inside single quotes (as above) and PHP won't attempt to
| parse it, it'll just treat it as a string literal. Hope this helps, hope
| it makes sense.
|
| - john
|
| Sebastian wrote:
| > This may seem weird:
| >
| > How do I str_replace an include function?
| >
| > I want to replace this line: include("$header");
| >
| > with nothing ..
| >
| > something like this:
| >
| > $footer = str_replace(" '. include("$header"); .' ", "", $footer);
| >
| > I get errors, any ideas?
| >
| > cheers,
| > - Sebastian



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



[PHP] Feasability of Serial functions and constantly running progrms

2003-03-14 Thread Jason Young
After upgrading to RedHat 8.0 and effectively breaking some python 
caller-id script that I have no clue how to fix.. I'm curious of whether 
or not PHP would be able to get caller-id data from a modem.. I imagine 
it could, and probably won't be too difficult to overcome... but I am 
posing that question just to get any feedback of any problems..

What the real question is about... is there any solid way of keeping a 
PHP script running (to latch onto the modem and constantly monitor it, 
of course...) and have it run without it crying about too much memory 
being used or being run too long.

Any ideas, insight, etc?

--Jason

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


[PHP] Re: str_replace

2003-03-14 Thread John Gray
$footer = str_replace('include("$header");', '', $footer);

The way you have it now, you're telling PHP to first include the file 
named by the variable $header, then do an str_replace on the result; but 
the parser is going to fail on that first semi-colon, and that's not 
what you want to do anyway (as I understand it). Put the line you want 
to replace inside single quotes (as above) and PHP won't attempt to 
parse it, it'll just treat it as a string literal. Hope this helps, hope 
it makes sense.

- john

Sebastian wrote:
This may seem weird:

How do I str_replace an include function?

I want to replace this line: include("$header");

with nothing .. 

something like this:

$footer = str_replace(" '. include("$header"); .' ", "", $footer);

I get errors, any ideas?

cheers,
- Sebastian


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


[PHP] str_replace

2003-03-14 Thread Sebastian
This may seem weird:

How do I str_replace an include function?

I want to replace this line: include("$header");

with nothing .. 

something like this:

$footer = str_replace(" '. include("$header"); .' ", "", $footer);

I get errors, any ideas?

cheers,
- Sebastian


Re: [PHP] inserting parameters into URLs dynamically

2003-03-14 Thread Tom Rogers
Hi,

Saturday, March 15, 2003, 7:31:52 AM, you wrote:
MR> We are looking for a way to set several key/value pairs (which will differ
MR> across  users)  such  that they will persist during the user's session  and
MR> be  logged  in  the  weblogs for every request that user makes. Some
MR> potential ways of doing this that occurred to us:

MR> -  implement functionality to programmatically append these parameters to
MR> the  querystring  of all urls displayed across our site (far too cumbersome,
MR> we don't consider this a viable option)

MR> -  find  a  way  for PHP to automatically tack the parameters onto the ends
MR> of url querystrings, the same way it can do with PHPSESSIONID (we haven't
MR> found, in our initial research, a way to do this)

MR> Our primary goal is to get these parameters logged in the weblogs, without
MR> having to programmatically/physically modify every link on our site. For
MR> example, if we wanted to track parameters called x and y, the link on the
MR> page would just point to:

MR> /index.php

MR> but the weblog would show something like the following hit:

MR> /index.php?x=foo&y=bar

MR> The parameter values would need to get set once at the beginning of a user's
MR> session, and then would not change over the course of that session (but
MR> they'd need to get tracked with every request they made). We're planning to
MR> implement persistent sessions across our servers as well.

MR> 
MR> Maureen Roihl
MR> Senior Web Developer
MR> Smarter Living
MR> [EMAIL PROTECTED]


You could use something like this



Then the log formatter line needs  \"%{PHP_TITLE}n\"   adding

-- 
regards,
Tom


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



Re[2]: [PHP] php file writting ?

2003-03-14 Thread Tom Rogers
Hi,

Saturday, March 15, 2003, 4:53:44 AM, you wrote:
RP> Yes I did.
RP> Here is the code, maybe I am just missing something (this is the part
RP> where it writes and then opens again...

RP> $h6 = fopen("/etc/group.backup","a");

RP> for($i = 0; $i < count($users); $i++)
RP> {
RP> for($k = 0; $k < count($grouplines);$k++)
RP> {
RP> $groupline = explode(":", $grouplines[$k]);
RP> if($groupline[0] == $users[$i])
RP> continue 2;
RP> }

RP> $line = $users[$i] . ":x:" . ($user_ids[$i]+1000) .
RP> ":\n";
RP> fwrite($h6, $line);
RP> }

RP> fclose($h6);

RP> //have to re read the group file since we just modified it
RP> $h7 = fopen("/etc/group.backup","r");
RP> $groupcontent = fread($h7,filesize("/etc/group.backup"));
RP> fclose($h7);


RP> If I output the filesize("/etc/group.backup") after h6 is closed it is 0
RP> even though it is not.

RP> Ron

RP> On Fri, 2003-03-14 at 12:15, Chris Hayes wrote:
>> At 18:53 14-3-2003, you wrote:
>> >I open a file, modify it, save it out to disk.  The VERY next line, i
>> >open it, and the size is zero.  I look at the file and it is fine (not
>> >zero).
>> >
>> >I think there is a timing issue with php on file read/writes.  I tried
>> >sleep(1), but all that did was slow the script down (didn't help).
>> >
>> un-educated guess:
>> did you try fclose then fopen again?
>> 
>> 

You could try clearstatcache() after the fclose.
Although the fopen,close is not listed in the affected files you never know...

-- 
regards,
Tom


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



[PHP] Header order

2003-03-14 Thread John Taylor-Johnston
For the record, am I declaring these in the correct order?
Thanks,
John

http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] mysql_connect issue

2003-03-14 Thread Philip J. Newman


try

mysql_connect("loghost:3306","$username","$password");


- Original Message -
From: "Steve Shead" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 15, 2003 12:14 PM
Subject: [PHP] mysql_connect issue


> I'm trying to get a small PHP based log reader to run but get this error
every time:
>
> Fatal error: Call to undefined function: mysql_connect() in
/var/www/html/weblog/weblog.php on line 58
>
> Here is the PHP I'm using ... does anyone know what is happening here?
>
>  /*
> Simple syslog web viewer
> by NDG Tech team - www.ndgtech.ro.
>
> version: 0.5.1
>
> Authors: Adrian Badea 
> Radu Solea 
> Contributor: Hannes Gruber 
>
> Tested with:
> Apache 2.0.36
> PHP 4.3.0
> MySQL 3.23.51
> Slackware Linux 8.1
> kernel version 2.4.20
> on an AthlonXP 1800+ 512 MB SDRAM
> */
>
> error_reporting(E_ERROR+E_WARNING);
> $configuration=parse_ini_file('weblog.ini');
>
> function htmlerror()
> {
> echo "Error page";
> echo "WebLog error";
> echo "This program has performed an illegal operation. Software police has
been notified.";
> echo "";
> exit;
> }
>
>
> if (($_POST["user"]!=NULL) && ($_POST["pass"]!=NULL))
> {
> setcookie("user",$_POST["user"],time()+3600);
> setcookie("pass",$_POST["pass"],time()+3600);
> $username=$_POST["user"];
> $password=$_POST["pass"];
> }
> elseif (($_COOKIE["user"]!=NULL) && ($_COOKIE["pass"]!=NULL))
> {
> $username=$_COOKIE["user"];
> $password=$_COOKIE["pass"];
> }
> else
> {
> htmlerror();
> };
>
>
> function getmicrotime(){ // code from the PHP manual
> list($usec, $sec) = explode(" ",microtime());
> return ((float)$usec + (float)$sec);
> }
> $time_start = getmicrotime();
>
> mysql_connect("loghost:3306",$username,$password);
>
> if (mysql_errno()!=0)
> {
>   echo "Mysql error: ";
>   $error=mysql_error();
>   echo $error;
>   exit;
> }
>
> mysql_select_db("system"); // previously created database
>
> $create_query="create temporary table filenames (name varchar(255) unique,
sep varchar(255))";
> $p1=mysql_query($create_query);
>
> $load_query="load data infile '".$configuration['config_file']."' into
table filenames fields terminated by '\t';";
> $p2=mysql_query($load_query);
>
> if ($_POST["lo"]==NULL)
> {
> $file_get="select * from filenames limit 1";
> $result=mysql_query($file_get);
> $row=mysql_fetch_array($result);
> $filename=$row["name"];
> $separator=$row["sep"];
> }
> else
>   if ($_POST["load"]==NULL)
> {
> $filename=$_POST["fn"];
> $file_get="select sep from filenames where name='$filename'";
> $result=mysql_query($file_get);
> $row=mysql_fetch_array($result);
> $separator=$row["sep"];
> }
> if ($_POST["load"]!=NULL)
> {
> $filename=$_POST["files"];
> $file_get="select sep from filenames where name='$filename'";
> $result=mysql_query($file_get);
> $row=mysql_fetch_array($result);
> $separator=$row["sep"];
> $lo_val=0;
> $hi_val=15;
> $esearch=NULL;
> $vsearch=NULL;
> }
>
>
> /**
> $filepath=dirname($filename)."/";
> $file=basename($filename);
> exec("find $filepath -name '$file*' -type f -print0 | xargs -ifile -0 cat
'file' >> /tmp/mesaje");
>  */
> exec("cp $filename /tmp/mesaje");
> exec("chmod 444 /tmp/mesaje");
>
> $hostname=exec('echo ${HOSTNAME%%.*}');
>
> mysql_query("create temporary table syslog (date varchar(16), message
varchar(255))");
> $query="load data infile '/tmp/mesaje' into table syslog fields terminated
by ' $separator '";
>
> mysql_query($query);
>
> if (($_POST["vsearch"]!=NULL) || ($_POST["search"]!=NULL))
>{
> $pula=$_POST["vsearch"];
> $query="select COUNT(*) from syslog where message like '%$pula%'";
> }
> else
> {
> $query="select COUNT(*) from syslog";
> }
>
> $res=mysql_query($query);
> $maximum=mysql_fetch_row($res);
> $maximum=$maximum[0];
>
> echo "Syslogd web viewer";
>
> echo "";
> echo "";
>
> echo "";
> echo "WebLog - Syslogd Web Viewer";
> echo "";
> echo "";
> echo "";
>
> if ($_POST["lo"]==NULL)
> {
> $lo_val=0;
> $hi_val=15;
> }
> elseif ($_POST["hi"]==NULL)
> {
> $lo_val=0;
> $hi_val=15;
> }
> else if ($_POST["next"]!=NULL)
> {
> $lo_val=$_POST["hi"];
> $hi_val=2*$_POST["hi"]-$_POST["lo"];
> }
> else if($_POST["prev"]!=NULL)
> {
> $lo_val=2*$_POST["lo"]-$_POST["hi"];
> $hi_val=$_POST["lo"];
> }
> else if($_POST["go"]!=NULL)
> {
> $lo_val=$_POST["lo"];
> $hi_val=$_POST["hi"];
> }
> else if($_POST["rst"]!=NULL)
> {
> $lo_val=0;
>   $hi_val=15;
> $esearch=NULL;
> $vsearch=NULL;
>}
> else if($_POST["bsearch"]!=NULL)
> {
> $lo_val=0;
> $hi_val=15;
> }
> else if($_POST["esearch"]!=NULL)
> {
> $lo_val=0;
> $hi_val=15;
> }
>
> if (($_POST["bsearch"]!=NULL) && ($_POST["search"]!=NULL))
> {
> $esearch=1;
> $vsearch=$_POST["search"];
> }
> elseif ($_POST["esearch"]!=NULL)
> {
> $esearch=$_POST["esearch"];
> $vsearch=$_POST["vsearch"];
> }
> else
> {
> $esearch=NULL;
> $vsearch=NULL;
> }
>
> if ($_POST["load"]!=NULL)
> {
> $esearch=NULL;
> $vsearch=NULL;
> }
>
> if ($lo_va

[PHP] mysql_connect issue

2003-03-14 Thread Steve Shead
I'm trying to get a small PHP based log reader to run but get this error every time:

Fatal error: Call to undefined function: mysql_connect() in 
/var/www/html/weblog/weblog.php on line 58

Here is the PHP I'm using ... does anyone know what is happening here?


 Radu Solea 
Contributor: Hannes Gruber 

Tested with:
Apache 2.0.36
PHP 4.3.0
MySQL 3.23.51
Slackware Linux 8.1
kernel version 2.4.20
on an AthlonXP 1800+ 512 MB SDRAM
*/

error_reporting(E_ERROR+E_WARNING);
$configuration=parse_ini_file('weblog.ini');

function htmlerror()
{
echo "Error page";
echo "WebLog error";
echo "This program has performed an illegal operation. Software police has been 
notified.";
echo "";
exit;
}


if (($_POST["user"]!=NULL) && ($_POST["pass"]!=NULL))
{
setcookie("user",$_POST["user"],time()+3600);
setcookie("pass",$_POST["pass"],time()+3600);
$username=$_POST["user"];
$password=$_POST["pass"];
}
elseif (($_COOKIE["user"]!=NULL) && ($_COOKIE["pass"]!=NULL))
{
$username=$_COOKIE["user"];
$password=$_COOKIE["pass"];
}
else
{
htmlerror();
};


function getmicrotime(){// code from the PHP manual
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();

mysql_connect("loghost:3306",$username,$password);

if (mysql_errno()!=0)
{
  echo "Mysql error: ";
  $error=mysql_error();
  echo $error;
  exit;
}

mysql_select_db("system");  // previously created database

$create_query="create temporary table filenames (name varchar(255) unique, sep 
varchar(255))";
$p1=mysql_query($create_query);

$load_query="load data infile '".$configuration['config_file']."' into table filenames 
fields terminated by '\t';";
$p2=mysql_query($load_query);

if ($_POST["lo"]==NULL)
{
$file_get="select * from filenames limit 1";
$result=mysql_query($file_get);
$row=mysql_fetch_array($result);
$filename=$row["name"];
$separator=$row["sep"];
}
else
  if ($_POST["load"]==NULL)
{
$filename=$_POST["fn"];
$file_get="select sep from filenames where name='$filename'";
$result=mysql_query($file_get);
$row=mysql_fetch_array($result);
$separator=$row["sep"];
}
if ($_POST["load"]!=NULL)
{
$filename=$_POST["files"];
$file_get="select sep from filenames where name='$filename'";
$result=mysql_query($file_get);
$row=mysql_fetch_array($result);
$separator=$row["sep"];
$lo_val=0;
$hi_val=15;
$esearch=NULL;
$vsearch=NULL;
}


/**
$filepath=dirname($filename)."/";
$file=basename($filename);
exec("find $filepath -name '$file*' -type f -print0 | xargs -ifile -0 cat 'file' >> 
/tmp/mesaje");
 */
exec("cp $filename /tmp/mesaje");
exec("chmod 444 /tmp/mesaje");

$hostname=exec('echo ${HOSTNAME%%.*}');

mysql_query("create temporary table syslog (date varchar(16), message varchar(255))");
$query="load data infile '/tmp/mesaje' into table syslog fields terminated by ' 
$separator '";

mysql_query($query);

if (($_POST["vsearch"]!=NULL) || ($_POST["search"]!=NULL))
{
$pula=$_POST["vsearch"];
$query="select COUNT(*) from syslog where message like '%$pula%'";
}
else
{
$query="select COUNT(*) from syslog";
}

$res=mysql_query($query);
$maximum=mysql_fetch_row($res);
$maximum=$maximum[0];

echo "Syslogd web viewer";

echo "";
echo "";

echo "";
echo "WebLog - Syslogd Web Viewer";
echo "";
echo "";
echo "";

if ($_POST["lo"]==NULL)
{
$lo_val=0;
$hi_val=15;
}
elseif ($_POST["hi"]==NULL)
{
$lo_val=0;
$hi_val=15;
}
else if ($_POST["next"]!=NULL)
{
$lo_val=$_POST["hi"];
$hi_val=2*$_POST["hi"]-$_POST["lo"];
}
else if($_POST["prev"]!=NULL)
{
$lo_val=2*$_POST["lo"]-$_POST["hi"];
$hi_val=$_POST["lo"];
}
else if($_POST["go"]!=NULL)
{
$lo_val=$_POST["lo"];
$hi_val=$_POST["hi"];
}
else if($_POST["rst"]!=NULL)
{
$lo_val=0;

[PHP] My PHP mysql Command

2003-03-14 Thread Philip J. Newman
Assuming that gAccessLevel = eather one of level-1, level-2, level-3 ...

 if (!$gStart) { $gStart=0; }

   $sql = "SELECT * FROM gallerys WHERE gMode = '$mode' AND ";

  if ($siteAccessLevel == "level-1") {

   // LEVEL-1 VIEWING ONLY.

$sql .= "WHERE (gAccessLevel = 'level-1')";

  } else if ($siteAccessLevel == "level-2") {

   // LEVEL-2 AND LEVEL-1 VIEWING ONLY.

$sql .= "WHERE (gAccessLevel = 'level-1' OR gAccessLevel = 'level-2')";

  } else if ($siteAccessLevel == "level-3") {

   // PAYING, ACCESS ALL IMAGES!

$sql .= "WHERE (gAccessLevel = 'level-1' OR gAccessLevel = 'level-2' OR
gAccessLevel = 'level-3')";

  } else {

   // IF ERROR SHOW LEVEL ONE.

$sql .= "WHERE (gAccessLevel = 'level-1')";

  }

  $sql .= " ORDER BY gId DESC LIMIT $gStart, 10";

  echo $sql;

$sql_result = mysql_query($sql, $connection) or die (mysql_error());


MY ERROR MESSAGE IS ...

10You have an error in your SQL syntax near 'WHERE (gAccessLevel = 'level-1'
OR gAccessLevel = 'level-2' OR gAccessLevel = 'l' at line 1

as gAccessLevel = level-3 ...

Any Ideas why this is weong?








--
Philip J. Newman.
Head Developer
[EMAIL PROTECTED]

+64 (9) 576 9491
+64 021-048-3999

--
Friends are like stars
You can't allways see them,
but they are always there.

--
Websites:

PhilipNZ.com - Design.
http://www.philipnz.com/
[EMAIL PROTECTED]

Philip's Domain // Internet Project.
http://www.philipsdomain.com/
[EMAIL PROTECTED]

Vital Kiwi / NEWMAN.NET.NZ.
http://www.newman.net.nz/
[EMAIL PROTECTED]



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



[PHP] Convert Date to MySQL format

2003-03-14 Thread Vernon
I've had to convert times in a MySQL field to a normal date, but never in
reverse. How to I convert a date in this format, 03/14/2003, to MySQL format
so it can be posted to a date field?

Thanks



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



RE: [PHP] form/text area input problem

2003-03-14 Thread Boaz Yahav
Did you play with 



or



Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.



-Original Message-
From: Poon, Kelvin (Infomart) [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 13, 2003 6:25 PM
To: '- Edwin'
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP] form/text area input problem


THanks guys, I think I will use wordwarp()



-Original Message-
From: - Edwin [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 11:07 AM
To: Poon, Kelvin (Infomart); '[EMAIL PROTECTED]'
Subject: Re: [PHP] form/text area input problem


"Poon, Kelvin (Infomart)" <[EMAIL PROTECTED]> wrote: 
[snip]
> the problem is when I display it it would be a one lined paragraph.   
> THe page's format is ruin since this is one long line and the user
> will have to scroll across to read the paragraph which look pretty
bad.
> 
> I hope you know what i am trying to say.
[/snip]

Hmm, I guess I know what you're trying to say but *that* is NOT the 
normal behaviour (if I may say). Putting one long paragraph inside
 tags "should" automagically wrap it... If not, you can probably 
use CSS to limit the width of your 's (paragraphs) so it wouldn't

destroy the "format" of your page.

- E

__
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!  http://bb.yahoo.co.jp/

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



Re: [PHP] Apache 2.0 and PHP

2003-03-14 Thread Ernest E Vogelsinger
At 19:37 14.03.2003, Michael Aaron said:
[snip]
>Sorry if this has been answered before but I can not find it anywhere:
>
>Why does the PHP docs. state:
>  "Do not use Apache 2.0 and PHP in a production environment neither on 
>Unix nor on Windows. "
>
>What is the reason for this Warning?
[snip] 

Apache 2.0 implements multithreading, while the 1.x versions were forking
processes. While this might increase the overall speed of the webserver,
all (and I mean ALL) used extensions, end extensions for these extensions,
must be written in a thread-safe way.

While the PHP core group as to my knowledge has already implemented PHP
(4.3.0 that is) in a thread-safe way, most of PHP extension modules are not
(yet?) thread safe.

Might get you into a core dump I suppose...


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



Re: [PHP] General Information About Porting a Monolithic Perl CGI Script to PHP

2003-03-14 Thread Ernest E Vogelsinger
At 22:26 14.03.2003, Richard Ward said:
[snip]
>Also, from my reading, it sounds like some of the features I might need in
>PHP are considered extensions. For example, my Perl script makes heavy use
>of searching and replacing using regular expressions. I've read on the PHP
>web site that Perl-like regular expression support is now part of the
>typical installation of PHP (maybe I got this wrong). My concern is, well,

I haven't come across an installation of PHP that doesn't have
Perl-compatible regex (the preg_xxx functions) enabled.

>I am not using any Perl modules, so this shouldn't be a concern, although
>I've been considering using the Perl DBI module for generic database
>support. I have not yet found a DBI equivalent for PHP.

Have a look at ADODB (http://php.weblogs.com/). This is an attempt to
create a database-independent layer for PHP - it works with most major
databases (including ODBC) and keeps you off the hassles of implementing
database-specific code. (Disclaimer - this is not, and cannot be, valid for
non-standard SQL extensions offered by any particular database, if you're
using them).


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



[Fwd: Re: [PHP] inserting parameters into URLs dynamically]

2003-03-14 Thread Pete James
You could use output buffering to do the rewriting for you.

IF you use ob_start('my_function'); at the top of your page, where
my_function is the name of a callback function

This function might look like this:

function my_function($buffer)
{
return $buffer . '?x=foo&y=bar';
}

That's it... well, almost.  There are obviously considerations for doing
this in forms and when urls already contain vars.

If you want, I've got a pre-built class that does exactly what you
want.  Mail me offline.

P.

Maureen Roihl wrote:
> 
> We are looking for a way to set several key/value pairs (which will differ
> across  users)  such  that they will persist during the user's session  and
> be  logged  in  the  weblogs for every request that user makes. Some
> potential ways of doing this that occurred to us:
> 
> -  implement functionality to programmatically append these parameters to
> the  querystring  of all urls displayed across our site (far too cumbersome,
> we don't consider this a viable option)
> 
> -  find  a  way  for PHP to automatically tack the parameters onto the ends
> of url querystrings, the same way it can do with PHPSESSIONID (we haven't
> found, in our initial research, a way to do this)
> 
> Our primary goal is to get these parameters logged in the weblogs, without
> having to programmatically/physically modify every link on our site. For
> example, if we wanted to track parameters called x and y, the link on the
> page would just point to:
> 
> /index.php
> 
> but the weblog would show something like the following hit:
> 
> /index.php?x=foo&y=bar
> 
> The parameter values would need to get set once at the beginning of a user's
> session, and then would not change over the course of that session (but
> they'd need to get tracked with every request they made). We're planning to
> implement persistent sessions across our servers as well.
> 
> 
> Maureen Roihl
> Senior Web Developer
> Smarter Living
> [EMAIL PROTECTED]
> 
> --
> 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



Re: [PHP] inserting parameters into URLs dynamically

2003-03-14 Thread Ernest E Vogelsinger
At 22:31 14.03.2003, Maureen Roihl said:
[snip]
>-  find  a  way  for PHP to automatically tack the parameters onto the ends
>of url querystrings, the same way it can do with PHPSESSIONID (we haven't
>found, in our initial research, a way to do this)
>
>Our primary goal is to get these parameters logged in the weblogs, without
>having to programmatically/physically modify every link on our site. For
>example, if we wanted to track parameters called x and y, the link on the
>page would just point to:
>
>/index.php
>
>but the weblog would show something like the following hit:
>
>/index.php?x=foo&y=bar
>
>The parameter values would need to get set once at the beginning of a user's
>session, and then would not change over the course of that session (but
>they'd need to get tracked with every request they made). We're planning to
>implement persistent sessions across our servers as well.
[snip] 

PHP implements href rewriting in the final stage of output. You could
easily hook in here using output buffering.

ob_start('weblogize_links');

function weblogize_links($buffer)
{
// parse the output $buffer and modify all links
}

A special gotcha may come in here: take care to only rewrite links that
point to your own site.


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



[PHP] General Information About Porting a Monolithic Perl CGI Script to PHP

2003-03-14 Thread Richard Ward
Hello,

I have a ~5500 line monolithic Perl script that I distribute with my
commercial application for processing forms on any Web server that supports
CGI and Perl. Perl has been a wonderful platform because of its portability.
However, people are now suggesting that my program also support PHP, so I
began reading about PHP at http://www.php.net.

I have also searched the archives in this list for tips and suggestions when
porting Perl to PHP, but haven't found much so far. Can someone point me to
references that may be useful for porting Perl to PHP? I'd like to hear
about the experiences of others who have done this.

Also, from my reading, it sounds like some of the features I might need in
PHP are considered extensions. For example, my Perl script makes heavy use
of searching and replacing using regular expressions. I've read on the PHP
web site that Perl-like regular expression support is now part of the
typical installation of PHP (maybe I got this wrong). My concern is, well,
that means there are probably many installations of PHP out there that don't
have this support, so I would need to tell people that if they were to use
my PHP script, they'll need to install a few things like support for regular
expressions. In my case, the less installation required, the better.

I am not using any Perl modules, so this shouldn't be a concern, although
I've been considering using the Perl DBI module for generic database
support. I have not yet found a DBI equivalent for PHP.

Any comments or suggestions would be greatly appreciated.

Richard



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



[PHP] inserting parameters into URLs dynamically

2003-03-14 Thread Maureen Roihl
We are looking for a way to set several key/value pairs (which will differ
across  users)  such  that they will persist during the user's session  and
be  logged  in  the  weblogs for every request that user makes. Some
potential ways of doing this that occurred to us:

-  implement functionality to programmatically append these parameters to
the  querystring  of all urls displayed across our site (far too cumbersome,
we don't consider this a viable option)

-  find  a  way  for PHP to automatically tack the parameters onto the ends
of url querystrings, the same way it can do with PHPSESSIONID (we haven't
found, in our initial research, a way to do this)

Our primary goal is to get these parameters logged in the weblogs, without
having to programmatically/physically modify every link on our site. For
example, if we wanted to track parameters called x and y, the link on the
page would just point to:

/index.php

but the weblog would show something like the following hit:

/index.php?x=foo&y=bar

The parameter values would need to get set once at the beginning of a user's
session, and then would not change over the course of that session (but
they'd need to get tracked with every request they made). We're planning to
implement persistent sessions across our servers as well.


Maureen Roihl
Senior Web Developer
Smarter Living
[EMAIL PROTECTED]

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



Re: [PHP] OT? Dynamic Page Setup in IE please help

2003-03-14 Thread David T-G
Anthony --

Your question is pure browser.  Good luck, especially considering the
browser you have to target :-)

You might be able to change the setting with some javascript.  You might
also be able to define the print format with a style sheet (doubtful).
In either case, you need to get into IE internals to see what it is that
you want to set.

I don't think you'll be able to do this for "only this page", though you
could perhaps put the settings back (hey, store 'em in a cookie; it can't
get much worse!) after the job has printed.


HTH & Good luck & 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] Apache 2.0 and PHP

2003-03-14 Thread Rasmus Lerdorf
On Fri, 14 Mar 2003, Michael Aaron wrote:
> Sorry if this has been answered before but I can not find it anywhere:
> 
> Why does the PHP docs. state:
>   "Do not use Apache 2.0 and PHP in a production environment neither on 
> Unix nor on Windows. "
> 
> What is the reason for this Warning?

The combination is simply not production-quality yet.  It has not had the 
attention and Q&A that Apache1/PHP has had, and there are also known 
issues, especially on UNIX with the combination.

-Rasmus


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



[PHP] OT? Dynamic Page Setup in IE please help

2003-03-14 Thread Anthony
I'm gonna post this in some Microsoft list too, but I'm hopping someone here
might be able to help me out.  I have a few situations where users will need
to print from my app.  The browser they are using will be IE.  What I'd like
to be able to do is through some type of scripting remove the header and
footer on the page setup in IE.  I can do this manually, and get the result
that I want, but I need to be able to do it dynamically, without user
intervention, and have the settings change only occur for the page that is
being printed.  I've tried using other methods, like html2pdf, and it works,
but I can't bring over the proper formatting to the PDF file.  What I
specifically want to remove is the"&w&bPage &p of &P" clause that is in the
header and the "&u&b&d" in the footer of file->page setup in IE.  this is
what causes the page title and  page number to print on the top of printed
web pages, and the URL to print in the footer.

Thanks for any help you could give, or if you could point me to a better
place to discuss this I'd appreciate it.  Thanks :)

- Anthony



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



[PHP] including files in PHP-pdf development

2003-03-14 Thread Bill Hudspeth
Hello,

I am developing an application that ouputs the results of a database query
to a PDF file using PHP. The only real problem I have encountered is in
trying to use the "include" and/or "require" keywords. I have a block of
code in another file that needs to called several times from my main
PDF-generating PHP file. As of yet, the standard use of include or require
doesn't seem to work:

i.e.include 'output.inc';

Any ideas on what's going on or on how I might be able to introduce my code
block multiple times into the main file?

Thanks, Bill



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



[PHP] File transfer FTP HTTP

2003-03-14 Thread Michael Steinhart
Thank you in advance to any one who may be able to help.

I am looking for a way to have users be able to down load files from a 
site via FTP and HTTP.
This sounds easy enough but here are the details.

There will be a application server that users will purchase software 
form (Under development)
The application server will update the database with the item that was 
purchased.
After the purchase is complete the user will be sent to a download 
server to get the download.
The user will have up to 72 hours to get their download.
The full pat to the download must be virtual to prevent someone from 
just putting in the path and doing another download.
Ie: ftp://download.thedomain.com/xxx134314x/software.zip
The PHP app on the download server will check with the database to 
confirm what is to be downloaded.
Upon a successful download the PHP app will update the database that the 
download was completed successfully.

Thank you,
Michael Steinhart
PMH Systems
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] checking $_POST variables

2003-03-14 Thread Liam Gibbs
> That's generally not a good idea because depending on the type of control
> empty input fields will not be available in the $_POST array (e.g.
> unchecked checkboxes are _not_ sent by the browser).
>
> You should rather have a list of input variables that need to be filled
and
> compare $_POST against this.

I'd agree with this, but just in case this is an absolute necessity, and a
sure thing, have you tried:

foreach($_POST as $key=>$value) {
...
}

I haven't tried that, but it may work.


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



Re: [PHP] checking $_POST variables

2003-03-14 Thread Ernest E Vogelsinger
At 20:26 14.03.2003, drparker said:
[snip]
>I'm running this script to make sure all fields are filled in on a form:
>
>foreach($_POST as $p)
>{
>  if(!$p)
> {
>  header("Location: signup.php?error=3");
>  exit();
> }
>}
>
>But I need to exclude one field on the form from being checked -
>Street2.  How could I do this?
[snip] 

That's generally not a good idea because depending on the type of control
empty input fields will not be available in the $_POST array (e.g.
unchecked checkboxes are _not_ sent by the browser).

You should rather have a list of input variables that need to be filled and
compare $_POST against this.


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



[PHP] Re: PHP DOM XML Function

2003-03-14 Thread Alexandru COSTIN
Hello,
As far as I know from Christian Stocker (the domxml maintainer) - they are
already pretty stable. They are tagged as "experimental" to avoid people
complaints about API changes (API changes are necessary because DOMXML
should have a DOM api, and it was pretty not like this at the beggining).

However, we are using Krysalis with DOMXML (we have even renounced at
Sablotron and we are using only domxml) for dynamic XML/XSL publishing, and
the API is pretty stable already (there might be some leaks on windows, but
we don't have any real data yet on this).

Alexandru

--
Alexandru COSTIN
Chief Operating Officer
http://www.interakt.ro/
+4021 411 2610
"Fgôk ÞôündÉö" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> do you have any idea about PHP DOM XML functions?
> when will PHP DOM XML functions be stable?
>
>
> Fatih Üstündað
> Yöre Elektronik Yayýmcýlýk A.Þ.
> 0 212 234 00 90
>



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



[PHP] checking $_POST variables

2003-03-14 Thread drparker
I'm running this script to make sure all fields are filled in on a form:

foreach($_POST as $p)
{
  if(!$p)
 {
  header("Location: signup.php?error=3");
  exit();
 }
}

But I need to exclude one field on the form from being checked -
Street2.  How could I do this?



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



[PHP] replace string in array

2003-03-14 Thread Chris Winters
I'm having a bit of trouble...

I have an array that consists of a string like this:

string1\rstring2\rstring3\rstring4

I want to REMOVE STRING3, and keep the rest of the array intact - but cannot
figure on how to do it. I tried using functions such as preg_replace, strstr
and so forth...

In my code this is how I go thru the array...

//snippet...

//search for carriage return, split it...
 $line = preg_split( "/[\r]+/" ,$line);
 reset($line);

//Line will consists of array...
while (list ($key, $val) = each ($line))
 {
   echo "$key => $val";

   if(strstr($val,$newmail))
{
  echo "Found! and trying to delete";
 //What to do form this point, I have the slightest foggy...
}
}

It finds it without ANY problems, but I cannot seem to "go" to the position
of found string, delete it, then keep the rest of the array.
I did manage to find this on php.net, but it doesnt seem to work:
function stri_replace2 ($search,$replace,$text)
{
   if (!is_array($search))
{
  $search = array($search);
  $replace = array($replace);
}
 foreach($search AS $key => $val)
  {
$search["$key"]  = '/'.quotemeta($val).'/i';
  }
echo "$search $replace $text";

   return preg_replace($search,$replace,$text);
}

Could anyone help me with this?

Thanks in advanced!

Chris




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



Re: [PHP] php file writting ?

2003-03-14 Thread Ronald Petty
Yes I did.
Here is the code, maybe I am just missing something (this is the part
where it writes and then opens again...

$h6 = fopen("/etc/group.backup","a");

for($i = 0; $i < count($users); $i++)
{
for($k = 0; $k < count($grouplines);$k++)
{
$groupline = explode(":", $grouplines[$k]);
if($groupline[0] == $users[$i])
continue 2;
}

$line = $users[$i] . ":x:" . ($user_ids[$i]+1000) .
":\n";
fwrite($h6, $line);
}

fclose($h6);

//have to re read the group file since we just modified it
$h7 = fopen("/etc/group.backup","r");
$groupcontent = fread($h7,filesize("/etc/group.backup"));
fclose($h7);


If I output the filesize("/etc/group.backup") after h6 is closed it is 0
even though it is not.

Ron

On Fri, 2003-03-14 at 12:15, Chris Hayes wrote:
> At 18:53 14-3-2003, you wrote:
> >I open a file, modify it, save it out to disk.  The VERY next line, i
> >open it, and the size is zero.  I look at the file and it is fine (not
> >zero).
> >
> >I think there is a timing issue with php on file read/writes.  I tried
> >sleep(1), but all that did was slow the script down (didn't help).
> >
> un-educated guess:
> did you try fclose then fopen again?
> 
> 


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



[PHP] Apache 2.0 and PHP

2003-03-14 Thread Michael Aaron
Sorry if this has been answered before but I can not find it anywhere:

Why does the PHP docs. state:
 "Do not use Apache 2.0 and PHP in a production environment neither on 
Unix nor on Windows. "

What is the reason for this Warning?

Thanks in advance.

Mike Aaron

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


RE: [PHP] IF statement madness

2003-03-14 Thread James E Hicks III
Thank you (all who resonded)!!! It makes sense now. 
Now I can wait until 5:00pm, quitting time, to go crazy!!

James

-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 1:23 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] IF statement madness


Comparing a float with an integer can have problems. You could try something
like:

if(abs($i - $target) < .1) {
  //then they are essentially equal
}

Kirk

> -Original Message-
> From: James E Hicks III [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 14, 2003 11:22 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] IF statement madness
> 
> 
> Help save my sanity! What can I do to the IF statement in the 
> following code to
> make it print the line that says "By God they are equal in 
> value."? I have tried
> the following changes;
> 
>   1. using === instead of ==
>   2. placing (float) in front of the $i and $target 
> inside and before the IF
> statement.
> 
>  $start = 215;
> $end = 217;
> $target = 216;
> for ($i=$start; $i<=$end; $i+=.1){
> if ( $i ==  $target ){
> echo ("$i - $target, By God, the are 
> equal in value.");
> } else {
> echo ("$i - $target, Eternal Damnation, 
> they aren't
> equal!");
> }
> }
> ?>
> 
> 
> James E Hicks III
> Noland Company
> 2700 Warwick Blvd
> Newport News, VA 23607
> 757-928-9000 ext 435
> [EMAIL PROTECTED]
> 
> 
> -- 
> 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] IF statement madness

2003-03-14 Thread Ford, Mike [LSS]
> -Original Message-
> From: James E Hicks III [mailto:[EMAIL PROTECTED]
> Sent: 14 March 2003 18:22
> 
> Help save my sanity! What can I do to the IF statement in the 
> following code to
> make it print the line that says "By God they are equal in 
> value."? I have tried
> the following changes;
> 
>   1. using === instead of ==
>   2. placing (float) in front of the $i and $target 
> inside and before the IF
> statement.
> 
>  $start = 215;
> $end = 217;
> $target = 216;
> for ($i=$start; $i<=$end; $i+=.1){
> if ( $i ==  $target ){
> echo ("$i - $target, By God, the are 
> equal in value.");
> } else {
> echo ("$i - $target, Eternal Damnation, 
> they aren't
> equal!");
> }
> }
> ?>

Rule 1: DON'T USE FLOATS AS LOOP CONTROL VARIABLES.

Rule 2: DON'T COMPAR|E CALCULATED FLOATING POINT VALUES FOR EQUALITY.

By the vary nature of how floating-point numbers are stored on computers,
there is a tiny inaccuracy in all floating point operations.  In many cases
this dosn't matter -- the inaccuracy is beyond the level of significance.
However, if you compare two calculated values to each other, you must always
allow for the possiblity of that tiny inaccuracy -- for example, don't do:

   if ((10.0/3.0)*3.0 == 10.0)  // *never* true!

but instead something like:

   if (abs((10.0/3.0)*3.0 - 10.0) < 1e-30) // adjust 1e-30 to suit 

In loops like the one you've written, you compound the inaccuracy by doing
many floating-point additions to the same variable -- by the time you reach
your endpoint, you're probably significantly off.  The only way to truly
compensate for this is to use integers to control your loop, and divide down
by the appropriate power of 10 at the start of each iteration, so:

   $start = 215;
   $end = 217;
   $target = 216;
   for ($ii=$start*10; $ii<=$end*10; $ii++){
  $i = $ii/10.0;

  // etc.

   }

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] IF statement madness

2003-03-14 Thread jon roig
What happens if you change $target to 216.0?

-- jon

-Original Message-
From: James E Hicks III [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 1:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] IF statement madness


Help save my sanity! What can I do to the IF statement in the following code
to
make it print the line that says "By God they are equal in value."? I have
tried
the following changes;

1. using === instead of ==
2. placing (float) in front of the $i and $target inside and before the IF
statement.

$i - $target, By God, the are equal in value.");
} else {
echo ("$i - $target, Eternal Damnation, they aren't
equal!");
}
}
?>


James E Hicks III
Noland Company
2700 Warwick Blvd
Newport News, VA 23607
757-928-9000 ext 435
[EMAIL PROTECTED]


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



Re: [PHP] IF statement madness

2003-03-14 Thread Ernest E Vogelsinger
At 19:21 14.03.2003, James E Hicks III said:
[snip]
>Help save my sanity! What can I do to the IF statement in the following
>code to
>make it print the line that says "By God they are equal in value."? I have 
>tried
>the following changes;
>
>   1. using === instead of ==
>   2. placing (float) in front of the $i and $target inside and before
> the IF
>statement.
>
>$start = 215;
>$end = 217;
>$target = 216;
>for ($i=$start; $i<=$end; $i+=.1){
>if ( $i ==  $target ){
>echo ("$i - $target, By God, the are equal in value.");
>} else {
>echo ("$i - $target, Eternal Damnation, they aren't
>equal!");
>}
>}
>?>
[snip] 

Before the if statement in your loop place this line:
echo "\$i is now: $i";

You'll notice that most probably your $i variable will miss $target by some
hunderths or thousandths, since you're working with it as a float. This is
due to the way fp numbers are stored and calculated (using exponents and
mantissa).

Workaround: don't use floats if you want to hit a certain value at the spot:

$i - $target, By God, the are equal in value.");
   } else {
   echo ("$i - $target, Eternal Damnation, they aren't
equal!");
   }
}
?>


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



RE: [PHP] IF statement madness

2003-03-14 Thread Johnson, Kirk
Comparing a float with an integer can have problems. You could try something
like:

if(abs($i - $target) < .1) {
  //then they are essentially equal
}

Kirk

> -Original Message-
> From: James E Hicks III [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 14, 2003 11:22 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] IF statement madness
> 
> 
> Help save my sanity! What can I do to the IF statement in the 
> following code to
> make it print the line that says "By God they are equal in 
> value."? I have tried
> the following changes;
> 
>   1. using === instead of ==
>   2. placing (float) in front of the $i and $target 
> inside and before the IF
> statement.
> 
>  $start = 215;
> $end = 217;
> $target = 216;
> for ($i=$start; $i<=$end; $i+=.1){
> if ( $i ==  $target ){
> echo ("$i - $target, By God, the are 
> equal in value.");
> } else {
> echo ("$i - $target, Eternal Damnation, 
> they aren't
> equal!");
> }
> }
> ?>
> 
> 
> James E Hicks III
> Noland Company
> 2700 Warwick Blvd
> Newport News, VA 23607
> 757-928-9000 ext 435
> [EMAIL PROTECTED]
> 
> 
> -- 
> 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] IF statement madness

2003-03-14 Thread James E Hicks III
Help save my sanity! What can I do to the IF statement in the following code to
make it print the line that says "By God they are equal in value."? I have tried
the following changes;

1. using === instead of ==
2. placing (float) in front of the $i and $target inside and before the IF
statement.

$i - $target, By God, the are equal in value.");
} else {
echo ("$i - $target, Eternal Damnation, they aren't
equal!");
}
}
?>


James E Hicks III
Noland Company
2700 Warwick Blvd
Newport News, VA 23607
757-928-9000 ext 435
[EMAIL PROTECTED]


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



Re: [PHP] php file writting ?

2003-03-14 Thread Chris Hayes
At 18:53 14-3-2003, you wrote:
I open a file, modify it, save it out to disk.  The VERY next line, i
open it, and the size is zero.  I look at the file and it is fine (not
zero).
I think there is a timing issue with php on file read/writes.  I tried
sleep(1), but all that did was slow the script down (didn't help).
un-educated guess:
did you try fclose then fopen again?


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


[PHP] Re: Unable to install PHP4.2.3 + Apache 1.3 + Win2k

2003-03-14 Thread Paul B. McBride
Here are the PHP related lines from my Appache2.0.43 httpd.conf file.

ScriptAlias /php4/ "E:/PHP4/"
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
Action application/x-httpd-php /php4/php.exe

With this setup, all *.php and *.phtml files
are processed correctly, but when using an .htaccess
file in the same directory as the .phtml file, 
$REMOTE_USER is not set, even when
the userid and password were entered when
the file was accessed.

Contents of test.phtml file:

PHP Test

PHP Test
\$_SERVER[HTTP_HOST]="; echo $_SERVER["HTTP_HOST"];
  echo "\$_SERVER[REMOTE_USER]="; echo $_SERVER["REMOTE_USER"];
  echo "\$PHP_AUTH_USER="; echo $PHP_AUTH_USER;
  echo "\$REMOTE_USER="; echo $REMOTE_USER;
  echo "";
  ?>


[EMAIL PROTECTED] (Diego Fulgueira) wrote:

>Hi.
>I followed the instructions in the php manual to install php as CGI module
>under apache, under windows. I get the following message when requesting
>a php file:
>
>Invalid URI in request GET /mydir/myfile.php HTTP/1.1
>
>I believe this is because Apache is not getting the protocol:host part of
>the request
>(in this case: http://localhost/). I don't know why this happens.
>
>Something else: The PHP manual recommends adding the line:
>
>ScriptAlias /php/ "c:/php/"
>
>to the http.conf file. But I don't want ONLY the files under /php/  to be
>interpreted
>as scripts. Rather, I want ALL the files in my documentRoot directory to be
>interpreted as scripts.
>
>Any ideas? Thanks in advance


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



Re: [PHP] need a new challenge

2003-03-14 Thread Chris Hayes
At 11:12 14-3-2003, you wrote:

Im looking for ideas for a 2 programming contests.
What I need is a very basic challenge - that new php programmers can
do, but involves them mixing there thinking/programming and creative
abilities.
I also need a challenge for professional programmers - something that
involves lots of thought, tests their problem solving ability and code
useage.
h! this is a great change to let others do my job :).

It's up to you in which category you place it:

-
Metatable
Suppose you've got one db table (meta-table) desribing the content of 
various other tables, for instance
ID
  tablename
fieldname
fieldtype [integer|textarea|choicelist|link_to_other_table|]
default_value
permissions
The easy part: make an interface so people can design their own db table, 
the description of every field goes into the metatable and the field is 
added to the datatable it refers to. With templates one can now quickly 
make show/edit/add/overview pages. I managed that.
Now I want to have choice lists that come from new tables. For instance: 
with this system they made a table
   person (gender, name, etc), now i want to add a choice list of 
institutions, where the institutions are in another table (institute name, 
address, etc).  Doing this directly is easier than doing it via this extra 
table.  Let them use a class?
---

I'm pondering what other projects i can let them do ;)

Chris





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


[PHP] php file writting ?

2003-03-14 Thread Ronald Petty
I open a file, modify it, save it out to disk.  The VERY next line, i
open it, and the size is zero.  I look at the file and it is fine (not
zero).

I think there is a timing issue with php on file read/writes.  I tried
sleep(1), but all that did was slow the script down (didn't help).

Any ideas?
Ron


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



Re: [PHP] accidently inserting into web database blank records.

2003-03-14 Thread Leif K-Brooks
The string is in double quotes, ont single quotes.  The single quotes 
are simply characters in the double-quoted string.  I believe the 
register_globals explanation is correct.

Brent Baisley wrote:

I'm pretty sure your problem is the single quotes around your 
variables. Single quotes and double quotes have very different 
meanings. Single quotes tell PHP not to look for anything inside the 
quotes, whereas PHP will always parse double quotes to see if there is 
anything it needs to process. There is obviously a slight performance 
advantage to using the correct quotes religiously.

Change you query string to something like:
mysql_query ("INSERT INTO name (name,surname)
VALUES (\"$name\",\"$surname\")");
or
mysql_query ('INSERT INTO name (name,surname)
VALUES ("'.$name.'","'.$surname.'")');
On Friday, March 14, 2003, at 10:39 AM, Mahmut KARADEMIR wrote:

Hi All;
I am trying to add a new record web database using Mysql&PHP.
But after at every add process a new blank record  is added to mysql 
table.
The entered text is not considered with codes.
What is my trouble in this html or php code?
Could anyone has any idea?
Thanks.
***name.html**




name.. : 
type="text"
name="name"
size="25"
maxlength="25"
value="">
   
surname: 
type="text"
name="surname"
size="25"
maxlength="25">
 < input type="submit"
name="submit"
value="submit">




***name.php***

mysql_connect("localhost","user","password");
mysql_select_db ("mydatabasename");
mysql_query ("INSERT INTO name (name,surname)
VALUES ('$name','$surname')");
echo ('Your record has been added.');
print ("");
print ("Your Name:");
print ($name);
print (" ");
print ("");
print ("Your Surname:");
print ($surname);
print ("");
print ("THANKS");
?>

Mahmut

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


Re: [PHP] trikky string limit question

2003-03-14 Thread -{ Rene Brehmer }-
On Thu, 13 Mar 2003 23:17:02 -0500, daniel wrote about "RE: [PHP] trikky
string limit question" what the universal translator turned into this:

>never mind i worked it out
>
>function create_caption($content,$max_length,$primaryID,$ID) {
>   if (strlen($content) > $max_length) {
>   $paragraph_i=".";
>   $position=strpos($content,$paragraph_i);
>   if (is_integer($position)) {
>   $preview=substr($content,0,$position);
>   $preview.="... [ href=\"".$GLOBAL['PHP_SELF']."?".$primaryID."=".$ID."\"> More ]";
>   return $preview;
>   }
>   } else {
>   return $content;
>   }
>   }
>explodes and splits were not getting the "." properly

Why are you using all those variables??? Variables should only be used for
things you reuse several times, or plan to be able to change alot later,
either manually or programmatically.

The more variables you use, the slower it runs. To me it also gets more
messy to look at ...

Rene

-- 
Rene Brehmer

This message was written on 100% recycled spam.

Come see! My brand new site is now online!
http://www.metalbunny.net

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



Re: [PHP] OT Inactivity Timeout

2003-03-14 Thread Ernest E Vogelsinger
At 17:03 14.03.2003, Luis Lebron said:
[snip]
>This may be more of a javascript question than a php question. But how can I
>set up an inactivity timeout that will logout a person after let's say 20
>minutes of inactivity?
[snip] 

That's an interesting question - something that might be handled
server-side (which is usually a lot safer than on the client side),
supporting (javascript-based) client requests if it is still logged-in.

I have tried a quick sample and believe a scenario like this could work
quite well in a production environment:

(1) handle login status server-side:
After authenticating the user, establish a timeout until that the login
will be valid WITHOUT user interaction (you may e.g. choose 5 minutes, i.e.
time() + (5*60)). Store this timeout value in session data
($_SESSION['login_valid_until']);

(2) update the timeout on every user interaction
Simply refresh the session based timeout value using the same formula.

(3) Have a special entry (either a special script, or a certain parameter)
where the client may ask if the login is still valid. Make sure this script
(and only this!) DOES NOT increment the timeout value since it will be
called by client javascript, not by user interaction.

(A) Header pseudocode for "interactive" pages (normal application scripts):
login valid and validates against timeout?
NO: transfer to "you have been logged out" page
YES: increase timeout; continue processing;

(B) Pseudocode for timeout-checking script:
login valid and validates against timeout?
NO: transfer to "you have been logged out" page
YES: return "204 no response" status code

(C) Javascript to be used on any page:

function checkHandler() {
window.location.href="yourcheckscripthere.php?";
onloadHandler();
}
function onloadHandler() {
setTimeout('checkHandler();', 6);
}



The main feature here is the use of the server status code 204 which means
"No Response". Cited from RFC2616 (HTTP 1.1 draft standard):

10.2.5   204 No Content
The server has fulfilled the request but does not need to return an
entity-body, 
[...]
If the client is a user agent, it SHOULD NOT change its document view from
that which caused the request to be sent. This response is primarily
intended to allow input for actions to take place without causing a change
to the user agent's active document view, [...]
The 204 response MUST NOT include a message-body, and thus is always
terminated by the first empty line after the header fields. 



So: if the server sees the login status (in session data) is still valid,
the reload request issued by JavaScript doesn't lead to a new page but lets
the browser remain in "idle" mode. However the timeout needs to be set
again; it seems that the JS engine clears all timers _before_ the reload
request (which would make sense; it can't clean them up on another page).

However if the server sees the user has exceeded its timeout (by not
activating some "interactive" action that would cause the timeout to be
extended), the javascript reload will immediately transfer the user agent
to the "you're outta here" page.


-- 
   >O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



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



Re: [PHP] Generating Statics Pages

2003-03-14 Thread -{ Rene Brehmer }-
On Thu, 13 Mar 2003 16:28:38 -0600, Christina wrote about "[PHP]
Generating Statics Pages" what the universal translator turned into this:

>What is the fastest way to generate multiple static pages?

What do you want them to contain ???

Without knowing that, it's nearly impossible to answer that question. 

Personally I write custom programs in VB6 that build HTML files based upon
data from whatever source I'm working on...

Rene

-- 
Rene Brehmer

This message was written on 100% recycled spam.

Come see! My brand new site is now online!
http://www.metalbunny.net

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



Re: [PHP] OT Inactivity Timeout

2003-03-14 Thread Joe Goff
use sessions
- Original Message -
From: "Luis Lebron" <[EMAIL PROTECTED]>
To: "Php-General (E-mail)" <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 10:03 AM
Subject: [PHP] OT Inactivity Timeout


> This may be more of a javascript question than a php question. But how can
I
> set up an inactivity timeout that will logout a person after let's say 20
> minutes of inactivity?
>
>
> thanks,
>
> Luis
>


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



Re: [PHP] accidently inserting into web database blank records.

2003-03-14 Thread Brent Baisley
I'm pretty sure your problem is the single quotes around your variables. 
Single quotes and double quotes have very different meanings. Single 
quotes tell PHP not to look for anything inside the quotes, whereas PHP 
will always parse double quotes to see if there is anything it needs to 
process. There is obviously a slight performance advantage to using the 
correct quotes religiously.

Change you query string to something like:
mysql_query ("INSERT INTO name (name,surname)
VALUES (\"$name\",\"$surname\")");
or
mysql_query ('INSERT INTO name (name,surname)
VALUES ("'.$name.'","'.$surname.'")');
On Friday, March 14, 2003, at 10:39 AM, Mahmut KARADEMIR wrote:

Hi All;
I am trying to add a new record web database using Mysql&PHP.
But after at every add process a new blank record  is added to mysql 
table.
The entered text is not considered with codes.
What is my trouble in this html or php code?
Could anyone has any idea?
Thanks.
***name.html**




name.. : 
type="text"
name="name"
size="25"
maxlength="25"
value="">
   
surname: 
type="text"
name="surname"
size="25"
maxlength="25">
 < input type="submit"
name="submit"
value="submit">




***name.php***

mysql_connect("localhost","user","password");
mysql_select_db ("mydatabasename");
mysql_query ("INSERT INTO name (name,surname)
VALUES ('$name','$surname')");
echo ('Your record has been added.');
print ("");
print ("Your Name:");
print ($name);
print (" ");
print ("");
print ("Your Surname:");
print ($surname);
print ("");
print ("THANKS");
?>

Mahmut

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Unable to install PHP4.2.3 + Apache 1.3 + Win2k

2003-03-14 Thread Diego Fulgueira
Hi.
I followed the instructions in the php manual to install php as CGI module
under apache, under windows. I get the following message when requesting
a php file:

Invalid URI in request GET /mydir/myfile.php HTTP/1.1

I believe this is because Apache is not getting the protocol:host part of
the request
(in this case: http://localhost/). I don't know why this happens.

Something else: The PHP manual recommends adding the line:

ScriptAlias /php/ "c:/php/"

to the http.conf file. But I don't want ONLY the files under /php/  to be
interpreted
as scripts. Rather, I want ALL the files in my documentRoot directory to be
interpreted as scripts.

Any ideas? Thanks in advance


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



[PHP] Upload Progress

2003-03-14 Thread Dominik Werder
Hi all,

when does PHP gets support for a server-html-based form upload progress 
meter?
Does anyone know?

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


Re: [PHP] Re: PDF Creation

2003-03-14 Thread R B
I'm trying to use PDFreportsLite in Windows.
in the /src folder, there is a rep.php example.
But when i run the rep.php script, nothing apears, only the white page and 
the window done status.

In the PDFReportsLite.php, i set:

  $MM_PDFReportsLite_HOSTNAME = "127.0.0.1";
  $MM_PDFReportsLite_DBTYPE = "mysql";
  $MM_PDFReportsLite_DATABASE = "pdfreportslite";   
$MM_PDFReportsLite_USERNAME = "root";
  $MM_PDFReportsLite_PASSWORD = "root";

In the Yaps.inc.php, i set:

if (!defined('YTMP_DIR')) define('YTMP_DIR',"./tmp");
// Complete GhostScript filename
if (!defined('YGS_DIR')) define('YGS_DIR',"./gs");
Can you help me?





From: "Alexandru COSTIN" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [PHP] Re: PDF Creation
Date: Thu, 13 Mar 2003 22:17:37 +0200
Hello,

You should also look at http://www.interakt.ro/products/PDFreportsLite/

It allows you to avoid using the API and concentrate on the reports

Alexandru

--
Alexandru COSTIN
Chief Operating Officer
http://www.interakt.ro/
+4021 411 2610
"Christopher J. Crane" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am just getting into PDF creation and I am having some issues. Can
anyone
> send me a simple script that creates a PDF doc. I would like it to open 
in
> the browser after creation, not create a file. If someone has a simple 
one
> with an image placement as well that would be great. I can figure it out
if
> I have a working one, but everything I tried so far does not work. Here 
is
> the latest I tried and the error I get.
>
> Warning: Wrong parameter count for pdf_close_image() in
> /home/inxdesig/public_html/demos/pennytraders.com/pdf.php on line 20
>
> Fatal error: PDFlib error: function 'PDF_stroke' must not be called in
> 'page' scope in 
/home/inxdesig/public_html/demos/pennytraders.com/pdf.php
on
> line 22
>
>
> 
>
> $pdf = PDF_open();
> pdf_set_info_author($pdf, "Luca Perugini");
> PDF_set_info_title($pdf, "Brochure for FlyStore");
> pdf_set_info_creator($pdf, "See Author");
> pdf_set_info_subject($pdf, "FlyStore");
> PDF_begin_page($pdf, 595, 842);
> PDF_add_outline($pdf, "Item ".$data[1]);
> pdf_set_font($pdf, "Helvetica-Bold" , 20, winansi);
> pdf_set_text_rendering($pdf, 0);
> pdf_show_xy($pdf, "FlyStore Catalogue 2000",50,780);
>
> PDF_show_xy($pdf, "Item : " .$data[1], 100, 700);
>
> PDF_show_xy($pdf, "Description : " .$data[2], 100, 620);
>
> $im = PDF_open_jpeg($pdf, "pass4_sml.jpg");
> pdf_place_image($pdf, $im, 100, 300, 3);
> pdf_close_image ($im);
>
> pdf_stroke($pdf);
> PDF_end_page($pdf);
> PDF_close($pdf);
>
>
> ?>
>
>



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


_
Charla con tus amigos en línea mediante MSN Messenger: 
http://messenger.yupimsn.com/

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


[PHP] Why are these sessionvariables empty?

2003-03-14 Thread André Rosendaal
Hi,

I created a simple example of a problem that I have with a PHP script that
works in Netscape, and in Internet Explorer when cookies are disabled, but
not in Internet Explorer when cookies are enabled. The purpose of the script
is to create a .ram file on the fly, and playback part of a streaming file.

The example consiste of the following two files:

1) test_real.php





">Open Real Playlist



2) play.php (which should be in the same directory as test_real.php)



If test_real.php is opened, and the link 'Open Real Player' is selected, 10
seconds of the streaming file are played. But not in IE with cookies
enabled. In that case, Real displayes the error message;

'unable to locate the server' [...]  rtsp://stream1.surfnet.nl?start=&end=

What you see here is that the values of $filename, $from and $to are empty.
But if you outcomment the line
header("Content-Type: audio/x-pn-realaudio;"); in play.php, the output in
the browsers reads:

rtsp://stream1.surfnet.nl/s/surfnet/real/rd2000/mpeg/sfeermontage.mpg?start=
10&end=20

which is correct. I don't understand why the variables are empty when the
header infomation is sent, but have the correct values if the header is not
sent. Nor do I understand why this does work in Netscape and IT and cookies
disabled. A bug/feature in IE?

I have spend far too much time on this, and your help is very welcome.

Cheers,
André Rosendaal

PS
- The SID implementation is fast abd dirty, I know
- dummy.ram is just a string, not a reference to an existing file: it help
IE to recognize the correct MIME type



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



RE: [PHP] Search/Regular Expression problem

2003-03-14 Thread Poon, Kelvin (Infomart)
THANKS I got it!

-Original Message-
From: Chris Hayes [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 5:45 PM
To: Poon, Kelvin (Infomart); 'Chris Hayes'
Cc: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Search/Regular Expression problem


At 22:15 13-3-2003, Poon, Kelvin (Infomart) wrote:

>Yeah my data are from a database.  How do I use query to search something
>like that?


well like in my code, suppose you want to look in table 'tablename' in 
field 'textfield', and you want to show the fields 'title' and 'textfield', 
and you need the 'ID' too, Then you go

$query='SELECT title,textfield,ID
 FROM tablename
 WHERE textfield LIKE "%word1%"'

for more than one word, need to match all:

$query='SELECT title,textfield,ID
 FROM tablename
 WHERE textfield LIKE "%word1%"
 AND
 textfield LIKE "%word2%"'

to match one of both words:
$query='SELECT title,textfield,ID
 FROM tablename
 WHERE textfield LIKE "%word1%"
 OR
 textfield LIKE "%word2%"'





>-Original Message-
>From: Chris Hayes [mailto:[EMAIL PROTECTED]
>Sent: Thursday, March 13, 2003 4:02 PM
>To: [EMAIL PROTECTED]
>Subject: Re: [PHP] Search/Regular Expression problem
>
>
>At 21:48 13-3-2003, you wrote:
> >My search enginue will bring up a result IF and only if ALL of the words
in
> >$search exist in the result.  For example
> >if
> >
> >$search = Vax Useful Commands
> >
> >Then the result is only true if (eregi(".*Vax.*Useful.*Commands.*",
> >'possible result')) is true
>Are your data in a database? In that case it is much faster to use a query
>to check whether the words are in some record. Regular expressions can take
>quite some time!
>
>
>
> >Now, I don't know how many words there are in $search initially.  How do
I
> >do a search like that?  I mean if I know $search is 3 words then I can do
> >
> >$words = preg_split("/  /", $search);
>I like the 'explode()' function very much , which splits a string on a
>separator (can be ' ') and puts the results in a long array.
>
>
>
>
>
> >if (eregi(".*words[0].*words[1].*words[2].*", 'possible result')) {
> >  .
> >}
> >
> >
> >Even if I know how many words there are, everytime the number of words in
> >$search can be different.
>So if you have used explode() then you can do a loop that goes through the
>array, for instance
>
>$searchwords=explode(' ', $search);
>
>for ($x=0;$x{//build the search command OR build the query
>// i recommend to make it a query, so:
>
>$WHERE.= ' AND textfield=LIKE '"%'.$searchwords[$x].'%"';
>
>}
>
>//now cut off the first ' AND '
>   $WHERE=substr($WHERE,4,strlen($WHERE);
>
>
>now finish the query
>$query="SELECT title,text,ID FROM tablename ".$WHERE;
>
>
>then proceed by doing the query and showing the results.
>
>
>
>
>
>
>
>--
>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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] OT Inactivity Timeout

2003-03-14 Thread Johnson, Kirk

>  But how can I
> set up an inactivity timeout that will logout a person after 
> let's say 20
> minutes of inactivity?

You could put a  refresh on the page, that redirects to an
"inactivity" page. Set the refresh time to the timeout value. Put some
logout code on the "inactivity" page.

Otherwise, you need to use JavaScript, as far as I know.

Kirk

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



[PHP] Re: newbie OOP?

2003-03-14 Thread John Gray
I think it's always worth it to at least design using OO methodologies. 
The coding moves much faster and is much easier to maintain, in my 
experience. A couple of books I've read recently that I'd recommend:

The Object-Oriented Thought Process by Matt Weisfeld and Bill McCarty
Design Patterns Explained: A New Perspective on Object-Oriented Design 
by Alan Shalloway and James R. Trott

If you approach the small sites as ways to add objects to your toolbox, 
you'll end up with reusable objects that are continually refined as you 
use them in new ways. (imho)

- john

Bobby Rahman wrote:
>
>
>
> Hiya
>
> I am new to PHP and was wondering whether to develop small applications
> (20 pages ) is it worth it to use OOP?  Can any recommend any books or
> URLS that explain Object orientated programming and design in detail.
> I have read articles in
>
> www.phpbuilder.com and
> www.phppatterns.com.
>
> In particular I am having troubles breaking my application design-wise,
> into classes and operations.
>
> Any suggestions and tips
>
> Cheers
>
> _
> Stay in touch with MSN Messenger http://messenger.msn.co.uk
>


Bobby Rahman wrote:


Hiya

I am new to PHP and was wondering whether to develop small applications 
(20 pages ) is it worth it to use OOP?  Can any recommend any books or 
URLS that explain Object orientated programming and design in detail.
I have read articles in

www.phpbuilder.com and
www.phppatterns.com.
In particular I am having troubles breaking my application design-wise, 
into classes and operations.

Any suggestions and tips

Cheers

_
Stay in touch with MSN Messenger http://messenger.msn.co.uk


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


[PHP] OT Inactivity Timeout

2003-03-14 Thread Luis Lebron
This may be more of a javascript question than a php question. But how can I
set up an inactivity timeout that will logout a person after let's say 20
minutes of inactivity?


thanks,

Luis 


Re: [PHP] Problem with sessions expiring?

2003-03-14 Thread CPT John W. Holmes
Session files will be cleaned up after 24 minutes by default. So if they
take longer than that, and the garbage collection deletes their session
file, then they are no longer logged in. Increase the session.gc_maxlifetime
parameter in php.ini

---John Holmes...

- Original Message -
From: "Mallen Baker" <[EMAIL PROTECTED]>
To: ">" <<[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 10:59 AM
Subject: [PHP] Problem with sessions expiring?


Hi

I have a process for people to apply for awards online. The login is
controlled using sessions, with a basic session variable set with the
username of the person logged in. In PHP ini the session cookie lifetime is
set to 0 - ie. until the browser session finishes.

Manyof the applicants are using the system, and it is fine.

But a significant minority are having the same problem. They log in, spend
some time entering data into the fields on the form, and when the hit the
button to either save or submit the entry they get a 'you are not logged in'
message and - worse - lose the data they have so far inputted. One user
experienced this after an hour and a half's work - but others have had
problems after considerably shorter periods of time.

As far as I can tell, the problem is not restricted to one platform, and I
haven't yet been able to locate anything that applies to them that wouldn't
apply to others who have successfully used the system.

Is there any known problem - perhaps in relation to certain kinds of
firewall - that would explain this behaviour? Any thoughts on the workaround
I might do short term (above and beyond encouraging people to write their
applications in Word before submitting them) that might alleviate the
problem?

Deadline for the award is two weeks and traffic is getting quite high. Any
help you can give me before it gets worse would be gratefully received!

Thanks - Mallen



This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk


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



Re: [PHP] accidently inserting into web database blank records.

2003-03-14 Thread Chris Hewitt
Mahmut KARADEMIR wrote:

Hi All;
I am trying to add a new record web database using Mysql&PHP.
But after at every add process a new blank record  is added to mysql table.
The entered text is not considered with codes.
What is my trouble in this html or php code?
Could anyone has any idea?
Thanks.
***name.html**




name.. : 
   type="text"
   name="name"
   size="25"
   maxlength="25"
   value="">
  
surname: 
   name="surname"
   size="25"
   maxlength="25">
< input type="submit"  
   name="submit" 
   value="submit">




***name.php***

mysql_connect("localhost","user","password");
mysql_select_db ("mydatabasename");
mysql_query ("INSERT INTO name (name,surname)
VALUES ('$name','$surname')");
echo ('Your record has been added.');
print ("");
print ("Your Name:");
print ($name);
print (" ");
print ("");
print ("Your Surname:");
print ($surname);
print ("");
print ("THANKS");
?>

Try putting your sql statement into a variable and echoing it before 
using it. That way you can see if the statement is correct. I suspect 
not. The way you are coding this assumes register_globals is set to 
"on", which it is not by default in recent versions of PHP.

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


[PHP] Problem with sessions expiring?

2003-03-14 Thread Mallen Baker
Hi

I have a process for people to apply for awards online. The login is controlled using 
sessions, with a basic session variable set with the username of the person logged in. 
In PHP ini the session cookie lifetime is set to 0 - ie. until the browser session 
finishes.

Manyof the applicants are using the system, and it is fine.

But a significant minority are having the same problem. They log in, spend some time 
entering data into the fields on the form, and when the hit the button to either save 
or submit the entry they get a 'you are not logged in' message and - worse - lose the 
data they have so far inputted. One user experienced this after an hour and a half's 
work - but others have had problems after considerably shorter periods of time.

As far as I can tell, the problem is not restricted to one platform, and I haven't yet 
been able to locate anything that applies to them that wouldn't apply to others who 
have successfully used the system.

Is there any known problem - perhaps in relation to certain kinds of firewall - that 
would explain this behaviour? Any thoughts on the workaround I might do short term 
(above and beyond encouraging people to write their applications in Word before 
submitting them) that might alleviate the problem?

Deadline for the award is two weeks and traffic is getting quite high. Any help you 
can give me before it gets worse would be gratefully received!

Thanks - Mallen



This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk


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



Re: [PHP] Re user Identifying

2003-03-14 Thread Martin Mandl
The problem you are describing is implemented in a quite amazing GPL 
shop. You might want to have a look: www.oscommerce.org

Regards Martin

Peter Goggin wrote:
I did not make my request for information clear. The two scenarios which I
have to cover:
1. The user registers as a customer with the site. In this case the shopping
basket and items can be attached to the customer Id. and the shopping basket
made available across sessions. The shopping basket is created when the
first item is added. It is closed when the final order is placed.  I have
already coded this and it works satisfactorily.
2. The user does not register. Instead the process is to add items to a
shopping basket, which is then converted to an order or discarded at the end
of the session. How do I identify shopping baskets belonging to different
concurrent users?  Should I include the session Id in the record, use
cookies or what?
Is the php session Id a unique ID ?

Regards

Peter Goggin


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


Re: [PHP] http_session_vars

2003-03-14 Thread rotsky
Aaah! That clears something up. Thanks.

"Ernest E Vogelsinger" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> At 22:17 13.03.2003, rotsky said:
> [snip]
> >I thought session vars were either POSTed or passed via cookies...
> [snip]
>
> No - you're mixing up the session identifier and session data.
>
> The session identifier is just an arbitrary key to a server-side storage
> where session data is stored. The session identifier (aka SID) is
> effectively passed either via cookie, or via $_REQUEST parameter.
>
> Session data (the $_SESSION array, to be specific) will always be stored
> server-side, by default in a session file. The default filename is
sess_.
>
>
> --
>>O Ernest E. Vogelsinger
>(\)ICQ #13394035
> ^ http://www.vogelsinger.at/
>
>



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



Re: [PHP] Intermittent CGI Errors

2003-03-14 Thread Joshua Groboski
No avail.  Here are the last few lines of the script.  I can hit it 17 times
in a row with no problems.  Then I might hit it three times and get the CGI
Error.  I think it may be IIS not PHP that is the root of this problem.  We
have C++ app that had the same sort of problem on IIS until we moved to
Apache.  Ideally we'd go to Linux or FreeBSD, but I haven't been able to
convice the powers that be.




"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Friday, March 14, 2003, 7:03:09 AM, you wrote:
> JG> My app works very well until you start to hit it hard.  Then I get
> JG> CGI Error
> JG> The specified CGI application misbehaved by not returning a complete
set of
> JG> HTTP headers. The headers it did return are:
>
> JG> The output of my script is a header() redirect so it must be returning
a
> JG> header right?
>
> JG> Joshua Groboski
>
>
> You may need to add an empty line after the header.
>
> --
> regards,
> Tom
>



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



[PHP] accidently inserting into web database blank records.

2003-03-14 Thread Mahmut KARADEMIR
Hi All;
I am trying to add a new record web database using Mysql&PHP.
But after at every add process a new blank record  is added to mysql table.
The entered text is not considered with codes.
What is my trouble in this html or php code?
Could anyone has any idea?
Thanks.
***name.html**




name.. : 
   
surname: 
 < input type="submit"  
name="submit" 
value="submit">




***name.php***
");
print ("Your Name:");
print ($name);
print (" ");
print ("");
print ("Your Surname:");
print ($surname);
print ("");
print ("THANKS");
?>


Mahmut 

Re: [PHP] Newbie MySQL INSERT Q

2003-03-14 Thread CPT John W. Holmes
> Can I have a single SQL string do INSERTS into multiple tables?

No.

---John Holmes...

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



Re: [PHP] php/mySQL time comparison

2003-03-14 Thread CPT John W. Holmes
> Try quoting your dates - you could also edit your code by using the
> BETWEEN SQL keywors.

Using the less than / greater than method is slightly faster and probably
more portable. I don't know how many databases implement BETWEEN.

---John Holmes...


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



Re: [PHP] php/mySQL time comparison

2003-03-14 Thread Brad Wright
Thanks people, thank you very very much. the missing quotes were the
problem. Can't beleive I kept missing that, everytime I re-read the code.

Sorted now, and I've still got some hair!!

You people are legends!!!
Cheers,

Brad 


Nel vino la verità, nella birra la forza, nell'acqua i bacilli
--
In wine there is truth, in beer there is strength, in water there are
bacteria

> From: Brad Wright <[EMAIL PROTECTED]>
> Date: Sat, 15 Mar 2003 00:33:15 +1000
> To: <[EMAIL PROTECTED]>
> Subject: [PHP] php/mySQL time comparison
> 
> Hi all,
> 
> I have been tearing my hair out for weeks with this problem, hope someone
> can help. 
> 
> I want to pull all data out of a mysql table that falls between two dates (a
> start-time and end-time).
> 
> I use PHP to allow the user to specify the time interval, creating 2
> variables 
> 'startTime' and 'endTime'. These are formatted thus: 2002-02-25 00:00:00
> (-MM-DD HH:mm:ss).
> 
> I then use the syntax:
> $query = "select * from Job_TB where teamNo = $teamNo AND startTime >=
> $timeFrom AND endTime <= $timeTo";
> $result = mysql_query($query,$db) or die ("somethings wrong");
> 
> to query the mysql DB. But it doesnt work. Is there a glaring error in my
> syntax? 
> 
> Can anyone help with this as its driving me nuts
> 
> Hope someone can help, thanks in advance,
> brad
> Cheers,
> 
> Brad 
> 
> 
> Nel vino la verità, nella birra la forza, nell'acqua i bacilli
> --
> In wine there is truth, in beer there is strength, in water there are
> bacteria
> 
> 
> -- 
> 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



Re: [PHP] php/mySQL time comparison

2003-03-14 Thread php-editors.com
Try quoting your dates - you could also edit your code by using the 
BETWEEN SQL keywors.

hope this helps

|-|
|- www.php-editors.com|
|- php programming contests   |
|- php tool reviews   |
|- php everything else|
|-|

> Hi all,
> 
> I have been tearing my hair out for weeks with this problem, hope 
someone
> can help. 
> 
> I want to pull all data out of a mysql table that falls between two 
dates (a
> start-time and end-time).
> 
> I use PHP to allow the user to specify the time interval, creating 2
> variables 
> 'startTime' and 'endTime'. These are formatted thus: 2002-02-25 
00:00:00
> (-MM-DD HH:mm:ss).
> 
> I then use the syntax:
> $query = "select * from Job_TB where teamNo = $teamNo AND startTime >=
> $timeFrom AND endTime <= $timeTo";
> $result = mysql_query($query,$db) or die ("somethings wrong");
> 
> to query the mysql DB. But it doesnt work. Is there a glaring error 
in my
> syntax? 
> 
> Can anyone help with this as its driving me nuts
> 
> Hope someone can help, thanks in advance,
> brad
> Cheers,
> 
> Brad 
> 
> 
> Nel vino la verità, nella birra la forza, nell'acqua i bacilli
> --

> In wine there is truth, in beer there is strength, in water there are
> bacteria
> 
> 
> --
> 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] Newbie MySQL INSERT Q

2003-03-14 Thread Charles Kline
Can I have a single SQL string do INSERTS into multiple tables?

Like:

sql="INSERT INTO tbl_1 (id,
email_address_1)
VALUES ($v_personid,
'$v_email');
INSERT INTO tbl_2 (person_id,
interest_id)
VALUES ($v_personid,
$v_int1);";
Or do I need to break them up and use two of these?

$result = $db->query($sql)

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


Re: [PHP] php/mySQL time comparison

2003-03-14 Thread Jason Wong
On Friday 14 March 2003 22:33, Brad Wright wrote:

> I want to pull all data out of a mysql table that falls between two dates
> (a start-time and end-time).
>
> I use PHP to allow the user to specify the time interval, creating 2
> variables
> 'startTime' and 'endTime'. These are formatted thus: 2002-02-25 00:00:00
> (-MM-DD HH:mm:ss).
>
> I then use the syntax:
> $query = "select * from Job_TB where teamNo = $teamNo AND startTime >=
> $timeFrom AND endTime <= $timeTo";

Try enclosing the dates with single-quotes (they are strings).

> $result = mysql_query($query,$db) or die ("somethings wrong");

Try using mysql_error() to see _what_ went wrong instead of just reporting 
that _something_ went wrong.

Also consider using BETWEEN (check mysql manual).

-- 
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
--
/*
The onset and the waning of love make themselves felt in the uneasiness
experienced at being alone together.
-- Jean de la Bruyere
*/


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



Re: [PHP] php/mySQL time comparison

2003-03-14 Thread CPT John W. Holmes
$timeFrom and $timeTo need to be surrounded by quotes within your SQL query
for the format you're using.

$query = "select * from Job_TB where teamNo = $teamNo AND startTime >=
'$timeFrom' AND endTime <= '$timeTo'";

---John Holmes...

- Original Message -
From: "Brad Wright" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 9:33 AM
Subject: [PHP] php/mySQL time comparison


Hi all,

I have been tearing my hair out for weeks with this problem, hope someone
can help.

I want to pull all data out of a mysql table that falls between two dates (a
start-time and end-time).

I use PHP to allow the user to specify the time interval, creating 2
variables
'startTime' and 'endTime'. These are formatted thus: 2002-02-25 00:00:00
(-MM-DD HH:mm:ss).

I then use the syntax:
$query = "select * from Job_TB where teamNo = $teamNo AND startTime >=
$timeFrom AND endTime <= $timeTo";
$result = mysql_query($query,$db) or die ("somethings wrong");

to query the mysql DB. But it doesnt work. Is there a glaring error in my
syntax?

Can anyone help with this as its driving me nuts

Hope someone can help, thanks in advance,
brad
Cheers,

Brad


Nel vino la verità, nella birra la forza, nell'acqua i bacilli
--
In wine there is truth, in beer there is strength, in water there are
bacteria


--
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] php/mySQL time comparison

2003-03-14 Thread Brad Wright
Hi all,

I have been tearing my hair out for weeks with this problem, hope someone
can help. 

I want to pull all data out of a mysql table that falls between two dates (a
start-time and end-time).

I use PHP to allow the user to specify the time interval, creating 2
variables 
'startTime' and 'endTime'. These are formatted thus: 2002-02-25 00:00:00
(-MM-DD HH:mm:ss).

I then use the syntax:
$query = "select * from Job_TB where teamNo = $teamNo AND startTime >=
$timeFrom AND endTime <= $timeTo";
$result = mysql_query($query,$db) or die ("somethings wrong");

to query the mysql DB. But it doesnt work. Is there a glaring error in my
syntax? 

Can anyone help with this as its driving me nuts

Hope someone can help, thanks in advance,
brad
Cheers,

Brad 


Nel vino la verità, nella birra la forza, nell'acqua i bacilli
--
In wine there is truth, in beer there is strength, in water there are
bacteria


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



Re: [PHP] Wildcard fromURL

2003-03-14 Thread Verdon Vaillancourt
Hi Chris,

Thanks for the pointer :) I found some other interesting reference and ideas
on using this in the manual. Now I just need to provide some error checking
in case $_GET['menu'] isn't defined in the URL (that should be pretty
straight fwd) and in case it is defined, but a corresponding image doesn't
exist (in this case because a user could potentially add a menu item to the
db for which there is no pre-existing graphic). That might prove a little
tougher. I guess I could define an array of available images and check
$_GET['menu'] against that, and specify a default if there isn't a match.

Cheers,
Verdon


On 3/13/03 4:10 PM, "Chris Hayes" <[EMAIL PROTECTED]> wrote:

> To read the value of menu in the url, do not use 'menu', but use
> $_GET['menu']  (since PHP 4.1.0)
> 
> To check for '2*' you cannot do what you propose.
> Because PHP is such a friendly language with 'types' you could use a string
> function to pick the first character
> 
> $img_pick=subtr($_GET['menu'],0,1);
> (check the manual on substr() to be sure, in the online manual on www.php.net)
> 
> The maximum of numbers is 10 (0-9), so you may want to just make a separate
> value in the url for this.
> 
> I thionk you can omit the if-list now.
> 
> 
> 
>> echo = "";
> 
> 
> 
> At 21:55 13-3-2003, you wrote:
> 
>> mod.php?mod=userpage&menu=215&page_id=xxx
>> mod.php?mod=userpage&menu=20001&page_id=xxx
>> mod.php?mod=site_map&menu=20010
>> 
>> And would want all the following pages to load an image named something like
>> foo_1.jgp
>> mod.php?mod=userpage&menu=1&page_id=xxx
>> submit.php&menu=100
>> mod.php?mod=userpage&menu=10002&page_id=xxx
>> 
>> In all cases, I know for sure that in the URL I will find menu=x*
>> 
>> Can I set something up like;
>> 
>> if(menu = '2*') { $ImgNo = '2'; }
>> if(menu = '1*') { $ImgNo = '1'; }
>> if(menu = '') { $ImgNo = '3'; }


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



Re: [PHP] What do I do wrong?

2003-03-14 Thread Maciek Ruckgaber Bielecki
On Thu, Mar 13, 2003 at 05:56:40PM -0600, Tom Woody wrote:
> On Fri, 14 Mar 2003 00:37:38 +0100
> Michael Cronstrom <[EMAIL PROTECTED]> wrote:
> 
> > I get the message:
> > 
> > Notice: Undefined variable: msg in 
> > F:\www-root\domain.com\website\script.php on line 202
> >
mate, this is not actually an error is a Notice, and the var $msg is not
defined when the script reaches the line 202. Since i dont know what are
you doing i can't help anymore.

Maciek Ruckgaber
> > whats wrong?
> Questions like this and you are asking for trouble... first off how are
> we supposed to help you with the problem if we don't know what is on
> line 202.  Are we supposed to be clairvoyent, or should we divine the
> answer from tea leaves.  Without the code, or at least the code around
> line 202 you are asking the impossible  yes this would make me a
> troll...
> 
> -- 
> Tom Woody
> Systems Administrator
> 
> Don't throw your computer out the window, 
> throw the Windows out of your computer! 
> 
> 
> -- 
> 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] Problem with fsockopen() and fgetc()

2003-03-14 Thread Christos Nikolaou
I try to connect to a site via fsockopen function and get data calling  a
cgi on remote server using a script like this following.
The response is a large amount of data up to 500Kb. But every 5000
characters approximately I get arbitrary strings like numbers "1400" and
"800" and others like "7be" etc. I don't know what to do to avoid this
trouble.
Please if someone knows, let help me.
Thanks.

PHP SCRIPT

 $fp = fsockopen ("ns.ana.gr", 80);
  fputs ($fp, "GET
http://www.xxx.com/cgibin/xxx.exeservice=SPE&format=TXT&time=3&day=11/03/200
3 HTTP/1.1\r\nHost: www.xxx.com\r\nAuthorization: Basic
x==\r\n\r\n");

while (!feof($fp))
 {
$line = fgetc ($fp);
echo $line;
}
fclose ($fp);



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



[PHP] Re: Collating Values from database fields

2003-03-14 Thread David Eisenhart
Matt,

You are looking at least 2 separate select queries - one to retrieve the
player data on a tournament by tournament basis and a second query to
'calculate' the summary data. Now, you will be needing the GROUP BY clause
in the second query while drawing on at least the player and appearances
tables (check out GROUP BY in the MySQL (I assume you are using MySQL)
online manual.) Then simply print out the results of the respective select
queries.

David Eisenhart


"Matt Macleod" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I'm building a site for my rugby club and I want to present players'
> data ie: number of appearances, points scored and so on.
>
> I have three tables in my database: a table of tournaments (date,
> location, opposition, etc), a table of players (name, contact details,
> position, etc) and a table of appearances (fixtureID, playerID, tries
> scored, penalties scored, cautions etc.
>
> When a player is selected from a drop-down list, their data will appear
> in a table by drawing from the 'appearances' table based on the player's
> ID thus:
>
> Player: Matt MacLeod
> -
> Tournament 1 / 19/01/2003 / 2 tries / 0 pens / 0 cautions
> Tournament 2 / 24/03/2003 / 4 tries / 3 pens / 1 caution
> Tournament 3 / 27/03/2003 / 0 tries / 3 pens / 0 cautions
>
> I then want to print the player's totals thus:
>
> 3 tournaments / 6 tries / 6 pens / 1 caution
>
> This is where I get stuck. I know how to display the data on a
> tournament by tournament bais, and get PHP to build an additional table
> row for each appearance by the player, but I am unsure of how to add up
> the columns and print the totals at the end of the table.
>
> Any help would be greatly appreciated.
> Thanks,
>
> Matt
>







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



RE: [PHP] preg_replace question,

2003-03-14 Thread John W. Holmes
> the current function been put in place replaces [f1253f] with a file,
for
> inside cms content , where 1253 is the key or the id of the filename
in
> the
> database , therefore to denote its an ftool they added f's around the
keys
> ,
> so maybe i could get away with [1253], what else i'm asking if
> preg_replace is
> more efficient over eregi_replace ?

Yeah, it is.

preg_match_all("/\[f([0-9]+)f\]/i",$string,$matches);

$matches will then contain the numbers you're looking for (in an array).
Read the file or whatever you need, then do another replace to put the
file contents in place of the code. 

If you read it like this:

$file['1234'] = "data from file 1234";
$file['3456'] = "data from file 3456";

You can use the following to replace the tags

preg_replace("/\[f([0-9]+)\]/ie",'$file[$1]',$string);

the last one is untested, but something like that works. The key is the
'e' modifier. If you know you're always going to have lower case 'f'
characters, then remove the 'i' modifier from each pattern.

---John Holmes...



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



RE: [PHP] date

2003-03-14 Thread John W. Holmes
> If I have a date in this format :19-MAR-03 how do I get the next date
(the
> date plus 1)?

echo strtoupper(date('d-M-y',strtotime("$date +1 day")));

But why do you have it in that format to begin with?

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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



[PHP] Re: newbie OOP?

2003-03-14 Thread rush
"Bobby Rahman" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am new to PHP and was wondering whether to develop small applications
(20
> pages ) is it worth it to use OOP?

My take is that on 20 pages especially if they behave like app, it makes
sence to use OO.

> In particular I am having troubles breaking my application design-wise,
into
> classes and operations.

I could give you some hints how would you go on dividing things with
TemplateTamer.

When working with TT, you need to define a class for each page on your site,
and this class provides the data in the run time needed to display the page
(i.e. it provides values for the variables, and which templates get
displayed, etc).

First you would define base class for your site, that would contain handling
of elements common to all of your pages. For instance menu, footer, you get
the idea. For the parts that change from page to page (perhaps title, or
main content in the middle, or..) you would call a member function leaving
this function responsible to return correct values.

Now when defining the class for particular page, you would go on by
extending this base class for this site, and automatically inherit common
behaviour. For things that are specific for this page you would overide
member functions from the base class and provide specific implementation
(for instance function returning a middle content).

Now dependning on the size and complexity of your site, 2 things would
probably come naturaly. One is that you would refine your class hiearchy of
pages. So you would for instance have one base class, then for instance
class for the user pages, and class for supervisor pages, both of them
extending base class. Now all user pages would extend user page class, and
all supervisor pages would extend supervisor page class.

Anothe thing that could happen is that you would define classes for parts of
your interface, for instance toolbox, or similar. When you do so, you will
be able to configure them and insert as components in each particular page.

Probably it does sound like a lot of complication, especially in the
begging, but once you get a hang of it, it is a real time saver, an let's
you concentrate on your applications behavior and functionality. If you need
some more advice how to use TemplateTamer and OO togehter, drop me an
e-mail.

rush
--
http://www.templatetamer.com/




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



[PHP] date

2003-03-14 Thread Diana Castillo
If I have a date in this format :19-MAR-03 how do I get the next date (the
date plus 1)?



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



[PHP] Re: need a new challenge

2003-03-14 Thread Martin Mandl
there were some nice threads last week:
  - formating the input of a name:
eg:  stuart o'neil   -> Stuart O'Neil
 RONALD MCDONALD -> Ronald McDonald
 serge d'avignon -> Serge d'Avignon
 von Braun   -> von Braun
... implementing that for all possible langugae struktures ...
  - another was formating street names

Php-Editors.Com wrote:
Im looking for ideas for a 2 programming contests.
What I need is a very basic challenge - that new php programmers can 
do, but involves them mixing there thinking/programming and creative 
abilities.
I also need a challenge for professional programmers - something that 
involves lots of thought, tests their problem solving ability and code 
useage.
I would be very glad to hear your ideas on this.

Stuart


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


Re: [PHP] Re user Identifying

2003-03-14 Thread Peter Goggin
I did not make my request for information clear. The two scenarios which I
have to cover:

1. The user registers as a customer with the site. In this case the shopping
basket and items can be attached to the customer Id. and the shopping basket
made available across sessions. The shopping basket is created when the
first item is added. It is closed when the final order is placed.  I have
already coded this and it works satisfactorily.

2. The user does not register. Instead the process is to add items to a
shopping basket, which is then converted to an order or discarded at the end
of the session. How do I identify shopping baskets belonging to different
concurrent users?  Should I include the session Id in the record, use
cookies or what?

Is the php session Id a unique ID ?

Regards

Peter Goggin
- Original Message -
From: "-{ Rene Brehmer }-" <[EMAIL PROTECTED]>
To: "Peter Goggin" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 4:13 AM
Subject: Re: [PHP] Re user Identifying


> On Thu, 13 Mar 2003 19:55:04 +1100, Peter Goggin wrote about "[PHP] Re
> user Identifying" what the universal translator turned into this:
>
> >My site uses shopping baskets to record what the user wants to but. These
> >records are stored in a database against the user.   This requires the
user
> >to register and log onto the site. Is it possible to avoid this by the
use
> >of cookies or some other method?
>
> To retain a users identity, when the users ain't on your site, you've got
> no way around cookies.
>
> Be aware that the cookie should only (for security reasons) contain the
> user's ID, not his/her login or password.
>
> When the user returns to the site, you'll need to look for the cookie, and
> then compare the userID to the database, and provide auto-login by
> retrieving login and password from the database.
>
> I don't use cookies myself, so can't help beyond that.
>
> Rene
>
> --
> Rene Brehmer
>
> This message was written on 100% recycled spam.
>
> Come see! My brand new site is now online!
> http://www.metalbunny.net
>


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



Re: [PHP] Will this do what I think it will?

2003-03-14 Thread CPT John W. Holmes
How didn't it work? How did you test it? I'd be more than willing to help
you test it, but everything is sort of vague right now.

---John Holmes...

- Original Message -
From: "Dennis Gearon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 14, 2003 12:20 AM
Subject: Re: [PHP] Will this do what I think it will?


> Well,
> it didn't work, and I wrote it because I'm unfamiliar with regex's.
>
> "John W. Holmes" wrote:
> >
> > > I call this file 'clean_gpc.php'.
> > >
> > > Will it:
> > >   // trim all control codes and spaces from ends of string
> > >   // standardize Window's CRLF in middle of string to \n
> > >   // standardize Apple's  LF   in middle of string to \n
> > >   // remove all control characters BELOW \n
> > >   // remove all control characters ABOVE \n
> > >   // compresse run on spaces to a single space
> > >   // compresse run on carriage returns to a max of 2
> >
> > Sure... why not. Honestly, why did you write this email? You wasted a
> > couple hundred people's time when you could have just run the function
> > yourself.
> >
> > ---John W. Holmes...
> >
> > PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> > today. http://www.phparch.com/


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



Re: [PHP] String Replace

2003-03-14 Thread Leif K-Brooks
www.php.net/str-replace

Awlad Hussain wrote:

I have a string with underscore in the middle.. like "This_That"
which function do i use to replace the _ with space? eg to "This That"
the string is in a variable..

I know its really simple but just don't know which function to use.

any suggestion?

-awlad
 

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.


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


RE: [PHP] String Replace

2003-03-14 Thread Niklas Lampén
There is many functions that can do it.
str_replace() is the fastest on thisone. preg_match() comes on second
position, and after that comes ereg_replace().
But if you need to do harder replacing, preg_match() is the one to use, imo.


Niklas


-Original Message-
From: Awlad Hussain [mailto:[EMAIL PROTECTED] 
Sent: 14. maaliskuuta 2003 13:26
To: [EMAIL PROTECTED]
Subject: [PHP] String Replace


I have a string with underscore in the middle.. like "This_That" which
function do i use to replace the _ with space? eg to "This That"

the string is in a variable..

I know its really simple but just don't know which function to use.

any suggestion?

-awlad

###
This message has been scanned by F-Secure Anti-Virus for Internet Mail.
For more information, connect to http://www.F-Secure.com/

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



[PHP] String Replace

2003-03-14 Thread Awlad Hussain
I have a string with underscore in the middle.. like "This_That"
which function do i use to replace the _ with space? eg to "This That"

the string is in a variable..

I know its really simple but just don't know which function to use.

any suggestion?

-awlad

RE: [PHP] need a new challenge

2003-03-14 Thread php-editors.com
George,

Thanks for your idea, I do like it - the only problem is that sound 
very much like the current beginners contest (phone book and diary) - 
great minds think alike :) - it sound like you may be able to tweek 
your code and enter it in the contest !!

I will be adding a repository for php apps in the future - i only have 
a code snippet library (for single scripts) live.

cheers,
Stuart


> Stuart,
> 
> How about a group diary.
> 
> I built a diary for my workgroup, it uses frames, has a frame for 
favourite
> links, a frame with a small calendar and the main frame holds the 
group
> diary.
> 
> Every Friday morning each member of the group is sent an HTML 
formatted
> email with their own diary for the following wee, followed by a diary
> listing the other groupmembers appointments. It took me a week 
starting from
> scratch and I still consider myself a novice.
> 
> This is something that covers several aspects of php coding, how it 
fits
> within webspace and how it deals with email and scheduling.
> 
> Mine is setup on Win NT.
> 
> If you want I can send you my code.
> 
> George in Oxford
> 
> > -Original Message-
> > From: php-editors.com [mailto:[EMAIL PROTECTED]
> > Sent: 14 March 2003 10:13 am
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] need a new challenge
> >
> >
> >
> > Im looking for ideas for a 2 programming contests.
> > What I need is a very basic challenge - that new php programmers can
> > do, but involves them mixing there thinking/programming and creative
> > abilities.
> > I also need a challenge for professional programmers - something 
that
> > involves lots of thought, tests their problem solving ability and 
code
> > useage.
> > I would be very glad to hear your ideas on this.
> >
> > Stuart
> >
> > |-|
> > |- www.php-editors.com|
> > |- php programming contests   |
> > |- php tool reviews   |
> > |- php everything else|
> > |-|
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> 

|-|
|- www.php-editors.com|
|- php programming contests   |
|- php tool reviews   |
|- php everything else|
|-|


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



[PHP] "Socket must be already connected" err while fopen('http://...') on Apache

2003-03-14 Thread Kyryll Mirnenko
  Suppose I'm running PHP 4.0.0 on Apache 1.3.12 on a remote server (linked as a 
static module, OS is reported as AIX - kinda UNIX). My PHP script tries to 
fopen('http://somewhere.else.com/') while responding to HTTP request itself. I've got 
a "Socket must be already connected" error. Trying this on PHP 4.2.1 & Apache 2.0.36 
on Win32 at home (localhost) works OK. I'm a little dummy in sockets, PLEASE GIVE ANY 
SOLUTION! Suppose I can't upgrade neither Apache nor PHP, but in the worst case I can 
use full UNIX utilities collection on that server, including PERL.


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



[PHP] RE: newbie OOP?

2003-03-14 Thread Bobby Rahman


Hiya

I am new to PHP and was wondering whether to develop small applications (20 
pages ) is it worth it to use OOP?  Can any recommend any books or URLS that 
explain Object orientated programming and design in detail.
I have read articles in

www.phpbuilder.com and
www.phppatterns.com.
In particular I am having troubles breaking my application design-wise, into 
classes and operations.

Any suggestions and tips

Cheers

_
Stay in touch with MSN Messenger http://messenger.msn.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Collating Values from database fields

2003-03-14 Thread Matt MacLeod
Hi,

I'm building a site for my rugby club and I want to present players'
data ie: number of appearances, points scored and so on.

I have three tables in my database: a table of tournaments (date,
location, opposition, etc), a table of players (name, contact details,
position, etc) and a table of appearances (fixtureID, playerID, tries
scored, penalties scored, cautions etc.

When a player is selected from a drop-down list, their data will appear
in a table by drawing from the 'appearances' table based on the player's
ID thus:

Player: Matt MacLeod
-
Tournament 1 / 19/01/2003 / 2 tries / 0 pens / 0 cautions
Tournament 2 / 24/03/2003 / 4 tries / 3 pens / 1 caution
Tournament 3 / 27/03/2003 / 0 tries / 3 pens / 0 cautions

I then want to print the player's totals thus:

3 tournaments / 6 tries / 6 pens / 1 caution

This is where I get stuck. I know how to display the data on a
tournament by tournament bais, and get PHP to build an additional table
row for each appearance by the player, but I am unsure of how to add up
the columns and print the totals at the end of the table.

Any help would be greatly appreciated.
Thanks,

Matt 


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



RE: [PHP] SQL DISTINCT with MYSQL

2003-03-14 Thread Uttam
here's my solution:

I presume you need the name of the file the user last accessed.

This requires a datetime column in your useronline file which records the
time a user has accessed a page.  If the name of this field is atime then

a) create a temporary table storing lact access time for each user
CREATE TEMPORARY TABLE tmp SELECT uname, MAX(atime) FROM useronline
GROUP BY uname;
b) select the uname, file by joining the useronline table with this
temporary table:
 SELECT useronline.uname, useronline.file
 FROM useronline INNER JOIN tmp
 ON useronline.uname=tmp.uname AND useronline.atime=tmp.atime

You can index on atime field for faster results.

hope it helps...

regards,

-Original Message-
From: Vernon [mailto:[EMAIL PROTECTED]
Sent: Friday, March 14, 2003 06:20
To: [EMAIL PROTECTED]
Subject: Re: [PHP] SQL DISTINCT with MYSQL


The problem is

> a f1
> a f2
> b f1
> b f2

Where I need it to return the a only once and the b only once. For
instance
the vlaues may be:

jimmy login.php
jimmy successfullogin.php
susan  default.php
susan  search.php

Since the records are order the way I need them to be (or else I could
use a
ORDER BY command) the last one is the only one I want and only want to
return:

jimmy successfullogin.php
susan  search.php

make sense?

"Arturo Barajas" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Vernon,
>
> Don't know if I get it right, but:
>
> SELECT DISTINCT uname, file
> FROM useronline
>
> should do that.
>
> I mean, if you have something like:
>
> uname file
> a f1
> a f2
> a f1
> a f2
> b f1
> b f2
> b f1
>
> the query should deliver:
>
> uname file
> a f1
> a f2
> b f1
> b f2
>
> Is that what you're looking for?
> --
> Un gran saludo/Big regards...
>Arturo Barajas, IT/Systems PPG MX (SJDR)
>(427) 271-9918, x448
>
> > -Original Message-
> > From: Vernon [mailto:[EMAIL PROTECTED]
> > Sent: Jueves, 13 de Marzo de 2003 06:24 p.m.
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] SQL DISTINCT with MYSQL
> >
> >
> > I'm setting up a user online system using MySQL where I have
> > 4 fields, all
> > of which is working fine.
> >
> > I need the information from all the fields but want only
> > distinct values
> > based on the uname column. If I use the:
> >
> > SELECT DISTINCT uname
> > FROM useronline
> >
> > of course I come back with the values I desire, but only the
> > user names.
> >
> > As I am also tracking the page they are on I need other
> > columns in the table
> > as well. So the question is, using an SQL statement, how do I
> > return only
> > distinct useronline.uname values from the database as well as the
> > useronline.file column?
> >
> > Thanks
> >
> >
> >
> >
> >
> > --
> > 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] need a new challenge

2003-03-14 Thread php-editors.com

Im looking for ideas for a 2 programming contests.
What I need is a very basic challenge - that new php programmers can 
do, but involves them mixing there thinking/programming and creative 
abilities.
I also need a challenge for professional programmers - something that 
involves lots of thought, tests their problem solving ability and code 
useage.
I would be very glad to hear your ideas on this.

Stuart

|-|
|- www.php-editors.com|
|- php programming contests   |
|- php tool reviews   |
|- php everything else|
|-|


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



[PHP] Re: PHP XML Reference

2003-03-14 Thread David Eisenhart
check out the book XML and PHP by Vikram Vaswani, News Riders; a well
written and concise treatment of xml and php.

David Eisenhart



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



[PHP] PHP DOM XML Function

2003-03-14 Thread Fatih Üstündağ
do you have any idea about PHP DOM XML functions?
when will PHP DOM XML functions be stable?


Fatih Üstündağ
Yöre Elektronik Yayımcılık A.Ş.
0 212 234 00 90


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



RE: [PHP] Page Rederection Problems

2003-03-14 Thread Michael Roger C. Bianan
Hi Kelly,

It would be better if you just take off the second part,
the one enclosed in "<>".

Also, header("Location: location");

notice, Location starts with capital L .

Hope this helps,

miches:)

-Original Message-
From: Kelly Protsko [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 1:18 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Page Rederection Problems


Basically what I am doing is having a post  call a page with the
following code to email the form contents. 
I want the page to redirect back to the page it was sent from after the
mail has been sent.   The top mailing part works fine but when I put the
header redirect in at the bottom I get an error on my post saying the
page doesn't exist anymore. 
Any idea what would be causing this?
 
 
$formcontent = " $_POST[content]";
 $toaddress = "[EMAIL PROTECTED]";
 $subjectline = "$_POST[subject]";
 $headers = "From: $_POST[email]";
 mail( $toaddress, $subjectline, $formcontent, $headers);
 
header("location: http://www.website.com  ");
 
Thanks 
 
Kelly


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



RE: [PHP] Redirect to a new page?

2003-03-14 Thread Michael Roger C. Bianan
if the browser doesn't support Javascript use this :

if (YES) {

header("Location: thispage.php");
}

else {
header("Location: thatpage.php");
}
exit();

Just make sure you haven't send any output to the browser yet.
A suggestion:  place this code before you ever print in your 
code.  I know you could do it :)

Thanks,

Miches:)

-Original Message-
From: Beauford.2002 [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 10:44 AM
To: PHP General
Subject: [PHP] Redirect to a new page?


Hi,

I have searched around for hours on this and nothing seems to work. I want
simply to do this

if yes -  goto thispage.php

if no - goto thatpage.php

Thanks



-- 
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] Re: PHP url variables

2003-03-14 Thread Cranky Kong
Have a look at the parameter register_global in your php.ini
By default in the recent version of PHP, this parameter is set by default to
off for security reason.
So if you want to use $id, you just have to set this parameter to on


"Stephen" <[EMAIL PROTECTED]> a écrit dans le message de news:
[EMAIL PROTECTED]
> Hi
>
> I have just installed PHP 4 and Apache 2 but when I pass a variable in a
url
> eg ?id=1
> I can't get the variable value by $id, I have to use $_GET['id'] or
> $_POST['id']
>
> Is there a setting I need to change to allow me to use the $id? If there
is
> it will save a lot of additional coding.
>
> Thanks,
>
> Stephen
>
>



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



[PHP] Re: PHP XML Reference

2003-03-14 Thread Alexandru COSTIN
Hello,
You will also might want to try the free Krysalis platform - it's
designed from scratch for XML/XSL content publishing (a la Cocoon) and you
will find it very useful for your goals.

http://www.interakt.ro/products/Krysalis/



Alexnadru

--
Alexandru COSTIN
Chief Operating Officer
http://www.interakt.ro/
+4021 411 2610
"Tim Funk" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Hi,
>
> I am new to PHP, however i have a good handle on C programming and
therefore hope to apply those conceps to PHP programming quickly. I am
looking for a print reference that can help me to construct a web-based
front-end for an application using XML. Any help in this regard will bemuch
appreciated.
>
> Thanks,
> Tim
>
>
>
> -
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online



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



[PHP] What is the fastest method for changing php settings (save php.ini)?

2003-03-14 Thread Rob Paxon
I'm sorry if this question has been answered before, but I couldn't find 
anything in the archives.  I don't have access to php.ini and I was 
wondering which method for changing settings is the fastest.  Take, for 
example, "session.cache_expire".  This can be set via ini_set(), 
session_cache_expire(), or in .htaccess.  I have a handful of session- 
related settings that need to be set with each script and with that in 
mind, would it be faster to have .htaccess do the work or would ini_set be 
the optimum method?  And what of those, like "session.cache_expire", that 
have specific function that can be used?

Thanks ahead of time for any help.

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


  1   2   >