php-general Digest 3 Jul 2008 15:55:08 -0000 Issue 5548
php-general Digest 3 Jul 2008 15:55:08 - Issue 5548 Topics (messages 276241 through 276255): PHPNews Vs phpns 276241 by: John Comerford Re: Log files 276242 by: Shawn McKenzie 276243 by: John Comerford 276244 by: Haluk AKIN 276245 by: Per Jessen Re: [SPAM] Re: [PHP] how to create a slide show using PHP5 276246 by: Chris Scott PHPExcel 276247 by: Dan Shirah 276248 by: Dan Shirah 276249 by: Jim Lucas 276250 by: Dan Shirah 276251 by: Jim Lucas 276252 by: Robert Cummings 276254 by: Richard Heyes 276255 by: Shawn McKenzie Help with query MySQL and PHP 276253 by: axis 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] -- ---BeginMessage--- I am looking at including news on a website I am putting together. From my google searches it seems the two main players are PHPNews and phpns. Are these the main open source news systems ? Is one considered better than the other ? Anyone got any real world experiences with either of these products ? Anyone recommend an alternative ? TIA, JC ---End Message--- ---BeginMessage--- Mark Bomgardner wrote: I am writing an application in which I want to create log files. I am weighing the difference between using text files and using a database to house the data. It appears to me that there is really no advantage either way or is there? There are pros and cons to both methods, but I am concerned about opening and closing a text file some many times that it may cause and issue. The file may be opened and closed 1,000 or more times a day. Opinions please.. markb Using a database you're hitting a file the same number of times (the database is in a file or files) but you have the mem/cpu overhead of the db itself. Having said that, if you are using a database already for the site then might as well log to it. I wouldn't implement a database only for the purpose of logging. -Shawn ---End Message--- ---BeginMessage--- If you are logging errors, then maybe you should look at using a file instead of a database table. I have seen an instance where a system used a table for error logging and writing to the log table caused and error, you can guess where that left things. Shawn McKenzie wrote: Mark Bomgardner wrote: I am writing an application in which I want to create log files. I am weighing the difference between using text files and using a database to house the data. It appears to me that there is really no advantage either way or is there? There are pros and cons to both methods, but I am concerned about opening and closing a text file some many times that it may cause and issue. The file may be opened and closed 1,000 or more times a day. Opinions please.. markb Using a database you're hitting a file the same number of times (the database is in a file or files) but you have the mem/cpu overhead of the db itself. Having said that, if you are using a database already for the site then might as well log to it. I wouldn't implement a database only for the purpose of logging. -Shawn -- Option Systems Pty. Ltd. 53 Waverley Road, Malvern East, VIC 3145 PO Box 7, Caulfield East, VIC 3145 Phone: 03 9571 0100 Fax: 03 9571 0500 The information in this e-mail is confidential and is intended solely for the addressee. Any views or opinions presented are solely those of the author and do not necessarily represent those of Option Systems Pty.Ltd. If you are not the intended recipient, please delete this message and contact the sender. ---End Message--- ---BeginMessage--- If you are planning to come up with relations between these errors and other activities on your website then you need to use a database. If you will use this error log only for debugging purposes then a text file should be enough. From a coder's perspective the workload of coding both of these methods should be similar. Opening and closing a text file 1,000 or more times a day won't be a problem either. Similarly, openingclosing that many database connections won't be any problem either. Therefore, if I were you I wouldn't worry about the performance. Cheers, Haluk -Original Message- From: John Comerford [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 12:54 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Log files If you are logging errors, then maybe you should look at using a file instead of a database table. I have seen an instance where a system used a table for error logging and writing to the log table caused and error, you can guess where that left things. Shawn McKenzie wrote: Mark Bomgardner wrote: I am writing an application in which I want to create log files. I
Re: [PHP] Log files
Mark Bomgardner wrote: way or is there? There are pros and cons to both methods, but I am concerned about opening and closing a text file some many times that it may cause and issue. The file may be opened and closed 1,000 or more times a day. 1000 times? Nothing to worry about. Even if you were talking about 100,000 times a day. /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] FW: [SPAM] Re: [PHP] how to create a slide show using PHP5
-Original Message- From: philip [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 02, 2008 10:03 PM To: Bastien Koert Cc: php-general@lists.php.net Subject: [SPAM] Re: [PHP] how to create a slide show using PHP5 Importance: Low Bastien Koert wrote: On Wed, Jul 2, 2008 at 4:37 PM, philip [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi everyone, I want to create a slide show of photos for my web site. How is this done using php5? I am using Opensuse 10.3, Apache, PHP5. TIA for any assistance, Philip -- Philip Ramsey learning PHP and MySQL for building a better world philipramsey.is-a-geek.net http://philipramsey.is-a-geek.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 2 parts to this 1. pull a series on [random] images from the system to show the user 2. client side javascript code to load the images in a slide show fashion You may want to get an existing one and pull it apart to see how they've done it -- Bastien Cat, the other other white meat Hi Bastien, Thank you for your quick response. Where may I find sample? I tried searching the web but only found samples and tutorials that required flash for the actual slide show. Since I run Linux and Adobe/Macromedia do not make a flash editor for Linux, flash is not an option. TIA, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Flash is still an option if you use Ming: http://uk.php.net/manual/en/book.ming.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHPExcel
Happy 4th of July! I am having a little bit of a problem using PHPExcel. I think I'm doing everything right but apparently not! I am basically trying to output results of a query to Excel using PHPExcel. My query works fine, my variables are being passed correctly, my database connection is fine...within my while () loop the echo This .$stat_year. .$stat_month.br /\n; properly returns all of the years and months for my query. But for whatever reason when I try and put those vaules in the Excel objects and export the spreadsheet, the values of my cells are always blank. Any ideas? /** PHPExcel */ include 'PHPExcel.php'; /** PHPExcel_Writer_Excel2007 */ include 'PHPExcel/Writer/Excel5.php'; // Create new PHPExcel object echo date('H:i:s') . Create new PHPExcel objectbr /\n; $objPHPExcel = new PHPExcel(); // Add some data, we will use printing features $name_code = $_GET['name']; // echo $name; $case_age = $_GET['case_age']; // echo $case_age; $case_cat = $_GET['case_cat']; // echo $case_cat; $case_status = $_GET['case_status']; // echo $case_status; include 'Conn/prpr_ifx.php'; if (!$connect_id = ifx_connect([EMAIL PROTECTED], $user, $pass)) { // THE ACTUAL CONNECTION echo Unable to connect to Informix Database\n; // DISPLAY IF CONNECTION FAILS exit(); } $sql = SELECT * FROM brev_pending_summary_detail WHERE name = '$name_code'; if (!empty($case_age)) { $sql.= AND case_age_group = '$case_age'; } if (!empty($case_cat)) { $sql.= AND case_category = '$case_cat'; } if (!empty($case_status)) { $sql.= AND case_status = '$case_status'; } // Start our query of the database $query = ifx_query($sql, $connect_id); echo date('H:i:s') . Add some databr /\n; if(!empty($query)) { while ($row = ifx_fetch_row($query)) { $stat_year = $row['stat_year']; $stat_month = $row['stat_month']; echo This .$stat_year. .$stat_month.br /\n; $objPHPExcel-getActiveSheet()-setCellValue('A' . $stat_year); $objPHPExcel-getActiveSheet()-setCellValue('B' . $stat_month); } } // Set header and footer. When no different headers for odd/even are used, odd header is assumed. echo date('H:i:s') . Set header/footerbr /\n; $objPHPExcel-getActiveSheet()-getHeaderFooter()-setOddHeader('CHPlease treat this document as confidential!'); $objPHPExcel-getActiveSheet()-getHeaderFooter()-setOddFooter('LB' . $objPHPExcel-getProperties()-getTitle() . 'RPage P of N'); // Set page orientation and size echo date('H:i:s') . Set page orientation and sizebr /\n; $objPHPExcel-getActiveSheet()-getPageSetup()-setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); $objPHPExcel-getActiveSheet()-getPageSetup()-setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4); $objPHPExcel-getActiveSheet()-getColumnDimension('A')-setAutoSize(true); $objPHPExcel-getActiveSheet()-getColumnDimension('B')-setAutoSize(true); // Rename sheet echo date('H:i:s') . Rename sheetbr /\n; $objPHPExcel-getActiveSheet()-setTitle('Pending Summary'); // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel-setActiveSheetIndex(0); // Save Excel 5 file echo date('H:i:s') . Write to Excel2005 formatbr /\n; $objWriter = new PHPExcel_Writer_Excel5($objPHPExcel); $objWriter-save(str_replace('.php', '.xls', __FILE__)); // Echo done echo date('H:i:s') . Done writing file.\r\n;
[PHP] Re: PHPExcel
Okay, I found PART of my problem. $objPHPExcel-getActiveSheet()-setCellValue('A' . $stat_year); $objPHPExcel-getActiveSheet()-setCellValue('B' . $stat_month); I must have mistyped and put period . instead of comma , to seperate the cell number from the variable. Fixed that and now I get something...what I get now is one row of data printed out on row 65,536 in Excel (I believe this is the very last row of data allowed by Excel) So, instead of printing out the 128 results I should get form the loop, it only prints out one result on the max row available in Excel. Ideas?
Re: [PHP] PHPExcel
Dan Shirah wrote: Happy 4th of July! I am having a little bit of a problem using PHPExcel. I think I'm doing everything right but apparently not! I am basically trying to output results of a query to Excel using PHPExcel. My query works fine, my variables are being passed correctly, my database connection is fine...within my while () loop the echo This .$stat_year. .$stat_month.br /\n; properly returns all of the years and months for my query. But for whatever reason when I try and put those vaules in the Excel objects and export the spreadsheet, the values of my cells are always blank. Any ideas? /** PHPExcel */ include 'PHPExcel.php'; /** PHPExcel_Writer_Excel2007 */ include 'PHPExcel/Writer/Excel5.php'; // Create new PHPExcel object echo date('H:i:s') . Create new PHPExcel objectbr /\n; $objPHPExcel = new PHPExcel(); // Add some data, we will use printing features $name_code = $_GET['name']; // echo $name; $case_age = $_GET['case_age']; // echo $case_age; $case_cat = $_GET['case_cat']; // echo $case_cat; $case_status = $_GET['case_status']; // echo $case_status; include 'Conn/prpr_ifx.php'; if (!$connect_id = ifx_connect([EMAIL PROTECTED], $user, $pass)) { // THE ACTUAL CONNECTION echo Unable to connect to Informix Database\n; // DISPLAY IF CONNECTION FAILS exit(); } $sql = SELECT * FROM brev_pending_summary_detail WHERE name = '$name_code'; if (!empty($case_age)) { $sql.= AND case_age_group = '$case_age'; } if (!empty($case_cat)) { $sql.= AND case_category = '$case_cat'; } if (!empty($case_status)) { $sql.= AND case_status = '$case_status'; } // Start our query of the database $query = ifx_query($sql, $connect_id); echo date('H:i:s') . Add some databr /\n; if(!empty($query)) { while ($row = ifx_fetch_row($query)) { $stat_year = $row['stat_year']; $stat_month = $row['stat_month']; echo This .$stat_year. .$stat_month.br /\n; $objPHPExcel-getActiveSheet()-setCellValue('A' . $stat_year); $objPHPExcel-getActiveSheet()-setCellValue('B' . $stat_month); } } I see you calling the method getActiveSheet(). My guess is that it does exactly what it says it does. Problem is, is that you are not **setting** the active sheet until after this point. Maybe try setting all the paramaters before you start adding data to the sheet? That might fix it. // Set header and footer. When no different headers for odd/even are used, odd header is assumed. echo date('H:i:s') . Set header/footerbr /\n; $objPHPExcel-getActiveSheet()-getHeaderFooter()-setOddHeader('CHPlease treat this document as confidential!'); $objPHPExcel-getActiveSheet()-getHeaderFooter()-setOddFooter('LB' . $objPHPExcel-getProperties()-getTitle() . 'RPage P of N'); // Set page orientation and size echo date('H:i:s') . Set page orientation and sizebr /\n; $objPHPExcel-getActiveSheet()-getPageSetup()-setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); $objPHPExcel-getActiveSheet()-getPageSetup()-setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4); $objPHPExcel-getActiveSheet()-getColumnDimension('A')-setAutoSize(true); $objPHPExcel-getActiveSheet()-getColumnDimension('B')-setAutoSize(true); // Rename sheet echo date('H:i:s') . Rename sheetbr /\n; $objPHPExcel-getActiveSheet()-setTitle('Pending Summary'); // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel-setActiveSheetIndex(0); // Save Excel 5 file echo date('H:i:s') . Write to Excel2005 formatbr /\n; $objWriter = new PHPExcel_Writer_Excel5($objPHPExcel); $objWriter-save(str_replace('.php', '.xls', __FILE__)); // Echo done echo date('H:i:s') . Done writing file.\r\n; -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
Jim, I placed it above like you said, but i get the same result. I think I need to do something like the below: if(!empty($query)) { while ($row = ifx_fetch_row($query)) { for ($i = 3; $i = 50; $i++) { $stat_year = $row['stat_year']; $stat_month = $row['stat_month']; $name = $row['_name']; $case_number = $row['case_number']; echo This .$stat_year. .$stat_month. .$j_name. .$case_number.br /\n; $objPHPExcel-getActiveSheet()-setCellValue('A' . $i, $stat_year); $objPHPExcel-getActiveSheet()-setCellValue('B' . $i, $stat_month); $objPHPExcel-getActiveSheet()-setCellValue('C' . $i, $name); $objPHPExcel-getActiveSheet()-setCellValue('D' . $i, $case_number); } } } To get it to work I need to set the $i value to the starting cell I want. so, $i = 3 means that setCellValue('A' . $i) means the output will start populating the data in Excel cell A3. If I use the code above I get an output of the exact same record in rows 1-50. Maybe I need to put my query results into an array and use the $i value to select that row of data from the array also?
Re: [PHP] PHPExcel
Dan Shirah wrote: Jim, I placed it above like you said, but i get the same result. I think I need to do something like the below: if(!empty($query)) { while ($row = ifx_fetch_row($query)) { for ($i = 3; $i = 50; $i++) { $stat_year = $row['stat_year']; $stat_month = $row['stat_month']; $name = $row['_name']; $case_number = $row['case_number']; echo This .$stat_year. .$stat_month. .$j_name. .$case_number.br /\n; $objPHPExcel-getActiveSheet()-setCellValue('A' . $i, $stat_year); $objPHPExcel-getActiveSheet()-setCellValue('B' . $i, $stat_month); $objPHPExcel-getActiveSheet()-setCellValue('C' . $i, $name); $objPHPExcel-getActiveSheet()-setCellValue('D' . $i, $case_number); } } } To get it to work I need to set the $i value to the starting cell I want. so, $i = 3 means that setCellValue('A' . $i) means the output will start populating the data in Excel cell A3. If I use the code above I get an output of the exact same record in rows 1-50. Maybe I need to put my query results into an array and use the $i value to select that row of data from the array also? Looking at the example at the following URL http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=ExamplesreferringTitle=Home You can see that infact they do give the column/row combo in the setCellValue() method. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
On Thu, 2008-07-03 at 08:59 -0400, Dan Shirah wrote: Happy 4th of July! How did you know it was my sisters birthday today? Been an exciting week, first Canada's birthday was on Monday, now my sister's birthday today. What a thrill ride. :) Cheers, Rob. I am having a little bit of a problem using PHPExcel. I think I'm doing everything right but apparently not! I am basically trying to output results of a query to Excel using PHPExcel. My query works fine, my variables are being passed correctly, my database connection is fine...within my while () loop the echo This .$stat_year. .$stat_month.br /\n; properly returns all of the years and months for my query. But for whatever reason when I try and put those vaules in the Excel objects and export the spreadsheet, the values of my cells are always blank. Any ideas? /** PHPExcel */ include 'PHPExcel.php'; /** PHPExcel_Writer_Excel2007 */ include 'PHPExcel/Writer/Excel5.php'; // Create new PHPExcel object echo date('H:i:s') . Create new PHPExcel objectbr /\n; $objPHPExcel = new PHPExcel(); // Add some data, we will use printing features $name_code = $_GET['name']; // echo $name; $case_age = $_GET['case_age']; // echo $case_age; $case_cat = $_GET['case_cat']; // echo $case_cat; $case_status = $_GET['case_status']; // echo $case_status; include 'Conn/prpr_ifx.php'; if (!$connect_id = ifx_connect([EMAIL PROTECTED], $user, $pass)) { // THE ACTUAL CONNECTION echo Unable to connect to Informix Database\n; // DISPLAY IF CONNECTION FAILS exit(); } $sql = SELECT * FROM brev_pending_summary_detail WHERE name = '$name_code'; if (!empty($case_age)) { $sql.= AND case_age_group = '$case_age'; } if (!empty($case_cat)) { $sql.= AND case_category = '$case_cat'; } if (!empty($case_status)) { $sql.= AND case_status = '$case_status'; } // Start our query of the database $query = ifx_query($sql, $connect_id); echo date('H:i:s') . Add some databr /\n; if(!empty($query)) { while ($row = ifx_fetch_row($query)) { $stat_year = $row['stat_year']; $stat_month = $row['stat_month']; echo This .$stat_year. .$stat_month.br /\n; $objPHPExcel-getActiveSheet()-setCellValue('A' . $stat_year); $objPHPExcel-getActiveSheet()-setCellValue('B' . $stat_month); } } // Set header and footer. When no different headers for odd/even are used, odd header is assumed. echo date('H:i:s') . Set header/footerbr /\n; $objPHPExcel-getActiveSheet()-getHeaderFooter()-setOddHeader('CHPlease treat this document as confidential!'); $objPHPExcel-getActiveSheet()-getHeaderFooter()-setOddFooter('LB' . $objPHPExcel-getProperties()-getTitle() . 'RPage P of N'); // Set page orientation and size echo date('H:i:s') . Set page orientation and sizebr /\n; $objPHPExcel-getActiveSheet()-getPageSetup()-setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE); $objPHPExcel-getActiveSheet()-getPageSetup()-setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4); $objPHPExcel-getActiveSheet()-getColumnDimension('A')-setAutoSize(true); $objPHPExcel-getActiveSheet()-getColumnDimension('B')-setAutoSize(true); // Rename sheet echo date('H:i:s') . Rename sheetbr /\n; $objPHPExcel-getActiveSheet()-setTitle('Pending Summary'); // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel-setActiveSheetIndex(0); // Save Excel 5 file echo date('H:i:s') . Write to Excel2005 formatbr /\n; $objWriter = new PHPExcel_Writer_Excel5($objPHPExcel); $objWriter-save(str_replace('.php', '.xls', __FILE__)); // Echo done echo date('H:i:s') . Done writing file.\r\n; -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with query MySQL and PHP
Hi, I want to create a new column or table from queries of the values of columns I( already have. My table is : PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS products_id products_extra_fields_id products_extra_fields_value 1 1 Blond 1 2 Green 1 3 1.75 1 4 24 2 1 Brunette 2 2 Hazel 2 3 1.56 2 4 28 with this Select query function get_extra($extra_array = '') { if (!is_array($extra_array)) $extra_array = array(); $extra_query = db_query(select products_extra_fields_value from . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . where products_extra_fields_id = '1'); while ($extra = db_fetch_array($extra_query)) { $extra_array[] = array('id' = $extra['products_extra_fields_id'], 'text' = $extra['products_extra_fields_value']); } return $extra_array; } This function uses the query: select products_extra_fields_value from PRODUCTS_EXTRA_FIELDS where products_extra_fields_id = 1; and returns Rubia and Morocha which is fine, now I need to either create a new column or table in order to be able to have those values in their own column my knowledge of mysql is limited so please give me suggestions as what to use in order to create a function to retrieve values and add them automatically to my table or columns The table or columns have to be something like: ID Hair Eyes Blond Green Brunette Hazel so I can call them later by selecting from a column in a table like TABLE_PRODUCTS_EXTRA_FIELDS_TO_PRODUCTS_EXTRA_FIELDS_VALUE pef2pev.hair, pef2pev.eyes ... and so on here is my current switch for ($i=0, $n=sizeof($column_list); $i$n; $i++) { switch ($column_list[$i]) { case 'PRODUCT_LIST_MODEL': $select_column_list .= 'p.products_model, '; break; case 'PRODUCT_LIST_MANUFACTURER': $select_column_list .= 'm.manufacturers_name, '; break; // aDD eXTRA FIELdS case 'PRODUCT_LIST_HAIR': $select_column_list .= 'pef2pev.hair, '; break; and so on ... break; } } Thanks Rick Fitzgerald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
Happy 4th of July! How did you know it was my sisters birthday today? Been an exciting week, first Canada's birthday was on Monday, now my sister's birthday today. What a thrill ride. Isn't it the 3rd? -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
Richard Heyes wrote: Happy 4th of July! How did you know it was my sisters birthday today? Been an exciting week, first Canada's birthday was on Monday, now my sister's birthday today. What a thrill ride. Isn't it the 3rd? It is in the great Republic of Texas. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
On 7/3/08, Shawn McKenzie [EMAIL PROTECTED] wrote: Richard Heyes wrote: Happy 4th of July! How did you know it was my sisters birthday today? Been an exciting week, first Canada's birthday was on Monday, now my sister's birthday today. What a thrill ride. Isn't it the 3rd? It is in the great Republic of Texas. -Shawn It is even in the sub-tropical part of Texas known as Houston. But this isn't a day of celebration for you guys, Richard, to be sure. Do you all just ignore the day, or do you hold some kind of anti-celebration? David
RE: [PHP] PHPExcel
-Original Message- From: David Giragosian [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2008 11:19 AM To: php-general@lists.php.net Subject: Re: [PHP] PHPExcel On 7/3/08, Shawn McKenzie [EMAIL PROTECTED] wrote: Richard Heyes wrote: Happy 4th of July! How did you know it was my sisters birthday today? Been an exciting week, first Canada's birthday was on Monday, now my sister's birthday today. What a thrill ride. Isn't it the 3rd? It is in the great Republic of Texas. It is even in the sub-tropical part of Texas known as Houston. But this isn't a day of celebration for you guys, Richard, to be sure. Do you all just ignore the day, or do you hold some kind of anti-celebration? Heh... almost got in trouble at work for laughing so loud at that one. Vive le revolucion! Todd Boyd Web Programmer
Re: [PHP] PHPExcel
So how would I go about getting each result from my query into the columns/rows? Should I do my query, and then assign the first column to an array, the second to another array, etc? And then try to loop it using $i to count each row? And just FYI, I put Happy 4th (even though today is the 3rd) because I won't be checking my email tomorrow :)
Re: [PHP] PHPExcel
On Thu, 2008-07-03 at 16:36 +0100, Richard Heyes wrote: Happy 4th of July! How did you know it was my sisters birthday today? Been an exciting week, first Canada's birthday was on Monday, now my sister's birthday today. What a thrill ride. Isn't it the 3rd? *doh* I took for granted someone else had the date right... I rarely know what day it is :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
GOT IT!!! I changed my code to the following: $sql = SELECT * FROM brev_pending_summary_detail WHERE name = '$name_code'; if (!empty($case_age)) { $sql.= AND case_age_group = '$case_age'; } if (!empty($case_cat)) { $sql.= AND case_category = '$case_cat'; } if (!empty($case_status)) { $sql.= AND case_status = '$case_status'; } // Start our query of the database $query = ifx_query($sql, $connect_id); $row = ifx_fetch_row($query); $results = array(); echo date('H:i:s') . Add some databr /\n; for ($i = 3, $j = 0; $i = $count; $i++, $j++) { $results[$j] = ifx_fetch_row($query); $objPHPExcel-getActiveSheet()-setCellValue('A' . $i, $results[$j]['stat_year']); $objPHPExcel-getActiveSheet()-setCellValue('B' . $i, $results[$j]['stat_month']); $objPHPExcel-getActiveSheet()-setCellValue('C' . $i, $results[$j]['name']); $objPHPExcel-getActiveSheet()-setCellValue('D' . $i, $results[$j]['case_age_group']); } I created a seperate query to get the row count...created an empty array ( $results = array(); ) I set $i = 3 so my results will start printing on line 3 of the spreadsheet I set $j = 0 so the row data will start at the first row of the results from my query Then I made the loop repeat until $i became equal to the total number of rows And I then set the value of my previsouly empty array equal to the current counted row of my query results And to round it all off I echo'd out my results by using the new $results($j) value appended with my database column names ['stat_year'] etc. AWESOME! I hope someone else learns from this or can use this!
Re: [PHP] PHPExcel
UGH! I am now constantly getting an error of PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 936 bytes) on line 689 Is there a way to continuously write to the file and avoid getting this error? On 7/3/08, Dan Shirah [EMAIL PROTECTED] wrote: GOT IT!!! I changed my code to the following: $sql = SELECT * FROM brev_pending_summary_detail WHERE name = '$name_code'; if (!empty($case_age)) { $sql.= AND case_age_group = '$case_age'; } if (!empty($case_cat)) { $sql.= AND case_category = '$case_cat'; } if (!empty($case_status)) { $sql.= AND case_status = '$case_status'; } // Start our query of the database $query = ifx_query($sql, $connect_id); $row = ifx_fetch_row($query); $results = array(); echo date('H:i:s') . Add some databr /\n; for ($i = 3, $j = 0; $i = $count; $i++, $j++) { $results[$j] = ifx_fetch_row($query); $objPHPExcel-getActiveSheet()-setCellValue('A' . $i, $results[$j]['stat_year']); $objPHPExcel-getActiveSheet()-setCellValue('B' . $i, $results[$j]['stat_month']); $objPHPExcel-getActiveSheet()-setCellValue('C' . $i, $results[$j]['name']); $objPHPExcel-getActiveSheet()-setCellValue('D' . $i, $results[$j]['case_age_group']); } I created a seperate query to get the row count...created an empty array ( $results = array(); ) I set $i = 3 so my results will start printing on line 3 of the spreadsheet I set $j = 0 so the row data will start at the first row of the results from my query Then I made the loop repeat until $i became equal to the total number of rows And I then set the value of my previsouly empty array equal to the current counted row of my query results And to round it all off I echo'd out my results by using the new $results($j) value appended with my database column names ['stat_year'] etc. AWESOME! I hope someone else learns from this or can use this!
Re: [PHP] Re: Inspiration for a Tombstone.
2008/7/2 Daniel Brown [EMAIL PROTECTED]: Fatal error: Call to undefined function shawn() in /home/shawn/life.php on line 1 I like it. ;-P I think that a 500 internal service error would be more appropriate at that stage... Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing?
Re: [PHP] PHPExcel
But this isn't a day of celebration for you guys, Richard, to be sure. Depends how you look at it. My passing out parade (Navy not booze) was on the 4th July. Do you all just ignore the day, or do you hold some kind of anti-celebration? Well for me personally it's just another day. Can't speak for the rest of the populace. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
*doh* I took for granted someone else had the date right... I rarely know what day it is :) It's not often I know what day it is... :-) -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
Richard Heyes wrote: *doh* I took for granted someone else had the date right... I rarely know what day it is :) It's not often I know what day it is... :-) Oops, sorry, I read your message wrong. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
On Thu, Jul 03, 2008 at 02:36:18PM -0400, Dan Shirah wrote: UGH! I am now constantly getting an error of PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 936 bytes) on line 689 Is there a way to continuously write to the file and avoid getting this error? Hi Dan... change the value of memory_limit in your php.ini to a greater value than 16M. Greetings Mario -- -BEGIN GEEK CODE BLOCK- Version: 3.12 GCS/CM d- s++: a+ C$ UBL*$ P++ L+++ E--- W+++ N+ o-- K- w O- M- V-- PS++ PE++ Y PGP+++ t--- 5 X R++ tv- b+++ DI D G++ e* h r+++ y --END GEEK CODE BLOCK-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
I changed the max memory limit to 512MB and the max timeput to 60... I'm trying to export a report that only has 3,600 rows and it still exceeds my memory size/timeout. any suggestions that I could make to my code to make it more efficient and not use up so much memory? On 7/3/08, Mario Guenterberg [EMAIL PROTECTED] wrote: On Thu, Jul 03, 2008 at 02:36:18PM -0400, Dan Shirah wrote: UGH! I am now constantly getting an error of PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 936 bytes) on line 689 Is there a way to continuously write to the file and avoid getting this error? Hi Dan... change the value of memory_limit in your php.ini to a greater value than 16M. Greetings Mario -- -BEGIN GEEK CODE BLOCK- Version: 3.12 GCS/CM d- s++: a+ C$ UBL*$ P++ L+++ E--- W+++ N+ o-- K- w O- M- V-- PS++ PE++ Y PGP+++ t--- 5 X R++ tv- b+++ DI D G++ e* h r+++ y --END GEEK CODE BLOCK-- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5 Web Developer Position in Mountain View, CA
Please contact me if you are interested in learning more: Abby Knight EQQUS Technologies 555 Bryant Street, Suite 700 Palo Alto, CA 94301 650-234-1000 ext. 355 [EMAIL PROTECTED] My client is venture funded startup building the World’s most comprehensive and powerful shopping search engine. Utilizing patent-pending technology crawls and indexes products from every store on the Internet. Applying its exclusive Product Ranking Engine (PRE), products are then displayed in an order that delivers the most relevant search results for consumers on the very first page of results. Their search results are ranked algorithmically based on popularity, market demand and other key attributes. LOCATION: Mountain View, CA ROLE: You will be responsible for developing UI technology for the large scale, high performance shopping search engine. You will work closely with the design and product management groups to define and implement user interface for the website. You will work closely with server-side engineers during the implementation process. This position requires: · 3+ years experience developing User Interfaces for web-based companies · Strong knowledge and ability to program with object-oriented PHP 5. Familiarity with Smarty templating a plus. · Strong knowledge of HTML, CSS, DHTML, JavaScript, and AJAX · Experience with database (MySQL) applications, including strength in SQL is a plus · Familiarity with third-party APIs (Google/Yahoo Maps, Facebook, etc) preferred · Quick learner, who is anxious to contribute immediately COMPENSATION: Competitive base salary Stock Options -- View this message in context: http://www.nabble.com/PHP-5-Web-Developer-Position-in-Mountain-View%2C-CA-tp18268090p18268090.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [confirm: ffd06320e87b4e72f197eae8dfdde17a [EMAIL PROTECTED]
[confirm: ffd06320e87b4e72f197eae8dfdde17a [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
Dan Shirah wrote: UGH! I am now constantly getting an error of PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 936 bytes) on line 689 Is there a way to continuously write to the file and avoid getting this error? On 7/3/08, Dan Shirah [EMAIL PROTECTED] wrote: GOT IT!!! I changed my code to the following: $sql = SELECT * FROM brev_pending_summary_detail WHERE name = '$name_code'; if (!empty($case_age)) { $sql.= AND case_age_group = '$case_age'; } if (!empty($case_cat)) { $sql.= AND case_category = '$case_cat'; } if (!empty($case_status)) { $sql.= AND case_status = '$case_status'; } // Start our query of the database $query = ifx_query($sql, $connect_id); $row = ifx_fetch_row($query); $results = array(); echo date('H:i:s') . Add some databr /\n; for ($i = 3, $j = 0; $i = $count; $i++, $j++) { $results[$j] = ifx_fetch_row($query); $objPHPExcel-getActiveSheet()-setCellValue('A' . $i, $results[$j]['stat_year']); $objPHPExcel-getActiveSheet()-setCellValue('B' . $i, $results[$j]['stat_month']); $objPHPExcel-getActiveSheet()-setCellValue('C' . $i, $results[$j]['name']); $objPHPExcel-getActiveSheet()-setCellValue('D' . $i, $results[$j]['case_age_group']); } I created a seperate query to get the row count...created an empty array ( $results = array(); ) I set $i = 3 so my results will start printing on line 3 of the spreadsheet I set $j = 0 so the row data will start at the first row of the results from my query Then I made the loop repeat until $i became equal to the total number of rows And I then set the value of my previsouly empty array equal to the current counted row of my query results And to round it all off I echo'd out my results by using the new $results($j) value appended with my database column names ['stat_year'] etc. AWESOME! I hope someone else learns from this or can use this! What is on and around line 689? Unless you need the $results array later after the for loop you should overwrite it each time, so use $results = ifx_fetch_row($query); instead. Maybe this: $i = 3; while ($results = ifx_fetch_row($query)) { $objPHPExcel-getActiveSheet()-setCellValue('A' . $i, $results['stat_year']); $objPHPExcel-getActiveSheet()-setCellValue('B' . $i, $results['stat_month']); $objPHPExcel-getActiveSheet()-setCellValue('C' . $i, $results['name']); $objPHPExcel-getActiveSheet()-setCellValue('D' . $i, $results['case_age_group']); $i++; } -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
On 7/3/08, Dan Shirah [EMAIL PROTECTED] wrote: GOT IT!!! I changed my code to the following: $sql = SELECT * FROM brev_pending_summary_detail WHERE name = '$name_code'; if (!empty($case_age)) { $sql.= AND case_age_group = '$case_age'; } if (!empty($case_cat)) { $sql.= AND case_category = '$case_cat'; } if (!empty($case_status)) { $sql.= AND case_status = '$case_status'; } // Start our query of the database $query = ifx_query($sql, $connect_id); Also, why are you fetching a row here? Then in your loop you will have missed the first one. $row = ifx_fetch_row($query); $results = array(); echo date('H:i:s') . Add some databr /\n; for ($i = 3, $j = 0; $i = $count; $i++, $j++) { $results[$j] = ifx_fetch_row($query); $objPHPExcel-getActiveSheet()-setCellValue('A' . $i, $results[$j]['stat_year']); $objPHPExcel-getActiveSheet()-setCellValue('B' . $i, $results[$j]['stat_month']); $objPHPExcel-getActiveSheet()-setCellValue('C' . $i, $results[$j]['name']); $objPHPExcel-getActiveSheet()-setCellValue('D' . $i, $results[$j]['case_age_group']); } I created a seperate query to get the row count...created an empty array ( $results = array(); ) I set $i = 3 so my results will start printing on line 3 of the spreadsheet I set $j = 0 so the row data will start at the first row of the results from my query Then I made the loop repeat until $i became equal to the total number of rows And I then set the value of my previsouly empty array equal to the current counted row of my query results And to round it all off I echo'd out my results by using the new $results($j) value appended with my database column names ['stat_year'] etc. AWESOME! I hope someone else learns from this or can use this! What is on and around line 689? Unless you need the $results array later after the for loop you should overwrite it each time, so use $results = ifx_fetch_row($query); instead. Maybe this: $i = 3; while ($results = ifx_fetch_row($query)) { $objPHPExcel-getActiveSheet()-setCellValue('A' . $i, $results['stat_year']); $objPHPExcel-getActiveSheet()-setCellValue('B' . $i, $results['stat_month']); $objPHPExcel-getActiveSheet()-setCellValue('C' . $i, $results['name']); $objPHPExcel-getActiveSheet()-setCellValue('D' . $i, $results['case_age_group']); $i++; } -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
Dan Shirah wrote: GOT IT!!! I changed my code to the following: $sql = SELECT * FROM brev_pending_summary_detail WHERE name = '$name_code'; if (!empty($case_age)) { $sql.= AND case_age_group = '$case_age'; } if (!empty($case_cat)) { $sql.= AND case_category = '$case_cat'; } if (!empty($case_status)) { $sql.= AND case_status = '$case_status'; } // Start our query of the database $query = ifx_query($sql, $connect_id); $row = ifx_fetch_row($query); $results = array(); echo date('H:i:s') . Add some databr /\n; for ($i = 3, $j = 0; $i = $count; $i++, $j++) { $results[$j] = ifx_fetch_row($query); $objPHPExcel-getActiveSheet()-setCellValue('A' . $i, $results[$j]['stat_year']); $objPHPExcel-getActiveSheet()-setCellValue('B' . $i, $results[$j]['stat_month']); $objPHPExcel-getActiveSheet()-setCellValue('C' . $i, $results[$j]['name']); $objPHPExcel-getActiveSheet()-setCellValue('D' . $i, $results[$j]['case_age_group']); } Give this a try, should save you some memory! ?php $sql = SELECT * FROM brev_pending_summary_detail WHEREname = '{$name_code}'; if (!empty($case_age)) { $sql.= AND case_age_group = '{$case_age}'; } if (!empty($case_cat)) { $sql.= AND case_category = '{$case_cat}'; } if (!empty($case_status)) { $sql.= AND case_status = '{$case_status}'; } // Start our query of the database $query = ifx_query($sql, $connect_id); echo date('H:i:s') . Add some databr /\n; $offSet = 3; $row = ifx_fetch_row($query, NEXT); while ( is_array($row) ) { $objPHPExcel-getActiveSheet()-setCellValue('A' . $offSet, $row['stat_year']); $objPHPExcel-getActiveSheet()-setCellValue('B' . $offSet, $row['stat_month']); $objPHPExcel-getActiveSheet()-setCellValue('C' . $offSet, $row['name']); $objPHPExcel-getActiveSheet()-setCellValue('D' . $offSet, $row['case_age_group']); $offSet++; $row = ifx_fetch_row($query, NEXT); } ifx_free_result($query); ? -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHPExcel
Shawn McKenzie wrote: On 7/3/08, Dan Shirah [EMAIL PROTECTED] wrote: GOT IT!!! I changed my code to the following: $sql = SELECT * FROM brev_pending_summary_detail WHERE name = '$name_code'; if (!empty($case_age)) { $sql.= AND case_age_group = '$case_age'; } if (!empty($case_cat)) { $sql.= AND case_category = '$case_cat'; } if (!empty($case_status)) { $sql.= AND case_status = '$case_status'; } // Start our query of the database $query = ifx_query($sql, $connect_id); Also, why are you fetching a row here? Then in your loop you will have missed the first one. $row = ifx_fetch_row($query); $results = array(); It looks like he was following the example on the ifx_fetch_row() manual page. If you look at the arguments and examples, you will see that same type of concept. Problem is he didn't follow it in the for loop. Check my other email for the example that I submitted that he should try. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Installed 5.2.6 but phpinfo() still says 5.0.2
I've installed PHP version 5.2.6 but phpinfo() and php -v both report back the old version 5.0.2. I even copied php.ini-dist from the distribution to /etc/php.ini and restarted the physical server. It still does show version 5.2.6 as the current version. As a sidenote, I'm having the same thing occur with my Apache upgrade that I just did too. It still thinks its version 2.0.54 instead of version 2.0.63. I tweaked my httpd.conf file, didn't make any difference. I'm running Fedora 2.6.11-1.1369_FC4. Any ideas where to look? Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Installed 5.2.6 but phpinfo() still says 5.0.2
For some reason this first post didn't post to this newsgroup... x0ml [EMAIL PROTECTED] wrote in message news:... I've installed PHP version 5.2.6 but phpinfo() and php -v both report back the old version 5.0.2. I even copied php.ini-dist from the distribution to /etc/php.ini and restarted the physical server. It still does show version 5.2.6 as the current version. As a sidenote, I'm having the same thing occur with my Apache upgrade that I just did too. It still thinks its version 2.0.54 instead of version 2.0.63. I tweaked my httpd.conf file, didn't make any difference. I'm running Fedora 2.6.11-1.1369_FC4. Any ideas where to look? Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Installed 5.2.6 but phpinfo() still says 5.0.2
x0ml wrote: I've installed PHP version 5.2.6 but phpinfo() and php -v both report back the old version 5.0.2. I even copied php.ini-dist from the distribution to /etc/php.ini and restarted the physical server. It still does show version 5.2.6 as the current version. As a sidenote, I'm having the same thing occur with my Apache upgrade that I just did too. It still thinks its version 2.0.54 instead of version 2.0.63. I tweaked my httpd.conf file, didn't make any difference. I'm running Fedora 2.6.11-1.1369_FC4. Any ideas where to look? Mark Depends upon how you installed it, rmp, yum? Were the previous versions installed the same way? You may have multiple binaries and the init scripts are pointing to the old ones. -Shawn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Static Member Overloading
Does anyone know if static member overloading was added in PHP 5.3? I noticed that static method overloading was (__callStatic). Thought I'd ask here before attempting to ask in the internals. Ex: __setStatic() __getStatic() __isset() __unset() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php