[PHP] Strange Parser error
I have been working on a script and come to a brick wall which I can't break... I am using Suse Linux 2.2 kernel, PHP4.04pl1 Mysql 3.22 Mod_ssl open_ssl - this is running on an old 486 with 16Meg RAM. I have a session object variable ($Items) which has as one of its elements ($LineItems) an array of objects each containing the order line details. This script is to insert the records to process a dispatch into an invoice. I lock (all the tables I need to lock) before going into a loop through all the $Items->LineItems and then a whole raft of SQL inserts and updates using the same $SQL variable to hold the SQL and $Result variable to hold the result in each case. The problem is that I get a parser error when the sript within the foreach ($Items->LineItems as OrderLine) loop gets too big when I remove the last block of code the pasrser error which was occurring at a line before the deleted code dissappears and the script works (as far as it goes). Add in a few more lines within the loop and the parser error comes back but further up in the code that was previously working ok - and has not been changed!! The script is not huge line 343 - 385 is where the parser is falling over . Has any one hit this snag. I can post the script if this pricks anyones interest! TIA Phil Daintree -- PHP General 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] Re:LOCK TABLES x COMMIT/ROLLBACK
This also troubles me i have read and read the docs on this. It seems that Lock tables prevents other threads interfering with your transaction your inserts will not be compromised by another thread deleting or updating data inconsistent with your SQL. The snag for me is that all obscure input from the user and every other eventuality has to be trapped prior to avoid sending dud SQL to MySQL, other wise the inserts/updates will fail. The TO DO list talks about atomic inserts/updates which would solve my problems ie they all happen or all do NOT happen. If MySQL can do this then I don't care about rollback. I would dearly like to use the fast tables rather than compromise speed using DBD tables but as I see it we are stuck with them or Postgres until the atomic updates code is completed. Be interested to know if anyone has got atomic updates sorted. Phil Daintree -- PHP General 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] dates
This is a function I use: function DateDiff ($Date1, $Date2, $Period) { /* expects dates in the format d/m/y - period can be one of 'd','w','y','m' months are assumed to be 30 days and years 365.25 days This only works provided that both dates are after 1970. Also only works for dates up to the year 2035 ish */ $Date1 = trim($Date1); $Date2 = trim($Date2); $Date1_array = explode("/", $Date1); $Date2_array = explode("/", $Date2); $Date1_Stamp = mktime(0,0,0, (int)$Date1_array[1],(int)$Date1_array[0],(int)$Date1_array[2]); $Date2_Stamp = mktime(0,0,0, (int)$Date2_array[1],(int)$Date2_array[0],(int)$Date2_array[2]); $Difference = $Date1_Stamp - $Date2_Stamp; /* Difference is the number of seconds between each date negative if Date 2 > Date 1 */ switch ($Period) { case "d": Return (int) ($Difference/(24*60*60)); break; case "w": Return (int) ($Difference/(24*60*60*7)); break; case "m": Return (int) ($Difference/(24*60*60*30)); break; case "s": Return $Difference; break; case "y": Return (int) ($Difference/(24*60*60*365.25)); break; default: Return 0; } } Phil Daintree -- PHP General 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] Re:Is there a PHP equivalent of DATE_FORMAT ?
See Date("format_string",timestamp); Phil Daintree Dux Industries Ltd - Ph: +64 (04) 567 8900 Fax: +64 (04) 567 8904 -- PHP General 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]