if you want actual errors that PHP generates and not logic based errors,
then writing your own error handling function and calling it with
set_error_handler() at the top of your scripts may work for you.  in your
function you'd just need to use $errorstr, $errorfile and $errline and log
it using error_log().


hth
jeff


                                                                                       
                                                 
                      "Robert Sossomon"                                                
                                                 
                      <[EMAIL PROTECTED]        To:       <[EMAIL PROTECTED]>, <[EMAIL 
PROTECTED]>                            
                      com>                     cc:                                     
                                                 
                                               Subject:  [PHP-DB] RE: [PHP] Re: Adding 
a log file                                       
                      11/05/2003 11:02                                                 
                                                 
                      AM                                                               
                                                 
                                                                                       
                                                 
                                                                                       
                                                 




Like I said, syntactically bogus, I was trying to write it out fast
while I was away from the actual scripts...  Like I said, for the MOST
part the pieces are working, however on some items it is acting
correctly yet the items are not showing up in the shopping cart or in
the database anywhere.

Here's the script pieces.
//addtocart.php
   $addtocart = "insert into store_shoppertrack
values('','$_POST[SESSID]','$_POST[sel_item_id]','$_POST[sel_item_qty]',
'$_POST[sel_item_price]','$item_desc', now())";

   mysql_query($addtocart);

   //redirect to showcart page
   header("Location: showcart.php");

//Additem.php
   $addtocart = "insert into store_shoppertrack
values('','$_POST[SESSID]','$_POST[sel_item_name]','$_POST[sel_item_qty]
','$_POST[sel_item_price]','$item_desc', now())";

   mysql_query($addtocart);

//Addspec.php
   //add info to cart table
   $addtocart = "insert into store_shoppertrack
values('','$_POST[SESSID]','$_POST[sel_item_id]','$_POST[sel_item_qty]',
'$_POST[sel_item_price]','$_POST[sel_item_desc]', now())";

   mysql_query($addtocart);

//Seestore.php
/*
  The following code allows for the addition of a non-stock item.  All
information is added automatically to the quoter for the salesman.
*/

$display_block .= "<HR>Input a new item: <form method=post
action=\"addspec.php\">&nbsp;&nbsp;&nbsp;&nbsp;Item ID:<input
type=\"text\" name=\"sel_item_id\"><BR>Description:<input type=\"text\"
name=\"sel_item_desc\"><BR>Quantity: <select name=\"sel_item_qty\">";
$display_block .= "<option value=\"0\">0</option><option value=\"1\"
selected>1</option>";
for ($i=2; $i < 301; $i++){
 $display_block .= "<option value=\"$i\">$i</option>";
}
$display_block .= "</select><input type=\"hidden\" name=\"SESSID\"
value=\"$PHPSESSID\"></td><td><input type=\"hidden\" name=\"url\"
value=\"$_SERVER[PHP_SELF]\"><BR>Price:<input type=\"text\"
name=\"sel_item_price\" size=\"5\"><input type=\"submit\"
name=\"submit\" value=\"Add to Cart\"></form>";

$display_block .= "<HR>";

/*
  The following code allows for the addition of a stocked item.  All
information is added automatically to the quoter for the salesman.
*/

$display_block .= "Input item: <form method=post
action=\"additem.php\">&nbsp;&nbsp;&nbsp;&nbsp;";
$display_block .= "Item ID:<input type=\"text\"
name=\"sel_item_id\"><BR>Quantity: <select name=\"sel_item_qty\">";
$display_block .= "<option value=\"0\">0</option><option value=\"1\"
selected>1</option>";
for ($i=2; $i < 301; $i++){
 $display_block .= "<option value=\"$i\">$i</option>";
}
$display_block .= "</select>";
$display_block .= "<input type=\"hidden\" name=\"SESSID\"
value=\"$PHPSESSID\"></td><td>";
$display_block .= "<input type=\"hidden\" name=\"url\"
value=\"$_SERVER[PHP_SELF]\"><BR>Price:";
$display_block .= "<input type=\"text\" name=\"sel_item_price\"
size=\"5\">";
$display_block .= "<input type=\"submit\" name=\"submit\" value=\"Add to
Cart\"></form>";

//categories.php
    $display_block .= "<tr><td><form method=post
action=\"addtocart.php\">&nbsp;&nbsp;&nbsp;&nbsp;<em><strong>$item_name</strong>
 - $item_desc</em></td><td><select name=\"sel_item_qty\">";
    $display_block .= "<option value=\"0\">0</option><option value=\"1\"
selected>1</option>";
    for ($i=2; $i < 301; $i++){$display_block .= "<option
     value=\"$i\">$i</option>";
    }
    $display_block .= "</select><input type=\"hidden\" name=\"SESSID\"
value=\"$PHPSESSID\"><input type=\"hidden\" name=\"sel_item_id\"
value=\"$item_id\"></td><td><input type=\"hidden\"
name=\"sel_item_name\" value=\"$item_name\"><input type=\"hidden\"
name=\"sel_item_desc\" value=\"$item_desc\"><input type=\"hidden\"
name=\"url\" value=\"$_SERVER[PHP_SELF]?cat_id=$cat_id\"><input
type=\"text\" name=\"sel_item_price\" size=\"5\" value=\"$price\"><input
type=\"submit\" name=\"submit\" value=\"Add to Cart\"></form></td>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A bachelor can only chase a girl until she catches him.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----Original Message-----
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 05, 2003 11:00 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] Re: Adding a log file


$Addcart() -- is Addcart() a function (in which case you should remove
the dollar sign) or are you specifically trying to do some magic there
by running a function whose name is stored in that variable?

Bogdan

Robert Sossomon wrote:

> I am seeing some errors with a program I wrote and I need to write
> everything to a log file that the program is doing.
>
> The following syntax I KNOW is wrong, but not sure they are important
> to put here correctly yet. //script addtocart $Addcart (info1, info2)
> Mysqlquey($addcart)
>
> I am seeing random items NOT being added to my shopping cart.  The
> reason, I have no clue. I can pull another catgory of items and the
> first 20 will do fine, I go back to the first category I have and the
> script seems to work correctly but the data is not written to the
> shopping cart.  Problem with the shopping cart???  I wouldn't think
> so. Problem with the add page, I don't see how.  So where is the error

> coming from?  No clue, which is why I want to log everything.  I use 3

> different add pages so that each form uses a different way to add.
> This works for me, and seems to work rather well.  But I need to log
> everything on the 3 forms to see where the errors are coming from.
>
> TIA!
>
> Robert ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> To rest is to rust.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

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

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

Reply via email to