php-general Digest 29 Sep 2002 15:43:02 -0000 Issue 1614

Topics (messages 118035 through 118078):

Posting a value to one form to another
        118035 by: Uma Shankari T.
        118037 by: Thoenen, Peter  Mr.  EPS
        118040 by: Sascha Cunz
        118041 by: Uma Shankari T.
        118042 by: Sascha Cunz
        118043 by: Uma Shankari T.
        118044 by: Chris Shiflett
        118045 by: Uma Shankari T.
        118046 by: Chris Shiflett
        118048 by: Uma Shankari T.

Include...
        118036 by: Chuck \"PUP\" Payne
        118038 by: Chuck PUP Payne
        118039 by: Chris Shiflett
        118053 by: John Hinton

Include Part 2
        118047 by: Chuck PUP Payne
        118049 by: Justin French
        118054 by: John W. Holmes
        118055 by: Chuck PUP Payne
        118057 by: Chuck PUP Payne
        118058 by: Justin French
        118059 by: Chris Shiflett

Re: Help! Can't set cookie or redirect!!!
        118050 by: John W. Holmes

Re: John Holmes->Re: [PHP] Challenging problem for you programing gurus...
        118051 by: John W. Holmes

Re: Dear all
        118052 by: John W. Holmes

Problems with dbase_create function
        118056 by: Matt Neimeyer
        118071 by: John W. Holmes

Static constants? Server persistent?
        118060 by: Jean-Christian Imbeault
        118061 by: Justin French
        118062 by: Jean-Christian Imbeault
        118066 by: Justin French
        118067 by: Jean-Christian Imbeault
        118068 by: Justin French
        118069 by: Jean-Christian Imbeault

connection
        118063 by: DC
        118064 by: Justin French

auto_prepend: *Exactly* like include()?
        118065 by: Jean-Christian Imbeault

Re: passing select list variable from page1 to insertstatement astable name on page2
        118070 by: John W. Holmes

date question
        118072 by: Jonas Geiregat
        118073 by: Jean-Christian Imbeault
        118074 by: Justin French
        118075 by: Jonas Geiregat
        118076 by: Matt

Copying a remote graphic to my server.
        118077 by: scott
        118078 by: Rasmus Lerdorf

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---

Hello ,

<a href="Delay.php?hid=<?php echo $hid+1; ?>"><img src="Gif/nextque.gif" 
border="0"></a>

While clicking this link the $hid value get incremented and fetch the value 
from the database according to that..the same thing is working in linux 
platform and it is not working for the windows platform..the value is not 
getting increment..Can anyone please tell me how to go about with this..??

Regards,
Uma


--- End Message ---
--- Begin Message ---
You are using method GET correct?  This will not work for POST's on any
platform that I know of.  Browser default behavior for clicks are GET.  You
could create a custom browser to POST all clicks..but wouldn't work very
well :)

Only reason I am asking is "Posting a value" ...though Posting might != POST
:)

On the receiving form ... try the following code and see if anything looks
out of place.

##################

  echo $_SERVER['REQUEST_METHOD'].'<br/><br/>';
  echo 'GET<br/>';
  foreach ($_GET as $key => $value) {
    echo "Key: $key; Value: $value<br/>";
  }
  echo 'POST<br/>';
  foreach ($_POST as $key => $value) {
    echo "Key: $key; Value: $value<br/>";
  }
  die;

##################3

Cheers,

-Peter


> -----Original Message-----
> From: Uma Shankari T. [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 29, 2002 05:45
> To: PHP
> Subject: [PHP] Posting a value to one form to another
> 
> 
> 
> Hello ,
> 
> <a href="Delay.php?hid=<?php echo $hid+1; ?>"><img 
> src="Gif/nextque.gif" 
> border="0"></a>
> 
> While clicking this link the $hid value get incremented and 
> fetch the value 
> from the database according to that..the same thing is 
> working in linux 
> platform and it is not working for the windows platform..the 
> value is not 
> getting increment..Can anyone please tell me how to go about 
> with this..??
> 
> Regards,
> Uma
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
--- End Message ---
--- Begin Message ---
I think your linux plattform has a version of PHP older than 4.2.0 and your 
Windows machine has a newer Version. In this "old" Versions, Register_Globals 
was turned on.
Try to access $hid by using: <?php echo $_GET['hid']; ?>

Regards
Sascha

> Hello ,
>
> <a href="Delay.php?hid=<?php echo $hid+1; ?>"><img src="Gif/nextque.gif"
> border="0"></a>
>
> While clicking this link the $hid value get incremented and fetch the value
> from the database according to that..the same thing is working in linux
> platform and it is not working for the windows platform..the value is not
> getting increment..Can anyone please tell me how to go about with this..??
>
> Regards,
> Uma

--- End Message ---
--- Begin Message ---


Hello,


On Sun, 29 Sep 2002, Sascha Cunz wrote:

SC>I think your linux plattform has a version of PHP older than 4.2.0 and your 
SC>Windows machine has a newer Version. In this "old" Versions, Register_Globals 
SC>was turned on.
SC>Try to access $hid by using: <?php echo $_GET['hid']; ?>
SC>


I have tried like the code you have mentioned above..it is not 
fetching..Actually it is displaying in the url bar correctly with the 
incremented $hid value..but displaying the result correspond to the $hid 
initial value..Can anyone please tell me how to go about with this..??

Regards,
Uma

--- End Message ---
--- Begin Message ---
Oops, of course you must add one to it, too. like:
<?php echo $_GET['hid']+1; ?>

Regards,
Sascha

> Hello,
>
>
> On Sun, 29 Sep 2002, Sascha Cunz wrote:
>
> SC>I think your linux plattform has a version of PHP older than 4.2.0 and
> your SC>Windows machine has a newer Version. In this "old" Versions,
> Register_Globals SC>was turned on.
> SC>Try to access $hid by using: <?php echo $_GET['hid']; ?>
> SC>
>
>
> I have tried like the code you have mentioned above..it is not
> fetching..Actually it is displaying in the url bar correctly with the
> incremented $hid value..but displaying the result correspond to the $hid
> initial value..Can anyone please tell me how to go about with this..??
>
> Regards,
> Uma

--- End Message ---
--- Begin Message ---

Hello,


On Sun, 29 Sep 2002, Sascha Cunz wrote:

SC>Oops, of course you must add one to it, too. like:
SC><?php echo $_GET['hid']+1; ?>
SC>

Still it is incrementing but not fetching the value correspond from the 
database..In linux paltform it is working without any error..Can anyone 
please tell me how to go about with this..?? or any setting have to be 
made in php.ini file to enable this..

Regards,
Uma 


--- End Message ---
--- Begin Message ---
Uma,

So, you are saying your URL looks something like this:

http://example.org/delay.php?hid=4

And, when you output the value of $_GET["hid"], it outputs 3?

Uma Shankari T. wrote:

>Actually it is displaying in the url bar correctly with the 
>incremented $hid value..but displaying the result correspond to the $hid 
>initial value..Can anyone please tell me how to go about with this..??
>

--- End Message ---
--- Begin Message ---

Hello,

CS>
CS>So, you are saying your URL looks something like this:
CS>
CS>http://example.org/delay.php?hid=4

Yes..my url is look like this only..

CS>
CS>And, when you output the value of $_GET["hid"], it outputs 3?
CS>

But in the url the value are getting incremented and it is displaying 
the result correspond to the value 1 only ..Can anyone please tell me how 
to go about with this..??

Regards,
Uma



--- End Message ---
--- Begin Message ---
Uma,

I'm sorry, but I'm still confused. Maybe someone else better understands 
your question.

Given the following example script, delay.php:

<?
echo $_GET["hid"];
?>

A URL such as http://example.org/delay.php?hid=4 will output the following:

4

Are you saying this is not happening? This is what it sounds like you 
are saying, but I have a hard time believing it.

Chris

Uma Shankari T. wrote:

>Hello,
>
>CS>
>CS>So, you are saying your URL looks something like this:
>CS>
>CS>http://example.org/delay.php?hid=4
>
>Yes..my url is look like this only..
>
>CS>
>CS>And, when you output the value of $_GET["hid"], it outputs 3?
>CS>
>
>But in the url the value are getting incremented and it is displaying 
>the result correspond to the value 1 only ..Can anyone please tell me how 
>to go about with this..??
>
>Regards,
>Uma
>
>
>
>
>  
>


--- End Message ---
--- Begin Message ---

Hello,

On Sun, 29 Sep 2002, Chris Shiflett wrote:

CS>Uma,
CS>
CS>I'm sorry, but I'm still confused. Maybe someone else better understands 
CS>your question.
CS>
CS>Given the following example script, delay.php:
CS>
CS><?
CS>echo $_GET["hid"];
CS>?>
CS>
CS>A URL such as http://example.org/delay.php?hid=4 will output the following:
CS>
CS>4
CS>

Actually it is displaying this in the url output and in the screen it is 
displaying the answer correspond to the value 1..Now you got...

Regards,
Uma

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

I am trying to start using inc files. But I am this this error....

Warning: Failed opening '/local/htdocs/movies/style.inc' for inclusion
(include_path='.:/usr/share/php') in /local/htdocs/movies/lmenu.php on line
3

I have this in my lmenu.php

Include ("/local/htdocs/movies/style.inc");

So can't someone telling me what I am doing wrong. I thought .inc where
easy.


Chuck Payne


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

I am trying to start using inc files. But I am this this error....

Warning: Failed opening '/local/htdocs/movies/style.inc' for inclusion
(include_path='.:/usr/share/php') in /local/htdocs/movies/lmenu.php on line
3

I have this in my lmenu.php

Include ("/local/htdocs/movies/style.inc");

So can't someone telling me what I am doing wrong. I thought .inc where
easy.


Chuck Payne


--- End Message ---
--- Begin Message ---
Chuck,

It is likely that either:

1. That file does not exist.
2. PHP does not have read privileges on that file.

Chris

Chuck PUP Payne wrote:

>I am trying to start using inc files. But I am this this error....
>
>Warning: Failed opening '/local/htdocs/movies/style.inc' for inclusion
>(include_path='.:/usr/share/php') in /local/htdocs/movies/lmenu.php on line
>3
>
>I have this in my lmenu.php
>
>Include ("/local/htdocs/movies/style.inc");
>

--- End Message ---
--- Begin Message ---
Chuck \"PUP\" Payne wrote:

>Hi,
>
>I am trying to start using inc files. But I am this this error....
>
>Warning: Failed opening '/local/htdocs/movies/style.inc' for inclusion
>(include_path='.:/usr/share/php') in /local/htdocs/movies/lmenu.php on line
>3
>
>I have this in my lmenu.php
>
>Include ("/local/htdocs/movies/style.inc");
>
>So can't someone telling me what I am doing wrong. I thought .inc where
>easy.
>
>
>Chuck Payne
>
>
>
>  
>
PHP gets lost a lot with regards to where it is. Try
Include ("style.inc");

With what you have, assuming lmenu.php is in /local/htdocs/movies, it is 
likely looking for
/local/htdocs/movies/local/htdocs/movies/style.inc
It is finicky!

John Hinton




--- End Message ---
--- Begin Message ---
Ok, I am trying to make my design a lot easier. I want to know if I can do
this...

I want to set up in my php page this...


$rows;

Under my db_info.inc I want to store this so that I can add delete from it.

$row = "$title = myrow[title]; $format = myrow[format]; $category =
myrow[category];"

Am I wrong to try this way? Do I need to set it up as fuction to call on?

Chuck Payne

--- End Message ---
--- Begin Message ---
Not sure I fully understand, but usually this stuff calls for either a
function, or an included file of code... in your case, sounds like a
function is required, but I may not fully understand...

Regards,

Justin


on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:

> Ok, I am trying to make my design a lot easier. I want to know if I can do
> this...
> 
> I want to set up in my php page this...
> 
> 
> $rows;
> 
> Under my db_info.inc I want to store this so that I can add delete from it.
> 
> $row = "$title = myrow[title]; $format = myrow[format]; $category =
> myrow[category];"
> 
> Am I wrong to try this way? Do I need to set it up as fuction to call on?
> 
> Chuck Payne
> 

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 29, 2002 1:29 AM
> To: PHP General
> Subject: [PHP] Include Part 2
> 
> Ok, I am trying to make my design a lot easier. I want to know if I
can do
> this...
> 
> I want to set up in my php page this...
> 
> 
> $rows;
> 
> Under my db_info.inc I want to store this so that I can add delete
from
> it.
> 
> $row = "$title = myrow[title]; $format = myrow[format]; $category =
> myrow[category];"
> 
> Am I wrong to try this way? Do I need to set it up as fuction to call
on?

Yes, you are wrong. How wrong you are, I cannot tell, because I have no
idea what you are saying...

---John Holmes...


--- End Message ---
--- Begin Message ---
What I was wanting to do was store the myrows under let say, db_info.inc
file. So that I can add or delete what myrows I want to call on.

I am thinking this what I need  to do...

Function row ($row) { //These are the rows to call on...
    $title = $myrow[title];
    $format = myrow[format];
    $category =$myrow[category];
}

This way I can add more myrow to call upon at a later date or delete for
that matter.

I hope that helps...

Chuck

On 9/29/02 1:48 AM, "Justin French" <[EMAIL PROTECTED]> wrote:

> Not sure I fully understand, but usually this stuff calls for either a
> function, or an included file of code... in your case, sounds like a
> function is required, but I may not fully understand...
> 
> Regards,
> 
> Justin
> 
> 
> on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:
> 
>> Ok, I am trying to make my design a lot easier. I want to know if I can do
>> this...
>> 
>> I want to set up in my php page this...
>> 
>> 
>> $rows;
>> 
>> Under my db_info.inc I want to store this so that I can add delete from it.
>> 
>> $row = "$title = myrow[title]; $format = myrow[format]; $category =
>> myrow[category];"
>> 
>> Am I wrong to try this way? Do I need to set it up as fuction to call on?
>> 
>> Chuck Payne
>> 
> 

--- End Message ---
--- Begin Message ---
By the way I have time this but what is happen and maybe this will clear up
things. I only calling this first myrow call titles. It's not going on to
the other two. Now in my php page I have this...

$myrow = mysql_fetch_array($result);

$row;

Now this doesn't work. But this does.

$myrow = mysql_fetch_array($result);

$title = $myrow[title];
$format = $myrow[format];
$category =$myrow[category];


So want I wanted to do  but I am see you can was to make $row be called from
db_info.inc so that if lets say I wanted to add ratings I can add it to the
db_info.inc. The reasoning for this is about 50 pages and I am getting tried
of change each one I like to be able to change just one file. You know make
it easier. Better design. Sorry it 2:30am and Jolt cola is not working and I
am LD. So sorry if this is not clear.

Chuck Payne


On 9/29/02 2:06 AM, "Chuck PUP Payne" <[EMAIL PROTECTED]> wrote:

> What I was wanting to do was store the myrows under let say, db_info.inc
> file. So that I can add or delete what myrows I want to call on.
> 
> I am thinking this what I need  to do...
> 
> Function row ($row) { //These are the rows to call on...
>   $title = $myrow[title];
>   $format = $myrow[format];
>   $category =$myrow[category];
> }
> 
> This way I can add more myrow to call upon at a later date or delete for
> that matter.
> 
> I hope that helps...
> 
> Chuck
> 
> On 9/29/02 1:48 AM, "Justin French" <[EMAIL PROTECTED]> wrote:
> 
>> Not sure I fully understand, but usually this stuff calls for either a
>> function, or an included file of code... in your case, sounds like a
>> function is required, but I may not fully understand...
>> 
>> Regards,
>> 
>> Justin
>> 
>> 
>> on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:
>> 
>>> Ok, I am trying to make my design a lot easier. I want to know if I can do
>>> this...
>>> 
>>> I want to set up in my php page this...
>>> 
>>> 
>>> $rows;
>>> 
>>> Under my db_info.inc I want to store this so that I can add delete from it.
>>> 
>>> $row = "$title = myrow[title]; $format = myrow[format]; $category =
>>> myrow[category];"
>>> 
>>> Am I wrong to try this way? Do I need to set it up as fuction to call on?
>>> 
>>> Chuck Payne
>>> 
>> 
> 

--- End Message ---
--- Begin Message ---
Is this to pull the rows out of a database??

You could start with a simple example, which is just a basic config setting,
and use the $myrow array in your sql while loop to do a lot of the work.

<?
// set your column names
$colsToSelect = 'title, format, category';

// select
$sql = "SELECT {$colsToSelect} FROM tablename LIMIT 2";
$result = mysql_query($sql);
while($myrow = mysql_fetch_array($result))
    {
    foreach($myrow as $key => $value)
        {
        echo "{$key}: {$value}<br />\n";
        }
    echo "<br />\n";
    }
?>

For the above query, this would echo something like:

title: <contents of title><br />
format: <contents of format ><br />
category: <contents of category ><br />
<br />
title: <contents of title><br />
format: <contents of format ><br />
category: <contents of category ><br />
<br />


The next from there, to get more control over your rows might be an array
with the columns you wish to query...


Justin French




on 29/09/02 4:06 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:

> What I was wanting to do was store the myrows under let say, db_info.inc
> file. So that I can add or delete what myrows I want to call on.
> 
> I am thinking this what I need  to do...
> 
> Function row ($row) { //These are the rows to call on...
> $title = $myrow[title];
> $format = myrow[format];
> $category =$myrow[category];
> }
> 
> This way I can add more myrow to call upon at a later date or delete for
> that matter.
> 
> I hope that helps...
> 
> Chuck
> 
> On 9/29/02 1:48 AM, "Justin French" <[EMAIL PROTECTED]> wrote:
> 
>> Not sure I fully understand, but usually this stuff calls for either a
>> function, or an included file of code... in your case, sounds like a
>> function is required, but I may not fully understand...
>> 
>> Regards,
>> 
>> Justin
>> 
>> 
>> on 29/09/02 3:29 PM, Chuck PUP Payne ([EMAIL PROTECTED]) wrote:
>> 
>>> Ok, I am trying to make my design a lot easier. I want to know if I can do
>>> this...
>>> 
>>> I want to set up in my php page this...
>>> 
>>> 
>>> $rows;
>>> 
>>> Under my db_info.inc I want to store this so that I can add delete from it.
>>> 
>>> $row = "$title = myrow[title]; $format = myrow[format]; $category =
>>> myrow[category];"
>>> 
>>> Am I wrong to try this way? Do I need to set it up as fuction to call on?
>>> 
>>> Chuck Payne
>>> 
>> 
> 

--- End Message ---
--- Begin Message ---
Chuck PUP Payne wrote:

>By the way I have time this but what is happen and maybe this will clear up
>things.
>

That certainly made things clear. :-)

>I only calling this first myrow call titles. It's not going on to
>the other two. Now in my php page I have this...
>
>$myrow = mysql_fetch_array($result);
>
>$row;
>
>Now this doesn't work.
>

No kidding. What is the line "$row;" supposed to do exactly?

>But this does.
>
>$myrow = mysql_fetch_array($result);
>
>$title = $myrow[title];
>$format = $myrow[format];
>$category =$myrow[category];
>

Yes, this looks better. You should place your array keys in quotes, such 
as $myrow["title"].

I don't see how this relates at all to your example above.

>So want I wanted to do  but I am see you can was to make $row be called from
>db_info.inc so that if lets say I wanted to add ratings I can add it to the
>db_info.inc.
>

It's best to either include your code and reference file names or leave 
them out entirely. You sound like you assume we are looking at your 
screen and know what db_info.inc is.

>The reasoning for this is about 50 pages and I am getting tried
>of change each one I like to be able to change just one file. You know make
>it easier. Better design.
>

I think you have the right idea. I really have no idea what the question 
is, but you should maybe consider the include() function to help you 
out. For example, you could have a script fetch_row.inc like this:

$myrow = mysql_fetch_array($result);
$title = $myrow["title"];
$format = $myrow["format"];
$category =$myrow["category"];

Then every time you wanted to fetch a row from a result set consisting 
of these columns, you could just do this:

include("/path/to/fetch_row.inc");

Maybe that helps? I'm not really understanding what code you are 
repeating 50 times.

Happy hacking.

Chris

--- End Message ---
--- Begin Message ---
OK...if your error says you have output, then you have output. It's not
lying to you. Your error was this:

> > > Warning: Cannot add header information - headers already sent by
> > (output
> > > started at /users/ppowell/web/my/process.php:5) in
> > > /users/ppowell/web/my/process.php on line 76

Ok, that tells you that the "output started at ... /process.php:5", that
means line 5, which is phpinfo(), which causes output to the browser...

Lose that line...

---John Holmes...

> -----Original Message-----
> From: Phil Powell [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, September 28, 2002 9:16 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Help! Can't set cookie or redirect!!!
> 
> Ok thanx.. yeah I knew that you can set a cookie before anything is
set to
> the browser, however, if you view my code, nothing is sent as output
> before
> the cookie is set.
> 
> <?
>   // Don't forget you have to use php4.cgi to call this script and
this
> script's URL will be:
>   // /cgi-bin/cgiwrap/ppowell/php4.cgi/~ppowell/my/process.php
> 
>   phpinfo();
>   $willChangeLayout = 1; $isEmptyLayoutValues = 1;
> 
>   $path = $DOCUMENT_ROOT . "/my/";
> 
>   // SERVER-SIDE VALIDATION
>   foreach ($HTTP_POST_VARS as $key => $val) {
>    if (strcmp($key, "isDefaultLayout") == 0) $willChangeLayout = 0;
>    if (!empty($HTTP_POST_VARS[$key])) $isEmptyLayoutValues = 0;
>    if (!empty($HTTP_POST_FILES['myImage']['name']))
$isEmptyLayoutValues =
> 0;
>   }
> 
>   if ($willChangeLayout && $isEmptyLayoutValues) {
>    header("Location: " . $refURL . "?errorMsg=" . urlencode("Please
fill
> out
> all required fields"));
>    //--END OF SERVER-SIDE VALIDTION
>   } else {
> 
>   // FILE UPLOAD HANDLING
> 
>    if (!is_dir("$path/images/")) mkdir("$path/images/", 0755);
> 
>    if (is_uploaded_file($HTTP_POST_FILES['myImage']['tmp_name']) &&
>        !file_exists("$DOCUMENT_ROOT/my/images/" .
> $HTTP_POST_FILES['myImage']['name']) &&
>        $willChangeLayout)
>     move_uploaded_file($HTTP_POST_FILES['myImage']['tmp_name'], $path.
> "/images/" . urlencode($HTTP_POST_FILES['myImage']['name']));
>    //--END OF FILE UPLOAD HANDLING
> 
> 
>    // IF LAYOUT COLORS HAVE BEEN SUBMITTED COMBINE THEM INTO WORKABLE
> STRING
> TO PLACE INTO FILE
>    if ($willChangeLayout) {
> 
>     $stuff = "";
> 
>     // OPEN UP FILE "layout.txt" TO GET MOST CURRENT ID, ELSE DEFAULT
TO 1
>     if (file_exists("$path/layout.txt")) {
>      $layoutID = fopen("$path/layout.txt", "r") or die("Could not open
> file:
> $path/layout.txt");
>      $stuff .= fread($layoutID, filesize("$path/layout.txt"));
>      fclose($layoutID) or die("Could not close file:
$path/layout.txt");
>      // OBTAIN MAX ID BY DOING PREG_MATCH_ALL TO GET ALL PATTERNS OF
> "id=number"
>      preg_match_all("/id=[0-9]+/", $stuff, $idArray,
PREG_PATTERN_ORDER);
>      list($key, $id) = split("=", end($idArray[0]));
>      $id++;
>     } else {
>      $id = 1;
>     }
> 
>     $layoutString = "id=" . $id . "&";
> 
>     $varExceptionArray = array("isDefaultLayout", "submit", "refURL",
> "previewButton", "cancel",
>                               "MAX_FILE_SIZE");
>     foreach ($HTTP_POST_VARS as $key => $val) {
>      if (!in_array($key, $varExceptionArray)) {
>       $val = preg_replace("/&/", "#", $val); // IN THEORY YOUR
EXTERNAL
> IMAGE HAS NO "&"
>       $val = preg_replace("/=/", "#", $val); // IN THEORY YOUR
EXTERNAL
> IMAGE HAS NO "="
>       if (strcmp($key, "myExternalImage") == 0) {
>        $layoutString .= "background=" . urlencode($val) . "&";
>       } else {
>        $layoutString .= $key . "=" . urlencode($val) . "&";
>       }
>      }
>     }
> 
>     if (!empty($HTTP_POST_FILES['myImage']['name'])) {
>      $layoutString .= "background=" .
> urlencode($HTTP_POST_FILES['myImage']['name']);
>     } else {
>      $layoutString = substr($layoutString, 0, -1);
>     }
>     $layoutID = fopen("$path/layout.txt", "w") or die("Could not write
to
> file: $path/layout.txt");
>     fwrite($layoutID, $stuff . $layoutString . "\n");
>     fflush($layoutID); fclose($layoutID);
>     // SET THE COOKIE FOR LAYOUT
>     setcookie("valLayout", $id, time()+3600*24*30*12*100,
$SERVER_NAME);
> //
> WILL EXPIRE IN 100 YEARS.. UM YEAH
>    } else {  // $willChangeLayout IS FALSE YOU ARE USING
"isDefaultLayout"
> -
> DESTROY COOKIE
>     $id = $HTTP_COOKIE_VARS["valLayout"];
>     if (empty($id)) $id = 0;
>     // DELETE ENTRY FROM layout.txt
>     $layoutID = fopen("$path/layout.txt", r) or die("Could not open
file:
> $path/layout.txt");
>     $stuff = fread($layoutID, filesize("$path/layout.txt"));
>     fclose($layoutID) or die("Could not close file:
$path/layout.txt");
>     preg_match_all("/id=[\n]+\n/", $stuff, $idArray,
PREG_PATTERN_ORDER);
>     preg_replace("end($idArray[0])", "", $stuff);
>     $layoutID = fopen("$path/layout.txt", w) or die("Could not open
file:
> $path/layout.txt");
>     fwrite($layoutID, $stuff); fflush($layoutID); fclose($layoutID);
>     // DELETE COOKIE
>     setcookie("valLayout", "", time()-3600, $SERVER_NAME);
>    }
>    //--END OF LAYOUT COLOR TO WORKABLE STRING HANDLING
> 
>    // REDIRECT
>    header("Location: " . $HTTP_POST_VARS["refURL"]);
> 
>   } //--END OF LAYOUT CHANGING
> ?>
> 
> Perhaps I'm just not finding it. :(
> 
> Phil
> "John W. Holmes" <[EMAIL PROTECTED]> wrote in message
> 000e01c26754$cf27c8c0$7c02a8c0@coconut">news:000e01c26754$cf27c8c0$7c02a8c0@coconut...
> > You can only set a cookie before any output is send to the browser.
A
> > newline, space, or <html>, etc, is output to the browser. Redesign
your
> > code so the cookie is set before any output or use output buffering.
> >
> > ---John Holmes...
> >
> > > -----Original Message-----
> > > From: Phil Powell [mailto:[EMAIL PROTECTED]]
> > > Sent: Saturday, September 28, 2002 9:03 PM
> > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > Subject: [PHP] Help! Can't set cookie or redirect!!!
> > >
> > > I am getting the following errors attempting to set a cookie and
> > redirect:
> > >
> > > Warning: Cannot add header information - headers already sent by
> > (output
> > > started at /users/ppowell/web/my/process.php:5) in
> > > /users/ppowell/web/my/process.php on line 76
> > >
> > > Warning: Cannot add header information - headers already sent by
> > (output
> > > started at /users/ppowell/web/my/process.php:5) in
> > > /users/ppowell/web/my/process.php on line 77
> > >
> > >
> > > Lines:
> > >
> > >    setcookie("valLayout", $id, time()+3600*24*30*12*100,
> > $SERVER_NAME); //
> > > WILL EXPIRE IN 100 YEARS.. UM YEAH
> > >     header("Location: " . $HTTP_POST_VARS["refURL"]);
> > >
> > > The first time I ran this script it set the cookie just fine;
> > subsequent
> > > runnings of this script produce this error.  What am I doing
wrong,
> > > anyone?
> > >
> > > Thanx
> > > Phil
> >
> >
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
> Hey John,
> Thanks for the reply,
> Am a bit confused, 2 guys already gave me the advise you are giving me
but
> you also say
> "CHANGE COLUMN old_column_name new_column_name"
> why to change the column name? dont I only have to change it from
being an
> "int" to an "Auto_Increment"?

Yes. That's just the syntax. If you don't want to change the column
name, then give the same column name for the new one...i.e., name it the
_same thing_.....

---John Holmes... 


--- End Message ---
--- Begin Message ---
Do you know how to read?

If so, please try your skills on the last line of any email you are
getting from this listserve. 

In case you need help, you should try a regular expression and look for
the line that begins with "To unsubscribe, visit:"

For help with regular expressions, please see
http://www.php.net/manual/en/ref.pcre.php

For help reading, please see: http://www.Icannotreadtosavemylife.com
If that URL does not open, please see the last line of any email you
receive from this listserve...

---John "sarcastic" Holmes...

> -----Original Message-----
> From: @ Saif @ [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 27, 2000 10:18 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Dear all
> 
> 
> Please how can I unsubscribe from this mailing list ...
> Thanks
> 
> 
> Regards
> Saif Yousif
> 
> 
>                                                                  No
God
> except Allah    Mohammed is profit of Allah



--- End Message ---
--- Begin Message ---
Hey All,

I'm trying to build a DBF for exporting selected data as a download to the 
end users... But I can't get further than this...

        error_reporting(E_ALL);
        $DBFName = "Test.dbf";
        $Fields = array( array ("Test","C",32) );
        if(dbase_create($DBFName, $Fields))
                { echo "Good!"; } else { echo "Bad!"; }

It doesn't show an error... and it doesn't create the dbf... it just shows 
"Bad!" and nothing else.

Any ideas where I should begin looking? I admit I'm not the most savvy 
Linux user but I at least got it to admit that the function existed (under 
a freshly compiled php with --enable-dbase on Redhat Linux 7.2)

I've also tried $DBFName="./Test.dbf" and 
"/full_path_from_root_to_html_folder/Test.dbf" and neither work. I've also 
looked through the archives for this list and for the php-db list and 
haven't seen anything that helps (other than my earlier problem of not 
having enabled dbase, which appears to be fixed, before it wouldn't even 
show "Bad!". )

Thanks in advance for any ideas...

Matt

--- End Message ---
--- Begin Message ---
Does the web server have permission to write to the directory where you
are trying to create the database? PHP runs as the web server when
installed as a module and it needs permission to write in that
directory. 

---John Holmes...

> -----Original Message-----
> From: Matt Neimeyer [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 29, 2002 2:19 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Problems with dbase_create function
> 
> Hey All,
> 
> I'm trying to build a DBF for exporting selected data as a download to
the
> end users... But I can't get further than this...
> 
>       error_reporting(E_ALL);
>       $DBFName = "Test.dbf";
>       $Fields = array( array ("Test","C",32) );
>       if(dbase_create($DBFName, $Fields))
>               { echo "Good!"; } else { echo "Bad!"; }
> 
> It doesn't show an error... and it doesn't create the dbf... it just
shows
> "Bad!" and nothing else.
> 
> Any ideas where I should begin looking? I admit I'm not the most savvy
> Linux user but I at least got it to admit that the function existed
(under
> a freshly compiled php with --enable-dbase on Redhat Linux 7.2)
> 
> I've also tried $DBFName="./Test.dbf" and
> "/full_path_from_root_to_html_folder/Test.dbf" and neither work. I've
also
> looked through the archives for this list and for the php-db list and
> haven't seen anything that helps (other than my earlier problem of not
> having enabled dbase, which appears to be fixed, before it wouldn't
even
> show "Bad!". )
> 
> Thanks in advance for any ideas...
> 
> Matt
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
This is a bit hard for me to explain but is there any way to have PHP 
store a persistent server-side constant. Something that will stay in RAM 
and is not dependent on client connection.

For example I have this code in consts.inc file:

define ("HOME_PAGE", "http://myip.com/index.html);

But if I want access to the constant I need to include the file in every 
script that needs it.

I am hoping there is some way to say to the PHP engine, "this is a 
static constant that will never change, keep it RAM, and share it 
between invocations/children".

Is this feasible? Is it is I could then "cache" whole blocks of static 
HTML and that would speed up my scripts quite a bit ... AND my my life 
as a programmer easier since I wouldn't have to always have an 
"include("conts.inc")" statement at the top of each of my scripts ...

Jc

--- End Message ---
--- Begin Message ---
There is a directive in php.ini which allows a file to be included on EVERY
page that php parses... one at the very start, and one at the very end of
the script.

So in theory, you could include consts.inc as a always-include file at the
top of every script, by setting the right directive in php.ini

I'm pretty sure this is server-wide, but maybe it could be site- or
directory-wide by setting the variable in a .htaccess file.


Cheers,

Justin




on 29/09/02 8:59 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

> This is a bit hard for me to explain but is there any way to have PHP
> store a persistent server-side constant. Something that will stay in RAM
> and is not dependent on client connection.
> 
> For example I have this code in consts.inc file:
> 
> define ("HOME_PAGE", "http://myip.com/index.html);
> 
> But if I want access to the constant I need to include the file in every
> script that needs it.
> 
> I am hoping there is some way to say to the PHP engine, "this is a
> static constant that will never change, keep it RAM, and share it
> between invocations/children".
> 
> Is this feasible? Is it is I could then "cache" whole blocks of static
> HTML and that would speed up my scripts quite a bit ... AND my my life
> as a programmer easier since I wouldn't have to always have an
> "include("conts.inc")" statement at the top of each of my scripts ...
> 
> Jc
> 

--- End Message ---
--- Begin Message ---
Justin French wrote:
>
> There is a directive in php.ini which allows a file to be included on EVERY
> page that php parses... one at the very start, and one at the very end of
> the script
> 
> I'm pretty sure this is server-wide, but maybe it could be site- or
> directory-wide by setting the variable in a .htaccess file.

I'll check again but I think that it isn't. It's as you say, it's 
include on  *every* page. It doesn't reside in memory it just cause PHP 
to pre-pend and append a file to every script ...

But maybe PHP is smart enough to keep that file in memory between script 
invocation and not have to read it off the disk every time a script is 
called?

Jc

--- End Message ---
--- Begin Message ---
on 29/09/02 9:36 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

> Justin French wrote:
>> 
>> There is a directive in php.ini which allows a file to be included on EVERY
>> page that php parses... one at the very start, and one at the very end of
>> the script
>> 
>> I'm pretty sure this is server-wide, but maybe it could be site- or
>> directory-wide by setting the variable in a .htaccess file.
> 
> I'll check again but I think that it isn't. It's as you say, it's
> include on  *every* page. It doesn't reside in memory it just cause PHP
> to pre-pend and append a file to every script ...
> 
> But maybe PHP is smart enough to keep that file in memory between script
> invocation and not have to read it off the disk every time a script is
> called?

You're right... it's an include... THEN the vars will be in memory...

This is the best you can do, AFAIK, without hacking the source of PHP :)


Justin

--- End Message ---
--- Begin Message ---
Justin French wrote:
> 
> You're right... it's an include... THEN the vars will be in memory...
> 
> This is the best you can do, AFAIK, without hacking the source of PHP :)

Just asking, do you know the source well enough to say with *certainty* 
that the auto prepend file is not kept in memory? If  not I'll try and 
ask the developers, though they might not lie this sort of "simple" 
question ;)

Since PHP has to keep prepending a certain file *all* the time it is 
called it would seem like a smart thing to have it keep the file in 
memory ...

Thanks,

Jc

--- End Message ---
--- Begin Message ---
on 29/09/02 10:09 PM, Jean-Christian Imbeault ([EMAIL PROTECTED])
wrote:

> Just asking, do you know the source well enough to say with *certainty*
> that the auto prepend file is not kept in memory?

I'm merely guessing.

Justin

--- End Message ---
--- Begin Message ---
Justin French wrote:
> 
> I'm merely guessing.

Ok. Thanks for the guess. I'll post on the dev list and see if I can get 
a definitive answer.

Jc

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

OK I have my first php/mysql web site complete & working on my computer
using apache server. When I transfer the files to web space, I receive
errors regarding connection to database. Obviously the various pieces of
code I have used to connect it all up eg
<?
$dbcnx = mysql_connect("localhost","","");
mysql_select_db("databaseName",$dbcnx);
?>

etc etc

needs to be changed to what to see the site working live ?

Any ideas or tips greatly appreciated!!!!!!!

Thanks

DC





--- End Message ---
--- Begin Message ---
You need to set the parameters to whatever your ISP granted you for use of
MySQL... 

$dbcnx = mysql_connect("servername","username","password");

You should ask your ISP what these are.


Justin French



on 29/09/02 9:54 PM, DC ([EMAIL PROTECTED]) wrote:

> Hi,
> 
> OK I have my first php/mysql web site complete & working on my computer
> using apache server. When I transfer the files to web space, I receive
> errors regarding connection to database. Obviously the various pieces of
> code I have used to connect it all up eg
> <?
> $dbcnx = mysql_connect("localhost","","");
> mysql_select_db("databaseName",$dbcnx);
> ?>
> 
> etc etc
> 
> needs to be changed to what to see the site working live ?
> 
> Any ideas or tips greatly appreciated!!!!!!!
> 
> Thanks
> 
> DC
> 
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
Does using the auto_prepend config option in the php.ini file act 
exactly like and include() call.

An include call will read the file off disk ... will auto.prepend do the 
same thing or will PHP keep the file in memory for quick retrival?

Jc

--- End Message ---
--- Begin Message ---
The variable is being passed properly; it just doesn't have a value.
Where are you setting $listbox??

---John Holmes...

> -----Original Message-----
> From: Chip Wiegand [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, August 06, 2002 9:28 AM
> To: 1LT John W. Holmes
> Cc: php
> Subject: Re: [PHP] passing select list variable from page1 to
> insertstatement astable name on page2
> 
> On Mon, 2002-08-05 at 23:21, 1LT John W. Holmes wrote:
> > Change this:
> >
> > mysql_query($sql) or die (mysql_error());
> >
> > to this:
> >
> > mysql_query($sql) or die ("Error in this query >>$sql<< : " .
> > mysql_error());
> >
> > And the error will probably be obvious to you. $listbox is not
getting a
> > value. Why doesn't listbox appear in your second URL?
> >
> > ---John Holmes...
> 
> Thanks for the better error statement. It does shed some more light on
> the subject - the table-name variable is not being passed on submit of
> the second page -
> 
>  Error in this query >>insert into (today,exercise,reps,comments)
values
> ('08-06','120','20','test')<< : You have an error in your SQL syntax
> near '(today,exercise,reps,comments) values
('08-06','120','20','test')'
> at line 1
> 
> No matter if I quote the variable or not, always the same error. The
sql
> code is just below a couple paragraphs, I am at a loss as to how to
get
> that variable to be passed properly.
> 
> --
> Chip W
> www.wiegand.org
> [EMAIL PROTECTED]
> 
> > ----- Original Message -----
> > From: "Chip Wiegand" <[EMAIL PROTECTED]>
> > To: "php" <[EMAIL PROTECTED]>
> > Sent: Tuesday, August 06, 2002 1:06 AM
> > Subject: [PHP] passing select list variable from page1 to insert
> statement
> > astable name on page2
> >
> >
> > >
> > > I have a page with a select list that will contain as many as 20
> > > options, allowing only one choice, not multiple. I have a second
page
> > > that is loaded on submit that wants that select list variable for
the
> > > table name in an insert statement. On the second page is a form
for
> > > entering data into the table, chosen from the select list on the
first
> > > page.
> > >
> > > I can echo the variable on the second page, so I know it is being
sent
> > > from page1 to page2 appropriately. I see in the url that it is
being
> > > send appropriately, and upon filling in the form, again the url
shows
> > > the data that is to be sent to the database. All appears to be
okay,
> > > except I get a syntax error message.
> > >
> > > Below is copied messages I have been exchanging with another user
on
> > > this subject, it contains a complete history, and the code for the
two
> > > pages, at the bottom.
> > >
> > > I hope someone can help solve this perplexing problem.
> > >
> > > --
> > > Chip W
> > > www.wiegand.org
> > > [EMAIL PROTECTED]
> > >
> > > Begin previous posts --
> > >
>
========================================================================
=
> > >
> > > Well, I think we're getting closer, in that the correct data is
being
> > > sent, as seen here -
> > >
> > > http://192.168.1.53/test2.php?listbox=leglifts&exerciselist=
> > >
> > > Then when I enter some data and press submit the correct data is
sent
> -
> > >
> > >
> >
>
http://192.168.1.53/test2.php?exercise=80&reps=12&comments=test&submit=S
en
> d+
> > Data
> > >
> > > But at the same time I get this error -
> > >
> > >  You have an error in your SQL syntax near
> > > '(date,exercise,reps,comments) values ('08-05','80','12','test')'
at
> > > line 1
> > >
> > > My entire sql statement looks like this -
> > >
> > >   <?
> > >   if(isset($submit)):
> > >   $db = mysql_connect("localhost","----","----");
> > >   if(!$db) error_message(sql_error());
> > >   mysql_select_db("workout",$db) or die (mysql_error());
> > >   $date = date("m-d");
> > >   $sql = "insert into $listbox (date,exercise,reps,comments)
> > > values ('$date','$exercise','$reps','$comments')";
> > >   mysql_query($sql) or die (mysql_error());
> > >   endif;
> > >   echo $listbox;
> > >   ?>
> > >
> > > As for the variable $listbox in the insert statement, I have tried
to
> > > quote it - ".$listbox." - and also like this - "$listbox" - both
of
> > > which result in the same error as above, and then this version -
> > > '$listbox' - causing a T-Variable error which crashes the page.
> > > I don't see any syntax error in there. I will be posting this on
the
> > > lists also.
> > >
> > > --
> > > Chip W
> > > www.wiegand.org
> > > [EMAIL PROTECTED]
> > >
> > > On Mon, 2002-08-05 at 20:18, Rich Hutchins wrote:
> > > > Chip,
> > > >
> > > > I'm going to take one more shot here, because, frankly, I'm
stumped
> > > too.
> > > >
> > > > If you look at your URL, you see:
> > > >
> > >
> > http://192.168.1.53/workout-
> absflexor.php?exerciselist=%24listbox&exercise=1
> > > > 20
> > > > &reps=12&date=1-1&comments=test&submit=Send+Data
> > > >
> > > > The part that reads ?exerciselist=%24listbox is what worries me.
> > > > exerciselist should have the value from the listbox in it and
> > > exerciselist
> > > > is what you should be referencing in your sql. So this part of
the
> URL
> > > > should look something like:
> > > >
> > > > ...?exerciselist=crunches&...
> > > >
> > > > Then you'd use a reference to $exerciselist in your SQL, not
> $listbox.
> > > >
> > > > Forget what the book says for a moment. They're prone to errors
just
> > > like
> > > > you and me.
> > > >
> > > > Variables are passed in name/value pairs. Everything to the left
of
> > > the = is
> > > > a name and everything to the right is a value. Pretty simple.
Your
> URL
> > > does
> > > > not have a valid name/value pair for the variable $exerciselist.
> > > > $exerciselist is valid, but %24listbox is not. Fix that and
you're
> > > home
> > > > free.
> > > >
> > > > My hunch (can't you just hear Velma saying this to Fred?) is
that
> > > there's
> > > > something wrong with the way you are attempting to assign the
value
> of
> > > > listbox to exerciselist on your first page. I have never worked
with
> > > passing
> > > > <select> values, so you're one up on me there. But if you look
> > > closely,
> > > > there has to be something funky going on there.
> > > >
> > > > If you can't figure it out, maybe post to this list or the php-
> general
> > > list
> > > > a question about how to pass the values of <select>s from page
to
> > > page. You
> > > > might also want to check this out too:
> > > >
> > > > http://www.php.net/manual/en/faq.html.php
> > > >
> > > > If you figure it out, please post the answer because I want to
learn
> > > too.
> > > >
> > > > Wait...A rock just hit me...
> > > >
> > > > Look at this:
> > > >
> > > > > > echo "<input type='hidden' name='exerciselist'
> value='$listbox'>";
> > > >
> > > > Know what you're saying here? The value of exerciselist is the
> > > _STRING_
> > > > $listbox. Not the VALUE of the $listbox, the _LITERAL STRING_.
Try
> > > saying it
> > > > this way:
> > > >
> > > > echo "<input type='hidden' name='exerciselist'
> value='".$listbox."'>";
> > > >
> > > > I don't know if this grabs the value of $listbox at submit time,
but
> > > it
> > > > should escape you from the HTML being echoed and substitute the
> value
> > > of the
> > > > variable $listbox.
> > > >
> > > > Now I'm really finished ;^)
> > > >
> > > > Good luck,
> > > > Rich
> > > >
> > > > -----Original Message-----
> > > > From: Chip Wiegand [mailto:[EMAIL PROTECTED]]
> > > > Sent: Monday, August 05, 2002 12:53 AM
> > > > To: Rich Hutchins
> > > > Subject: RE: [PHP-DB] problem getting form input field to become
> > > > partofquery statement
> > > >
> > > >
> > > > On Sun, 2002-08-04 at 09:41, Rich Hutchins wrote:
> > > > > Chip,
> > > > >
> > > > > Could you post the result of your echo statement please?
> > > >
> > > > Here's the error returned:
> > > >
> > > >  You have an error in your SQL syntax near '(date, comments,
reps,
> > > > exercise) values('1-1','test','12','120')' at line 1
> > > >
> > > > And this is the url that matches the above error:
> > > >
> > > >
> > >
> > http://192.168.1.53/workout-
> absflexor.php?exerciselist=%24listbox&exercise=1
> > > > 20
> > > > &reps=12&date=1-1&comments=test&submit=Send+Data
> > > >
> > > > The error has to be the table name, it's wrong. The variable
> $listbox
> > > > isn't being used.
> > > > I can echo $listbox (as seen below, last line) and it returns
the
> one
> > > > value I want, and selected in the list box on the first page.
> > > > Why the same variable doesn't work in the insert statement is
what's
> > > > bugging me.
> > > >
> > > >   <?
> > > >   if(isset($submit)):
> > > >   $db = mysql_connect("localhost","----","-----");
> > > >   if(!$db) error_message(sql_error());
> > > >   mysql_select_db("workout",$db) or die (mysql_error());
> > > >   //$date = date("m-d");
> > > >   $sql = "insert into $listbox (date, comments, reps, exercise)
> > > > values('$date','$comments','$reps','$exercise')";
> > > >   mysql_query($sql) or die(mysql_error());
> > > >   endif;
> > > >   echo $listbox;
> > > >   ?>
> > > >
> > > > > Judging from your code, it looks like your $exercises array
> contains
> > > three
> > > > > table names in your db. When your user selects a value from
the
> > > listbox,
> > > > you
> > > > > assign that variable to the hidden field exerciselist.
> > > >
> > > > Eventually, the select list will contain aprox. 20 selections,
the
> > > user
> > > > would pick one only, which is passed to the next page and
becomes
> the
> > > > table name in the insert statement. If there's a better way to
do
> this
> > > > than what I'm trying, I'm open to suggestions.
> > > >
> > > > > Then when the user hits submit, the value in exercise list
gets
> sent
> > > to
> > > > the
> > > > > receiving page where the user should be able to enter
additional
> > > info
> > > > > regarding that particular exercise.
> > > > >
> > > > > I'm curious then, why are you attempting to use the variable
> > > $listbox as a
> > > > > source for the table name in your SQL statement (I'm assuming
> that's
> > > what
> > > > > $listbox is supposed to be doing for you) instead of the
single
> > > value that
> > > > > gets passed via the exerciselist hidden field?
> > > >
> > > > I'm just following the examples is the book Beginning PHP4, by
> > > > Choi/Kent/Lea. The show a select list with a name 'listbox' on
the
> > > first
> > > > page, and the same name echoed on the second page. Simple
enough.
> > > >
> > > > > Seems to me that $listbox would have the three values from the
> array
> > > > stored
> > > > > in it but that $exerciselist would have only the one chosen
from
> the
> > > > > listbox. I could see why your query would bomb since MySQL
> wouldn't
> > > know
> > > > > which of the three tables you're trying to insert into.
> > > >
> > > > When I replace the variable $listbox with $exerciselist I get
the
> > > > following error:
> > > >
> > > >  Table 'workout.$exerciselist' doesn't exist
> > > >
> > > > > Hope I'm not torturing you here. I certainly don't mean to.
Just
> > > trying to
> > > > > help.
> > > >
> > > > No torturing, I need the help, thanks.
> > > >
> > > > > Rich
> > > >
> > > > --
> > > > Chip W
> > > > www.wiegand.org
> > > > [EMAIL PROTECTED]
> > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: Chip Wiegand [mailto:[EMAIL PROTECTED]]
> > > > > Sent: Sunday, August 04, 2002 1:33 AM
> > > > > To: Rich Hutchins
> > > > > Cc: phpdb
> > > > > Subject: RE: [PHP-DB] problem getting form input field to
become
> > > part
> > > > > ofquery statement
> > > > >
> > > > >
> > > > > On Sat, 2002-08-03 at 06:05, Rich Hutchins wrote:
> > > > > > Try referencing the $listbox variable in you SQL statement
like
> > > this:
> > > > > >
> > > > > > $sql = "insert into ".$listbox."
> > > > > > values(NULL,'$date','$exercise','$reps','$comments')";
> > > > > >
> > > > > > I'm guessing that it might also work like this:
> > > > > >
> > > > > > $sql = "insert into '$listbox'
> > > > > > values(NULL,'$date','$exercise','$reps','$comments')";
> > > > > >
> > > > > > I think your core problem is that the $listbox variable is
not
> > > being
> > > > > > evaluated properly in the SQL statement. Once you solve
that,
> > > you're
> > > > good
> > > > > to
> > > > > > go.
> > > > > >
> > > > > > Hope this helps.
> > > > > >
> > > > > > Rich
> > > > >
> > > > > I tried both suggestions and neither are working. I am using
the
> get
> > > > > format for the form so I can see what is being sent, and I am
> > > getting
> > > > > this:
> > > > >
> > > >
> > >
> > http://192.168.1.53/workout-
> absflexor.php?exerciselist=%24listbox&exercise=8
> > > > > 0
> > > > > &reps=12&comments=&submit=Send+Data
> > > > >
> > > > > Notice that the $listbox variable is still not being sent.
Just
> > > above
> > > > > this is an echo statement which shows what's in that variable,
and
> > > it
> > > > > displays the expected result (see code below). I am at a loss
as
> to
> > > why
> > > > > this is not working.
> > > > >
> > > > > If I replace the $listbox variable with the table name shown
in
> the
> > > echo
> > > > > statement, a connection is made and the query is completed.
> > > > >
> > > > > --
> > > > > Chip W
> > > > > www.wiegand.org
> > > > > [EMAIL PROTECTED]
> > > > >
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Chip Wiegand [mailto:[EMAIL PROTECTED]]
> > > > > > Sent: Saturday, August 03, 2002 12:51 AM
> > > > > > To: phpdb
> > > > > > Subject: [PHP-DB] problem getting form input field to become
> part
> > > of
> > > > > > query statement
> > > > > >
> > > > > >
> > > > > > I have a form with a select list and a hidden field to save
the
> > > selected
> > > > > > item. On submit another page is loaded with a few fields to
be
> > > filled in
> > > > > > and submitted to a table. Using get I see the data is being
> passed
> > > from
> > > > > > the first page to the second properly, and the second page
sends
> > > its
> > > > > > data properly. The hidden field from the first page is to be
> used
> > > by the
> > > > > > second page as the name of the table in the query. I have a
> place
> > > where
> > > > > > I echo the contents of the hidden field just to be sure it
is
> > > correct,
> > > > > > and that does indeed show what I expect. I then make the
query
> > > statement
> > > > > > point to the variable but it always responds that it cannot
find
> > > the
> > > > > > table. The table does exist, the variable does contain the
> > > appropriate
> > > > > > table name, but is not being replaced by the name. What am I
> doing
> > > > > > wrong?
> > > > > >
> > > > > > --
> > > > > > Chip W
> > > > > > www.wiegand.org
> > > > > > [EMAIL PROTECTED]
> > > > > >
> > > > > > Below is the code for the first page --
> > > > > >
> > > > > > <html>
> > > > > > <head>
> > > > > > <title></title>
> > > > > > </head>
> > > > > > <body>
> > > > > > <div align="center">
> > > > > > <?
> > > > > > $exercises=array("absflexor","absmachine","leglifts");
> > > > > >
> > > > > > echo "<form action='workout-absflexor.php' method='get'>";
> > > > > > echo "<table width='70%' border='0' align='center'>";
> > > > > > echo "<tr><th align='center'><h2>Exercise Data
> > > Input</h2></th></tr>";
> > > > > > echo "<tr><th align='center'><select name='listbox'>";
> > > > > > echo "<option>$exercises[0]</option>";
> > > > > > echo "<option>$exercises[1]</option>";
> > > > > > echo "<option>$exercises[2]</option>";
> > > > > > echo "</select><br><br>";
> > > > > > echo "</th></tr></table>";
> > > > > > echo "<input type='hidden' name='exerciselist'
> value='$listbox'>";
> > > > > > echo "<input type='submit'>";
> > > > > > echo "</form>";
> > > > > > ?>
> > > > > > </div>
> > > > > > </body>
> > > > > > </html>
> > > > > >
> > > > > > And below is the code for the second page --
> > > > > >
> > > > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
> > > > > >
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> > > > > > <html xmlns="http://www.w3.org/1999/xhtml";>
> > > > > >   <head>
> > > > > >     <title>Workout Data Entry Form</title>
> > > > > > <style type="text/css">
> > > > > >  body { background-color: aqua; }
> > > > > >  div.c1 {text-align: center}
> > > > > > </style>
> > > > > >   </head>
> > > > > >   <body>
> > > > > >     <div class="c1">
> > > > > >       <h2>Work-Out Data Entry Screen</h2>
> > > > > >       <form action="<? PHP_SELF ?>" method="get">
> > > > > >         <table summary="" width="60%" border="1"
align="center"
> > > > > > bgcolor="green">
> > > > > >           <tr>
> > > > > >             <th>Weight</th>
> > > > > >             <td align="left"><input type="text"
name="exercise"
> > > > > > maxlength="4"></td>
> > > > > >           </tr>
> > > > > >           <tr>
> > > > > >             <th>Reps</th>
> > > > > >             <td align="left"><input type="text" name="reps"
> > > > > > maxlength="4"></td>
> > > > > >           </tr>
> > > > > >           <tr>
> > > > > >             <th>Comments</th>
> > > > > >             <td colspan="2"><textarea cols="50" rows="3"
> > > > > > name="comments">
> > > > > >             </textarea></td>
> > > > > >           </tr>
> > > > > >     <tr><td><? echo $listbox; ?></td></tr>
> > > > > >         </table>
> > > > > >         <br />
> > > > > >         <input type="submit" name="submit" value="Send Data"
/>
> > > <input
> > > > > > type="reset" />
> > > > > >       </form>
> > > > > >     </div>
> > > > > >   <?
> > > > > >   if(isset($submit)):
> > > > > >   $db = mysql_connect("localhost","----","------");
> > > > > >   if(!$db) error_message(sql_error());
> > > > > >   mysql_select_db("workout",$db) or die ("Ack! Where's the
> > > database?");
> > > > > >   $date = date("m-d");
> > > > > >   $sql = "insert into $listbox
> > > > > > values(NULL,'$date','$exercise','$reps','$comments')";
> > > > > >   mysql_query($sql) or die ("Ack! No response when I queried
the
> > > > > > server!");
> > > > > >   endif;
> > > > > >   ?>
> > > > > >   </body>
> > > > > > </html>
> > >
> > >
> > >
> > >
> > >
> > > --
> > > 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



--- End Message ---
--- Begin Message ---
I have a date ex 24/08/02
and I need to see if that date is the same date as it is today (only one 
month later) but 5day's in advanced => that would be 24/09/02
so if(date == date now - 5)
                {true}
                        else{false}

how can I do this right ?

--- End Message ---
--- Begin Message ---
Jonas Geiregat wrote:
>
> I have a date ex 24/08/02
> and I need to see if that date is the same date as it is today (only one 
> month later) but 5day's in advanced => that would be 24/09/02
> so if(date == date now - 5)
>         {true}
>             else{false}
> 
> how can I do this right ?

Look at the online docs and read up on date() and strtotime() which can 
accept things like (today - 5days) as arguments.

Jc

--- End Message ---
--- Begin Message ---
Not sure why you need the 5 days in advance bit, but this might give you the
tools to work it all out.

I prefer to work with dates in unix timestamp format (seconds).

To get "now", use time()

To get "next month", there's a kewl function called strtotime(), which
converts english phrases into timestamps... eg strtotime("+1 month") might
do the job, or "next month"... experiment, use the manual, etc etc

To get "now - 5 days" either use strtotime("-5 days") or

<?
$nowMinus5days = time() - 432000; // 432000 = 5x24x60x60
$nowMinus5days = date('d/m/y', $nowMinus5days);
?>


Hope this helps,

Justin


on 29/09/02 3:04 PM, Jonas Geiregat ([EMAIL PROTECTED]) wrote:

> I have a date ex 24/08/02
> and I need to see if that date is the same date as it is today (only one
> month later) but 5day's in advanced => that would be 24/09/02
> so if(date == date now - 5)
> {true}
> else{false}
> 
> how can I do this right ?
> 

--- End Message ---
--- Begin Message ---
and If I want to calculate from given date the next month
like strtotime("next month") gives me the date of one month in advanced 
from NOW
but I want to get the date one month in advanced from a given date not NOW

Jonas Geiregat wrote:
> I have a date ex 24/08/02
> and I need to see if that date is the same date as it is today (only one 
> month later) but 5day's in advanced => that would be 24/09/02
> so if(date == date now - 5)
>         {true}
>             else{false}
> 
> how can I do this right ?
> 

--- End Message ---
--- Begin Message ---
> From: "Jonas Geiregat" <[EMAIL PROTECTED]>
> Sent: Sunday, September 29, 2002 10:56 AM
> Subject: [PHP] Re: date question


> and If I want to calculate from given date the next month
> like strtotime("next month") gives me the date of one month in advanced
> from NOW
> but I want to get the date one month in advanced from a given date not NOW

If you have mysql lying around, it has a bunch of date functions that can do
what you want:
http://www.mysql.com/doc/en/Date_and_time_functions.html


--- End Message ---
--- Begin Message ---

Hello there
I am trying to copy a remote graphic from http://blah.com/blah.jpg to my
server. How would I achieve this in php I have looked on the archives
but can't seem to find the best way. I am running 4.1.2 on apache unix.

I understand copy will not work on remote files (tried it) but I am not
sure of the correct fopen fwrite etc code! Any sample code or pointers
are most helpful Best regards Scott

--- End Message ---
--- Begin Message ---
In PHP 4.3 you can actually just use copy().  In previous versions if you
just want to dump it out you can use readfile(), or if you want to store
it, use a simple fopen(), while(!feof()) fread() loop.

-Rasmus

On Sun, 29 Sep 2002, scott wrote:

>
> Hello there
> I am trying to copy a remote graphic from http://blah.com/blah.jpg to my
> server. How would I achieve this in php I have looked on the archives
> but can't seem to find the best way. I am running 4.1.2 on apache unix.
>
> I understand copy will not work on remote files (tried it) but I am not
> sure of the correct fopen fwrite etc code! Any sample code or pointers
> are most helpful Best regards Scott
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---

Reply via email to