php-windows Digest 12 May 2001 09:09:52 -0000 Issue 593

Topics (messages 7496 through 7498):

Re: Access Violation with XML_PARSE in PWS
        7496 by: Cynic

Re: PHP 4.0.5 COM bugs
        7497 by: Alan Popow

Code still doesn't function correctly
        7498 by: Bob Sears

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]


----------------------------------------------------------------------


file a bug report at http://bugs.php.net/

At 18:46 11.5. 2001, BigPants wrote the following:
-------------------------------------------------------------- 
>I am getting an access violation error when using the xml_parse function. No
>other xml function gives me any trouble.
>I am using Win98 PWS / PHP 4
>
>HELP!!!
>
>Phil
>
>
>
>-- 
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
------end of quote------ 


[EMAIL PROTECTED]
-------------
And the eyes of them both were opened and they saw that their files
were world readable and writable, so they chmoded 600 their files.
    - Book of Installation chapt 3 sec 7 





On Fri, 11 May 2001 17:42:55 +0100, you wrote:

There was an earlier thread back when 4.0.5 was first introduced. It appears
that COM is broken in 4.0.5

I don't know if it will help, but check out http://php.weblogs.com/adodb 
There is a library called "ADODB Library for PHP4" written by John Lim. It
might help you do what you need done without having to deal with the COM
problems.

Alan

>I also have encountered an access violation when using xml_parse
>
>How do we solve/get round it ?
>
>Phil
>"Alain Samoun" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> Yes, COM is completely broken in 4.05
>> Alain
>>
>> On Wed, May 02, 2001 at 06:51:14PM +1000, Jason Gan wrote:
>> > I ran a brief ADODB test and it gave me an Access Violation Error.
>> >
>> > PHP has encountered an Access Violation at 2474FF04
>> >
>> > when parsing this line:
>> >
>> > $fields = $rs->Fields;
>> >
>> > where $rs is the recordset from the SQL database.
>> >
>> >
>> > I got the following error messages when using MSXML Parser 3.01 to load
>an
>> > XML string:
>> >
>> > PHP has encountered an Access Violation at 011C2655
>> >
>> > and
>> >
>> > PHP has encountered an Access Violation at 011C265B
>> >
>> >
>> > --
>> > PHP Windows Mailing List (http://www.php.net/)
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>
>> --
>> PHP Windows Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>>





I am probably driving everyone ballistic, but I am going to get to the 
bottom of this code problem with PHP/Javascript
because I don't want to rewrite the application in HTML/ASP/Oracle, if at 
all possible.

I want to be able to generate a pop-up window and populate that window with
a formatted representation of a customer's current shopping cart status. Since
PHP does not do client-side stuff and Javascript does not do data base I/O,
I have to use both in concert.

The PHP program in question follows, with the location given by "here is
the problem code".

Everything is contained in that one program.

Reads the data base and displays the contents of the product data base
based on selection criteria passed by the preceding program. This function
works very well. The problem is when the customer clicks on the "View Cart" 
link.
At that point, I want to have a pop-up screen and populate it with the
current order status. No where in the Wrox Press "Professional PHP 
Programming"
text do I find an example.

The module needs to overlay the first panel, thereby preserving all
pointers into the data base and not destroy or reassign the session
variables, which is used as the index into the temporary order MySQL table. 
I can
get the pop-up window to display but it never populates it with the order 
status, which
is written to a file and pointed to by the Javascript logic. The 
onClick="do the
Javascript windowing" functions correctly in opening a new window. When I
change it to onClick="<? do the PHP stuff ?>", the function doesn't work. When
combining the two to generate the report and open the window ...
onClick="<? do the PHP stuff ?>; do the Java windowing stuff", I quickly
receive an error message that halts execution.

Can a combination of PHP and Javascript do what needs to be done or am I 
asking too much of either language and
what I am asking cannot be accomplished? If it can be accomplished but I am 
doing it incorrectly, what is a correct
logic flow? This little snag is causing the entire project to be put on 
hold. I would dearly welcome any suggestions.

<?
function output_order_to_file(){
.
.--------------------------------------------------------------------------- 
-----------------------------> this PHP generates the cart status report to 
a file
.
$theScreen .= "<table width=90% border=0 align=center cellpadding=3>";
$theScreen .= "";
$theScreen .= " <tr>";
$theScreen .= "<td class=largeprint align=center colspan=5 align=center
bgcolor=#7FFFD4>";
$theScreen .= "HERE IS YOUR ORDER";
$theScreen .= "</td>";
$theScreen .= "</tr>";
$theScreen .= "<tr>";
$theScreen .= "<td align=center
bgcolor=".$headerColor.">INVENTORY<BR>NUMBER</td>";
$theScreen .= "<td align=center bgcolor=".$headerColor.">DESCRIPTION</td>";
$theScreen .= "<td align=right bgcolor=".$headerColor.">QUANTITY</td>";
$theScreen .= "<td align=right bgcolor=".$headerColor.">PRICE</td>";
$theScreen .= "<td align=right bgcolor=".$headerColor.">SUBTOTAL</td>";
$theScreen .= "</tr>";
$grandTotalRetail = 0;
$grandTotalQty = 0;
while ($row = mysql_fetch_array($result)){
$storedDescription = $row['Description'];
$storedID = $row['Id'];
$storedRetail = $row['Retail'];
$storedQty = $row['Qty'];
settype ($storedRetail, "integer");
settype ($storedQty, "integer");
if ($colorSwitch == 0){
$colorOfTD = $color0;
$colorSwitch = 1;
} else {
$colorOfTD = $color1;
$colorSwitch = 0;
}
.
.
.
$theScreen .= "</tr>";
$theScreen .= "</table>";
$theScreen .= "</BODY>";
$theScreen .= "</HTML>";

---------------------------------------------------------------------------- 
-------------------------------- here is the file i/o
---------------------------------------------------------------------------- 
-------------------------------- but the logic never enters this paragraph
$filename = "temporderfile.html";
$fd = fopen ($filename, "w");
fwrite ($fd, $theScreen);
fclose ($fd);
}
//-------------------------------------------------------------------------- 
--------
//--------------------------- end of generating report of the shopping cart 
contents
//-------------------------------------------------------------------------- 
--------

.
.
.
.
session_start();
//session_register("rnumber");
if (!IsSet($rnumber)){
$mtime = explode (" ",microtime());
$mseconds = $mtime[0] * 1000000000;
srand($mseconds);
$rnumber = rand();
session_register("rnumber");
}
.
.
.
$db_name = "frogpond";
$table_name = "product";
$connection = mysql_connect ("localhost","","") or
die ("Couldn't connect to localhost");
$db = mysql_select_db ($db_name, $connection) or
die ("Couldn't select $db_name");
parse_str($QUERY_STRING);
$newCategory = strtolower($category);
$category = $newCategory;
switch ($testCat){
case 0: $sql_statement = "SELECT * from $table_name where Category =
\"$category\";";
$theTitle = strtoupper($category);
break;
case 1: $sql_statement = "SELECT * from $table_name where Vendor =
\"$supplier\";";
$theTitle = strtoupper($supplier);
break;
default: exit;
}
.
.
.
$theScreen .= "<script language=\"javascript\">";
//-------------------------------------------------------------------------- 
--------------------------------------NewWindow function
//-------------------------------------------------------------------------- 
------------------------------------- which process correctly when PHP is 
hot introduced
$theScreen .= "function NewWindow(mypage){";
$theScreen .= "var scroll = 'yes';";
$theScreen .= "var myname = 'temp';";
$theScreen .= "var winl = (screen.width - 875) / 2;";
$theScreen .= "var wint = (screen.height - 650) / 2;";
$theScreen .= "winprops =
\"height=625,width=850,top=50,left=100,scrollbars=yes\";";
$theScreen .= " win = window.open(mypage, myname, winprops);";
$theScreen .= "if (parseInt(navigator.appVersion) >= 4) {
win.window.focus(); }";
$theScreen .= "}";
//----------------------------------------------------------------------
//-----------------------------------------------closeNewWindow function
//----------------------------------------------------------------------
$theScreen .= "function closeNewWindow(){";
$theScreen .= " window.close();";
$theScreen .= "}";
.
.
.
if ($outputCounter > 1){
//--------------------------------------------
//--------------------------- the red up arrow
//--------------------------------------------
$theScreen .= "<td width=110px>";
$theScreen .= "<a href=\"#top\"><img 
src=\"d:\\html\\frogpond\\images\\arrow_red_up.jpg\" border=0>";
$theScreen .= "&nbsp;Top</a><br>";
//---------------------------------------------------------
//-------------------------------------------------------------------------- 
------------------------------------------- indicate to create the 
temporderfile.html file
//-------------------------------------------------------------------------- 
------------------------------------------- here is the problem code !!!
//---------------------------------------------------------
$TheParameters = "<? output_order_to_file(); ?>; 
";  ------------------------------------------- when this is omitted, the 
pup-up window is generated

//-------------------------------------------------------------------------- 
------------------------------------------- indicate to open a new window
//-------------------------------------------------------------------------- 
------------------------------------------- which operates correctly when 
the above instruction is
//-------------------------------------------------------------------------- 
------------------------------------------- not present
$TheParameters .= "NewWindow(this.href); return false;";
//-------------------------------------------------------------------------- 
------------------------------------------- the need is to write the PHP 
report to via output_order_to_file()
//-------------------------------------------------------------------------- 
------------------------------------------- and display it in the pop-up 
window via NewWindow(this.href)
//---------- when $TheParameters = "<? output_order_to_file(); ?>; 
NewWindow(this.href)";  ... PHP really gets a headache, which is passed on 
to me
//-------------------------------------------------------------------------- 
----
//-------------------------------------------------------------------------- 
-------------------------------------------html file the new window will 
display
//-------------------------------------------------------------------------- 
----
$theScreen .= "<a href=\"temporderfile.html\" onclick=\"$TheParameters\">";
//-------------------------------------------------------------------------- 
----------------------------------------- output the shopping cart image
$theScreen .= "<img border=0 ";
$theScreen .= "src=\"d:\html\frogpond\images\shopping-cart-image.gif\">";
$theScreen .= "&nbsp;Check Cart</a><br>";
//-------------------------------------------------------------------------- 
---------------------------------------- the red down arrow
$theScreen .= "<a href=\"#bottom\"><img
src=\"d:\\html\\frogpond\\images\\arrow_red_down.jpg\" border=0>";
$theScreen .= "&nbsp;Bottom</a>";
$theScreen .= "</td>";
$outputCounter = 0;
} else {
//-------------------------------------------------------------------------- 
-------------------------------------- generate a blank box as the last td
$theScreen .= "<td>";
$theScreen .= "&nbsp;";
$theScreen .= "</td>";
}
$outputCounter++;
$theScreen .= "</tr>";
}
$theScreen .= "<tr>";
$theScreen .= "<td colspan=3 align=center>";
if ($MYSTATUS == $TEST){
$theScreen .= "<H2><A HREF=\"d:\\html\\frogpond\\b.html\"><BR><BR>TO
MENU</A></H2></td>";
} else {
$theScreen .= "<H2><A HREF=\"b.html\"><BR><BR>TO MENU</A></H2></td>";
}
$theScreen .= "</tr>";
$theScreen .= "</table>";
$theScreen .= "</form>";
$theScreen .= "<a name=bottom>";
$theScreen .= "<script language=\"javascript\">";
$theScreen .= "WriteFrogPondGourmet();";
$theScreen .= "</script>";
$theScreen .= "</BODY>";
$theScreen .= "</HTML>";
print ($theScreen);
?>

Bob Sears
Application Developer/Programmer
Internet --> Mainframe, Unix/Aix, OS/JCL
HTML, PHP, Perl, Javascript, VBScript, VB, C, COBOL, C++, Fortran, RPG and 
21 more
Informix, MySQL, Total
317-882-8056 (residence)
317-488-5022 (office)
[EMAIL PROTECTED]
Resume on-line: <http://www.on-net.net/~rsears/resumes/bob/bob.html>
Site samples : <http://www.on-net.net/~rsears/webwyshez/webwyshez.html>




Reply via email to