php-windows Digest 20 Feb 2002 23:54:37 -0000 Issue 1010

Topics (messages 12159 through 12166):

Re: updating db
        12159 by: Collins, Robert

Re: WinXP Error Passing Variables (and creating)
        12160 by: Nicole Amashta
        12161 by: Nicole Amashta
        12165 by: Chris Earle

Re: calling PHP code on a different website
        12162 by: Alek Andreev

Run string as PHP code
        12163 by: Nicole Amashta
        12164 by: Collins, Robert

Writing text to files on Windows
        12166 by: Robert Abbate

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 ---
You could try something like this:

<?php
    $mysql_host = "localhost";
    $mysql_login = "username";
    $mysql_pw = "password";

    if($submit == "Submit"){
        $db_security = mysql_connect($mysql_host, $mysql_login, $mysql_pw);
        mysql_select_db("dbname",$db_security);
        $sql = "UPDATE tablename SET name = '$name' WHERE id = '$id'";
        $result = mysql_query($sql);
    }else{
        echo "<FORM ACTION='$PHP_SELF' METHOD='post'>";
        echo "ID : <INPUT TYPE='id' NAME='name' SIZE='5'><BR>";
        echo "Name : <INPUT TYPE='text' NAME='name' SIZE='75'><BR>";
        echo "<INPUT TYPE='submit' NAME='submit' VALUE='Submit'>";
        echo "</FORM>";
    }
?>

-----Original Message-----
From: Sandeep Murphy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 5:48 AM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] updating db


Hi,

Can anyone tell me how I can update a column in MySQL based on form
input????

TIA,
sands

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Also, read this (which is taken from the php.ini):

<snip>
 E_NOTICE          - run-time notices (these are warnings which often result
;                     from a bug in your code, but it's possible that it was
;                     intentional (e.g., using an uninitialized variable and
;                     relying on the fact it's automatically initialized to
an
;                     empty string)
</snip>

So, by using ~E_NOTICE in the statement I last showed you, you suppress
those WARNINGS, if this is the case with your problem.

-Nicole Amashta
www.aeontrek.com


"Chris" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I currently have been trying to learn PHP (as Apache module) and it
doesn't
> work.  Through Apache I get this error:
> "[Tue Feb 19 18:41:11 2002] [error] PHP Warning:  Undefined variable:
> username in ...filepath...\apache group\apache\htdocs\second.php on line
13"
>
> The book I'm using to program with PHP says that by creating a NAME value
> for a FORM gives me a variable with that name (and '$' included infront of
> it).  However, it doesn't seem to work that way:
>
> Apache version: 1.3.23
> PHP version: 4.1.1
> OS: Windows XP
>
> I think Windows XP and Apache are the problem because on their site they
> have listed this warning for XP:
>
> "If you will install Apache on Windows XP, be warned. There is a known bug
> our users have identified; you may or may not encounter it yourself. It
will
> be fixed in the forthcoming Apache 1.3.24 release. The effects of this bug
> within Apache 2.0 Beta are not yet determined.
> It appears the combination of duplicating file handles between and parent
> and child process, in conjunction with blocking sends to the http client,
> may result in corrupted output. You may not see this in MSIE, which tends
to
> throw any error in the 'Cannot find server or DNS Error' category.
>
> If you receive such errors on Windows XP using SSI scripting or PHP
scripts,
> but not static pages, you are probably a victim of this bug. It has been
> reported to Microsoft, we have no further details at this time."
>
> The thing is though, the bug is kind of a strange one... not creating the
> variable.  Is that the result of Apache and XP or am I doing something
> completely wrong (in the following code I also tried the echo function):
>
> --------------------------------------------CODE--------------------------
--
> ---------------------------
>
>
> <HTML>
> <BODY>
> <FORM>
> Please type your name here:<BR>
> <INPUT TYPE="text" NAME=username><BR><BR>
> <INPUT TYPE="submit" VALUE="Submit">
> </FORM>
> <BR><BR>
> You typed:
> <?php
>     print($username);
> ?>
> </BODY>
> </HTML>
>
>


--- End Message ---
--- Begin Message ---
That won't work because you have to actually send the form before using the
variable $username.

Check your php.ini and make sure you have your error_reporting  line set
like this:

error_reporting  =  E_ALL & ~E_NOTICE

hope that helps,
Nicole Amashta
www.aeontrek.com

"Chris" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I currently have been trying to learn PHP (as Apache module) and it
doesn't
> work.  Through Apache I get this error:
> "[Tue Feb 19 18:41:11 2002] [error] PHP Warning:  Undefined variable:
> username in ...filepath...\apache group\apache\htdocs\second.php on line
13"
>
> The book I'm using to program with PHP says that by creating a NAME value
> for a FORM gives me a variable with that name (and '$' included infront of
> it).  However, it doesn't seem to work that way:
>
> Apache version: 1.3.23
> PHP version: 4.1.1
> OS: Windows XP
>
> I think Windows XP and Apache are the problem because on their site they
> have listed this warning for XP:
>
> "If you will install Apache on Windows XP, be warned. There is a known bug
> our users have identified; you may or may not encounter it yourself. It
will
> be fixed in the forthcoming Apache 1.3.24 release. The effects of this bug
> within Apache 2.0 Beta are not yet determined.
> It appears the combination of duplicating file handles between and parent
> and child process, in conjunction with blocking sends to the http client,
> may result in corrupted output. You may not see this in MSIE, which tends
to
> throw any error in the 'Cannot find server or DNS Error' category.
>
> If you receive such errors on Windows XP using SSI scripting or PHP
scripts,
> but not static pages, you are probably a victim of this bug. It has been
> reported to Microsoft, we have no further details at this time."
>
> The thing is though, the bug is kind of a strange one... not creating the
> variable.  Is that the result of Apache and XP or am I doing something
> completely wrong (in the following code I also tried the echo function):
>
> --------------------------------------------CODE--------------------------
--
> ---------------------------
>
>
> <HTML>
> <BODY>
> <FORM>
> Please type your name here:<BR>
> <INPUT TYPE="text" NAME=username><BR><BR>
> <INPUT TYPE="submit" VALUE="Submit">
> </FORM>
> <BR><BR>
> You typed:
> <?php
>     print($username);
> ?>
> </BODY>
> </HTML>
>
>


--- End Message ---
--- Begin Message ---
Yours did not work as it either.  Thanks for the attempt.  Although a few
things about your code that I thought my be the problem:
- You had "<? " and not "<?php" ... even after changing that it had the same
affect (I do not know if that is okay or not, that's why I changed it)
-The "action" setting is seen as not even a blank space when coverted to
HTML (because it unassigned or is that server default variable?)
-Everything else was normal and I've seen before and it still does not work.
I guess I will definately be getting Linux.

THANK YOU for trying to help me get this work.  I wish I could simply use XP
for this stuff, but I don't have a problem getting Linux and using it either
so thank you!

"Ross Fleming" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Try this instead.  I couldn't get Devon's to work on my system either, but
> this one does.  Note the use of the empty() function which tests a string
> for emptiness.
>
> Let me know if it works?
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html>
> <head>
>  <title>Test Form</title>
> </head>
> <body>
> <?
> if (empty($username))
> {
>  echo "
> <form method=post action=".$PHP_SELF.">
> <input type=\"text\" name=\"username\"><br>
> <input type=\"submit\" value=\"Post Data\">
> </form><i>No data yet, or username is empty.</i>";
> }
>
>
>  else
> {
>  echo "<b>Username:</b> " . $username;
> }
>
>
> ?>
> </body>
> </html>


--- End Message ---
--- Begin Message ---
You may want to do some XML export and import. That will give you a
widely compatible data exchange method.

Later, you can use that XML feed to provide syndication contents, etc.
(Think about the future!)

-----Original Message-----
From: Ridai Govinda Pombo [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 19, 2002 6:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Re: calling PHP code on a different website

The most simple way is by QueryString :-)

Ridai

Steen Rabol wrote:

> Hi
> 
> Plot: how can I share data/info from a PHP based site on a ASP based
site ?
> 
> Site A, running PHP
> Site B , running ASP
> 
> Now on site B I would like to publish some information from site A's
> database, is that possible ?
> 
> Thanks i advance
> 
> Steen
> 
> 
> 


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




--- End Message ---
--- Begin Message ---
Can someone tell me the function to run a string as php code?

I know there is a function, but I can't for the life of me remember what it
is, so i can't search for it on php.net.

Anyone know offhand?

TIA!

--
Nicole Amashta
Web Applications Developer
www.aeontrek.com


--- End Message ---
--- Begin Message ---
eval()

-----Original Message-----
From: Nicole Amashta [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 2:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Run string as PHP code


Can someone tell me the function to run a string as php code?

I know there is a function, but I can't for the life of me remember what it
is, so i can't search for it on php.net.

Anyone know offhand?

TIA!

--
Nicole Amashta
Web Applications Developer
www.aeontrek.com



-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I seem to be having trouble being able to *write* text to a file within a
Windows server. Does anyone know what needs to be done to get this to work?
I've tried making sure that the direcories are set to the maximum
permissions (read/write/execute) to anyone. Still doesn't work.

I'm trying this:

  $fp = fopen("test.txt", "w"); flock($fp, 1);
  fputs($fp, "testing");
  fclose($fp);

and I've tried "a", "a+", "w+", and "w" and no results.




--- End Message ---

Reply via email to