php-windows Digest 24 May 2007 01:15:17 -0000 Issue 3236

Topics (messages 27948 through 27953):

Re: Mysql and Textarea (Please help me figure out this problem. I' m stuck. 
Please help me!!! )
        27948 by: Birt.Ecplipse
        27953 by: bedul

send mail when iis goes down?
        27949 by: Gustav Wiberg
        27950 by: Mikael Grön

Oracle BLOB & PHP
        27951 by: Alf Stockton
        27952 by: N.A.Morgan.bton.ac.uk

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 ---
Looks like a problem in the definition of the TEXTAREA NAME.
The echo statement is started and ended with a '
While in the $row['ID']  also a quote is used. So the echo string looks not 
correct.

Try:    echo '<TD> <P><TEXTAREA NAME="Assign_Engineer[' . $row[\'ID\'] . 
'][Job_Title]" ROWS="10"


""bedul"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> use $_POST[your var] in this script..
> not simple but worked..
>
> other option
>
> $_HTTP_POST_VARS[your var]
>
>
> ----- Original Message -----
> From: "sam rumaizan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, May 23, 2007 4:13 AM
> Subject: [PHP-WIN] Mysql and Textarea (Please help me figure out this
> problem. I' m stuck. Please help me!!! )
>
>
>> I'm just a php beginner.
>>   So please be patient with my stupid questions.
>>
>>   What am I missing in this code that causing the function can't update
> the textarea?
>>
>>   Update button erase the old information from mysql database and replace
> it with nothing. Basically it can't read what is inside the Textarea box.
> Why??
>>
>>   Read the highlighted code.
>>
>>   <?php
>> include ('./includes/header.html');
>> include( '../mysql_connect.php' );
>>   ?>
>>     </HEAD>
>>     <BODY>
>>     <TABLE ALIGN="center" BORDER="0" CELLSPACING="0" CELLPADDING="0">
>>       <TR ALIGN="center" VALIGN="middle">
>>         <TH ALIGN="center"><FONT SIZE="6" COLOR ="#310032">View
>> Existing Data</FONT></TH>
>>       </TR>
>>     </TABLE>
>>       <FORM METHOD="post" ACTION="ved.php">
>> <?php
>> $query = "SELECT DISTINCT Assign_Engineer FROM lo_data";
>> $result = mysql_query($query);
>> ?>
>>     <BR /><BR />
>>     <CENTER>
>>       <SELECT NAME="R"><OPTION VALUE="NULL">Choose a Category:</OPTION>
>> <?php
>> while ($line = mysql_fetch_array($result))
>> {
>>     foreach ($line as $value)
>>     {
>>         echo"<OPTION VALUE='$value'";
>>     }
>>     echo ">$value</OPTION>";
>> }
>> ?>
>>       </SELECT>
>>       <INPUT  TYPE="submit" NAME="Submit" VALUE="Submit Data"><BR /><BR
>> />
>> <?php
>> if (isset($_REQUEST['save_assign_engineer'])) {
>>     $id = (int) $_REQUEST['save_assign_engineer'];
>>     $job_title =
>> mysql_real_escape_string($_REQUEST['Assign_Engineer'][' .$id .
> ']['Job_Title']);
>>     $sql = "
>>         UPDATE `lo_data`
>>         SET `Job_Title` = '" . $job_title . "'
>>         WHERE `ID` = " . $id;
>>     mysql_query($sql);
>> }
>> if (isset($_POST["R"])) {
>>     $result = mysql_query("SELECT * FROM  lo_data WHERE Assign_Engineer
> ='".$_POST["R"]."'");
>> }
>> ?>
>>       <DIV STYLE="overflow:auto;">
>>         <TABLE  WIDTH="80" BORDER="1" CELLSPACING="1" CELLPADDING="3"
>> BORDERCOLOR="CDCB98">
>>           <THEAD>
>>             <TR STYLE="position: relative; top:
>> expression(this.offsetParent.scrollTop); background-color: #CDCB98;">
>>                <TH>ID</TH>
>>               <TH>Reference No</TH>
>>               <TH>Job Descriptions</TH>
>>               <TH>Category</TH>
>>               <TH>Assign Engineer</TH>
>>               <TH>Date Received</TH>
>>               <TH>Date Required</TH>
>>               <TH>Date Assigned</TH>
>>               <TH>Projected Completion Date</TH>
>>               <TH>Date Completed</TH>
>>               <TH>Manhour Spent</TH>
>>               <TH>Status</TH>
>>             </TR>
>>           </THEAD>
>> <?php
>> $num=mysql_num_rows($result);
>> echo $num;
>> while($row = mysql_fetch_array($result))
>> {
>>     echo "<TBODY>";
>>     echo "<TR VALIGN=\"TOP\" ALIGN=\"CENTER\">";
>>     echo "<TD>{$row['ID']}</TD>";
>>     echo "<TD>{$row['Ref_No']}</TD>";
>>     echo '<TD> <P><TEXTAREA NAME="Assign_Engineer[' . $row['ID'] .
> '][Job_Title]" ROWS="10"
>>     COLS="40">'.$row['Job_Title'] .'</TEXTAREA>';
>>     echo " <BR />";
>> echo '<button type="submit" name="save_assign_engineer" value="' .
>> $row['ID'] . '" />Updaet data</button>
>> ';
>>     echo "<TD>{$row['Category']}</TD>";
>>     echo "<TD>{$row['Assign_Engineer']}</TD>";
>>     echo "<TD>{$row['Date_Received']}</TD>";
>>     echo "<TD>{$row['Date_Required']}</TD>";
>>     echo "<TD>{$row['Date_Assigned']}</TD>";
>>     echo "<TD>{$row['ProjectedCompletionDate']}</TD>";
>>     echo "<TD>{$row['Date_Completed']}</TD>";
>>     echo "<TD>{$row['ManhourSpent']}</TD>";
>>     echo "<TD>{$row['Status']}</TD>";
>>     echo "</TR>";
>>     echo"</TBODY>";
>> }
>>   ?>
>>
>>
>>
>>
>>
>>
>> ---------------------------------
>> Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's
> on, when. 

--- End Message ---
--- Begin Message ---
nope.. i just realized when have his source code and read again /sob

the problem is in the button..

he use <button > tag???
he should use <input type=submit> or <input type=button>

oh well... he type a long setence to ask.. why he can't execute ?? not the
code problem but the tag html problem
----- Original Message -----
From: "Birt.Ecplipse" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 23, 2007 5:03 PM
Subject: Re: [PHP-WIN] Mysql and Textarea (Please help me figure out this
problem. I' m stuck. Please help me!!! )


> Looks like a problem in the definition of the TEXTAREA NAME.
> The echo statement is started and ended with a '
> While in the $row['ID']  also a quote is used. So the echo string looks
not
> correct.
>
> Try:    echo '<TD> <P><TEXTAREA NAME="Assign_Engineer[' . $row[\'ID\'] .
> '][Job_Title]" ROWS="10"
>
>
> ""bedul"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > use $_POST[your var] in this script..
> > not simple but worked..
> >
> > other option
> >
> > $_HTTP_POST_VARS[your var]
> >
> >
> > ----- Original Message -----
> > From: "sam rumaizan" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, May 23, 2007 4:13 AM
> > Subject: [PHP-WIN] Mysql and Textarea (Please help me figure out this
> > problem. I' m stuck. Please help me!!! )
> >
> >
> >> I'm just a php beginner.
> >>   So please be patient with my stupid questions.
> >>
> >>   What am I missing in this code that causing the function can't update
> > the textarea?
> >>
> >>   Update button erase the old information from mysql database and
replace
> > it with nothing. Basically it can't read what is inside the Textarea
box.
> > Why??
> >>
> >>   Read the highlighted code.
> >>
> >>   <?php
> >> include ('./includes/header.html');
> >> include( '../mysql_connect.php' );
> >>   ?>
> >>     </HEAD>
> >>     <BODY>
> >>     <TABLE ALIGN="center" BORDER="0" CELLSPACING="0" CELLPADDING="0">
> >>       <TR ALIGN="center" VALIGN="middle">
> >>         <TH ALIGN="center"><FONT SIZE="6" COLOR ="#310032">View
> >> Existing Data</FONT></TH>
> >>       </TR>
> >>     </TABLE>
> >>       <FORM METHOD="post" ACTION="ved.php">
> >> <?php
> >> $query = "SELECT DISTINCT Assign_Engineer FROM lo_data";
> >> $result = mysql_query($query);
> >> ?>
> >>     <BR /><BR />
> >>     <CENTER>
> >>       <SELECT NAME="R"><OPTION VALUE="NULL">Choose a Category:</OPTION>
> >> <?php
> >> while ($line = mysql_fetch_array($result))
> >> {
> >>     foreach ($line as $value)
> >>     {
> >>         echo"<OPTION VALUE='$value'";
> >>     }
> >>     echo ">$value</OPTION>";
> >> }
> >> ?>
> >>       </SELECT>
> >>       <INPUT  TYPE="submit" NAME="Submit" VALUE="Submit Data"><BR /><BR
> >> />
> >> <?php
> >> if (isset($_REQUEST['save_assign_engineer'])) {
> >>     $id = (int) $_REQUEST['save_assign_engineer'];
> >>     $job_title =
> >> mysql_real_escape_string($_REQUEST['Assign_Engineer'][' .$id .
> > ']['Job_Title']);
> >>     $sql = "
> >>         UPDATE `lo_data`
> >>         SET `Job_Title` = '" . $job_title . "'
> >>         WHERE `ID` = " . $id;
> >>     mysql_query($sql);
> >> }
> >> if (isset($_POST["R"])) {
> >>     $result = mysql_query("SELECT * FROM  lo_data WHERE Assign_Engineer
> > ='".$_POST["R"]."'");
> >> }
> >> ?>
> >>       <DIV STYLE="overflow:auto;">
> >>         <TABLE  WIDTH="80" BORDER="1" CELLSPACING="1" CELLPADDING="3"
> >> BORDERCOLOR="CDCB98">
> >>           <THEAD>
> >>             <TR STYLE="position: relative; top:
> >> expression(this.offsetParent.scrollTop); background-color: #CDCB98;">
> >>                <TH>ID</TH>
> >>               <TH>Reference No</TH>
> >>               <TH>Job Descriptions</TH>
> >>               <TH>Category</TH>
> >>               <TH>Assign Engineer</TH>
> >>               <TH>Date Received</TH>
> >>               <TH>Date Required</TH>
> >>               <TH>Date Assigned</TH>
> >>               <TH>Projected Completion Date</TH>
> >>               <TH>Date Completed</TH>
> >>               <TH>Manhour Spent</TH>
> >>               <TH>Status</TH>
> >>             </TR>
> >>           </THEAD>
> >> <?php
> >> $num=mysql_num_rows($result);
> >> echo $num;
> >> while($row = mysql_fetch_array($result))
> >> {
> >>     echo "<TBODY>";
> >>     echo "<TR VALIGN=\"TOP\" ALIGN=\"CENTER\">";
> >>     echo "<TD>{$row['ID']}</TD>";
> >>     echo "<TD>{$row['Ref_No']}</TD>";
> >>     echo '<TD> <P><TEXTAREA NAME="Assign_Engineer[' . $row['ID'] .
> > '][Job_Title]" ROWS="10"
> >>     COLS="40">'.$row['Job_Title'] .'</TEXTAREA>';
> >>     echo " <BR />";
> >> echo '<button type="submit" name="save_assign_engineer" value="' .
> >> $row['ID'] . '" />Updaet data</button>
> >> ';
> >>     echo "<TD>{$row['Category']}</TD>";
> >>     echo "<TD>{$row['Assign_Engineer']}</TD>";
> >>     echo "<TD>{$row['Date_Received']}</TD>";
> >>     echo "<TD>{$row['Date_Required']}</TD>";
> >>     echo "<TD>{$row['Date_Assigned']}</TD>";
> >>     echo "<TD>{$row['ProjectedCompletionDate']}</TD>";
> >>     echo "<TD>{$row['Date_Completed']}</TD>";
> >>     echo "<TD>{$row['ManhourSpent']}</TD>";
> >>     echo "<TD>{$row['Status']}</TD>";
> >>     echo "</TR>";
> >>     echo"</TBODY>";
> >> }
> >>   ?>
> >>
> >>
> >>
> >>
> >>
> >>
> >> ---------------------------------
> >> Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see
what's
> > on, when.
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hi there!

Anyone who knows how to recieve a mail to (administrator"-mail) account when II_S6.0 goes down?

Best regards
/Gustav Wiberg
--- End Message ---
--- Begin Message ---
We have a solution to that at the company I'm employed.
One server, my private server actually, curls a PHP script on the work server every 15 minutes and if it gets anything other than "true" it sends an SMS to me and 5 more people. Works great! But you need a server somewhere else so you get alerts on power-outs and stuff too.

I guess you could write a semi advanced batch file on the windows machine that keeps track of running processes, or even checks a file on http://127.0.0.1/ and uses some kind of text based email program to alert you if it doesn't find the stuff it's supposed to.

Mike


Gustav Wiberg skrev:
Hi there!

Anyone who knows how to recieve a mail to (administrator"-mail) account when II_S6.0 goes down?

Best regards
/Gustav Wiberg

--- End Message ---
--- Begin Message --- Can someone suggest a method whereby one retrieves an Oracle BLOB & subsequently display same on a HTML page?
If possible an example would be great.

--
Regards,
Alf Stockton            www.stockton.co.za

Don't plan any hasty moves.  You'll be evicted soon anyway.
My email disclaimer is available at www.stockton.co.za/disclaimer.html

--- End Message ---
--- Begin Message ---
Alf,

This is an exerpt from a paper "Making efficient use of Oracle8i thru
Apache and PHP 4, Thies C. Arntzen <[EMAIL PROTECTED]> 2001" describing
PHP and Oracle LOBs.  You should be able to port the code to PHP5
relatively easily.

Regards,
Neil Morgan

large objects
=============

        PHP has full support for using internal and external LOBs in
oracle. LOBs
        are different from "normal" data-types as they require extra
programming on
        the script side. when you need to store large amount of data in
one field
        LOBs are the ideal choice. you could also store bigger fields
(up to 2GB)
        in a "LONG" or "LONG RAW" field (which is as good supported be
PHP) but
        oracle plans to drop support for those types in future releases.
"LONG"
        and "LONG RAW" fields can not be replicated across servers and
they will
        always get loaded into memory when the row containing the "LONG"
or "LONG
        RAW" is touched. LOBs don't have this limitation but cause a
tiny bit more
        headache when used. oracle has CLOBs (character-LOB) BLOBs
(binary-LOB)
        and BFILEs (external files - only path to file is stored in
database).

        before you can use a LOB oracle needs to create it - lets
illustrate:
        
        blobdemo.sql
        create table blobdemo (id number, lob blob);

        <?php

                $data =
array("/lib/libc-2.2.2.so","/lib/libncurses.so.5.2");

                $db = OCILogon("scott","tiger");
                $stmt = OCIParse($db,"insert into blobdemo values
        
(myid.nextval,EMPTY_BLOB()) returning id,lob into :id,:lob"); 
                $lob = OCINewDescriptor($db);
                OCIBindByName($stmt,":ID",$id,32);
                OCIBindByName($stmt,":LOB",$lob,-1,SQLT_BLOB);

                while (list(,$file) = each($data)) {
                        OCIExecute($stmt,OCI_DEFAULT);
// we cannot use autocommitt here
                        $lob->save(`cat $file`);
                        echo "$file id:$id\n";
                        OCICommit($db);
                }
        ?>

        now we have loaded our libc and ncurses into oracle - makes
sense;-)

        getting them back is more trivial:

    <?php
 
        $db = OCILogon("scott","tiger");
        $stmt = OCIParse($db,"select * from blobdemo");
        OCIExecute($stmt);

        while (OCIFetchInto($stmt,$arr,OCI_ASSOC)) {
                        echo "id: ".$arr[ "ID" ]."\n";
                        echo "size: ".strlen($arr[ "LOB"
]->load())."\n";
                }
    ?>

        to update a lob you have to load the LOB-descriptor first:

    <?php
 
        $db = OCILogon("scott","tiger");
        $stmt = OCIParse($db,"select blob from blobdemo for update");
        OCIExecute($stmt,OCI_DEFAULT);

        while (OCIFetchInto($stmt,$arr,OCI_ASSOC)) {
                        $content = $arr[ "LOB" ]->load();

                        echo "id: ".$arr[ "ID" ]."\n";
                        echo "size: ".strlen($content)."\n";

                        $lob->save(strrev($content));
                }
                OCICommit($db);
    ?>

        there are functions to just replace a part of a LOB, you can
spool a LOB
        to the browser or a file _without_ buffering it a PHP-variable.
the
        OCIFetchInto function also allows you to inline the LOB values
into your
        result-set, this saves you the call to ->load() but LOB-data
which is
        returned instead of the locator can not be modified like shown
above.


        the oracle-BFILE type can be read like a normal LOB/CLOB but
can't be
        written to. basically you can store the path to a file on the
        oracle-server in a table-field and the LOB functions allow you
to read this
        file thru the oracle server-connection. this can be extremely
helpful if
        your web-server is in front of a firewall and you only want to
allow
        oracle-traffic thru this firewall (no NFS-traffic). the BFILE
allows you
        to keep your images in the file-system so they don't clutter
your
        table-space but you can still access them as if they were a part
of your
        database!



-----Original Message-----
From: Alf Stockton [mailto:[EMAIL PROTECTED] 
Sent: 23 May 2007 13:33
To: php windows
Subject: [PHP-WIN] Oracle BLOB & PHP

Can someone suggest a method whereby one retrieves an Oracle BLOB &
subsequently display same on a HTML page?
If possible an example would be great.

--
Regards,
Alf Stockton            www.stockton.co.za

Don't plan any hasty moves.  You'll be evicted soon anyway.
My email disclaimer is available at www.stockton.co.za/disclaimer.html

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

--- End Message ---

Reply via email to