Jump to content

rhodesa

Staff Alumni
  • Content Count

    5,253
  • Joined

  • Last visited

Community Reputation

0 Neutral

About rhodesa

  • Rank
    Prolific Member
  • Birthday 09/27/1983

Contact Methods

  • Website URL
    http://vectorloft.com

Profile Information

  • Gender
    Male
  • Location
    Boston, MA
  1. Also be aware, for this to work, the HTML content needs to be 100% valid. The majority of webpages on the internet are NOT valid HTML.
  2. If you have logins, I assume you have a database to track meta data about the user? Aka username, password, etc. Just add a new column for logins, and each time the login, increase the number.
  3. exec ('' . $php_path . ' -c ' . $config_ini . ' ' . $mrr_p .' ' . $pass_id . ' ' . $file_uid . ' ' . $status . ' >C:\1.txt 2>&1 &'); you can't send processes to the background with & on windows
  4. a tip for those reading this thread. if the amount of data you pass via arguments gets long, or is dynamic, this is the method i sometimes use: Parent Script -Put all data into an array -Serialize the array -Store serialized array into environmental variable with putenv() Child Script -Read value in environmental variable with getenv() -Unserialize -Use it! this will also keep the arguments from being stored in any shell history files (in case there is any sensitive information)
  5. at the end of your checkAll function, call the new function: function checkAll ( ) { //Here is the code to check all of them countCheckboxes(); }
  6. works fine for me in FF: <html> <head> <script type="text/javascript"> function countCheckboxes ( ) { var form = document.getElementById('testForm'); var count = 0; for(var n=0;n < form.length;n++){ if(form[n].name.substr(0,7) == 'chkbox_' && form[n].checked){ count++; } } document.getElementById('checkCount').innerHTML = count; } window.onload = countCheckboxes; </script> </head> <body> <form name="testForm" id="testForm"> <input type="checkbox" name="chkbox_1" onclick="countCheckboxes()" /> A<br /> <input type="checkbox" name="chkbox_2" onclick="countCheckboxes()" /> B<br /> <input type="checkbox" name="chkbox_3" onclick="countCheckboxes()" /> C<br /> <input type="checkbox" name="chkbox_4" onclick="countCheckboxes()" /> D<br /> <input type="checkbox" name="chkbox_5" onclick="countCheckboxes()" /> E<br /> <input type="checkbox" name="chkbox_6" onclick="countCheckboxes()" /> F<br /> <input type="checkbox" name="chkbox_7" onclick="countCheckboxes()" /> G<br /> <span id="checkCount"></span> </form> </body> </html>
  7. <html> <head> <script type="text/javascript"> function countCheckboxes ( ) { var form = document.getElementById('testForm'); var count = 0; for(var n=0;n < form.length;n++){ if(form[n].name == 'items[]' && form[n].checked){ count++; } } document.getElementById('checkCount').innerHTML = count; } window.onload = countCheckboxes; </script> </head> <body> <form name="testForm" id="testForm"> <input type="checkbox" name="items[]" value="a" onclick="countCheckboxes()" /> A<br /> <input type="checkbox" name="items[]" value="b" onclick="countCheckboxes()" /> B<br /> <input type="checkbox" name="items[]" value="c" onclick="countCheckboxes()" /> C<br /> <input type="checkbox" name="items[]" value="d" onclick="countCheckboxes()" /> D<br /> <input type="checkbox" name="items[]" value="e" onclick="countCheckboxes()" /> E<br /> <input type="checkbox" name="items[]" value="f" onclick="countCheckboxes()" /> F<br /> <input type="checkbox" name="items[]" value="g" onclick="countCheckboxes()" /> G<br /> <span id="checkCount"></span> </form> </body> </html>
  8. Well...the code you post looks fine, so it has to be something in the rest of your code. You'll need to post more of the code if you want me to try and find the problem.
  9. Also, just to make sure the problem is in your code and not your computer, click this link and tell me if it opens ok: http://vectorloft.com/aaron/phpfreaks/test.php
  10. But my concern is that something is being printed before this code. In the ExcelWriter class, update these lines: function send($filename = null){ if(headers_sent()) die("Headers already sent"); //Add this line if($filename){ header ( "Expires: Mon, 1 Apr 1974 05:00:00 GMT" );
  11. Is anything else getting echoed/printed? Because the excel can be the only thing sending stuff. Can you post some of your code?
  12. Add piece by piece to find your problem. First comment out the $excel->writeLine($myArr); inside the while loop and make sure that opens with just the headers then uncomment the above line and start with $myArr=array($id); in the while loop, testing and adding each column 1 by 1 then, let me know where it breaks
  13. Are you using the updated class that I posted? Here is the link again: http://www.phpfreaks.com/forums/index.php?action=dlattach;topic=180789.0;attach=3752
  14. Nope...don't do that...the version I posted is different... If you were more careful with your indenting, you would notice that echo is INSIDE the while loop: while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ .... $myArr=array($id,$product,$company,$description,$web,$last,$used,$active); $excel->writeLine($myArr); $excel->close(); echo "data is write into hr.xls Successfully."; } we don't want close() (no longer needed with my updated copy of ExcelWriter) and we don't want the echo, because the send() can be the only thing displaying output. Use this: <?php include "../includes/db_login.php"; include("../excel/excelwriter.inc.php"); $excel=new ExcelWriter(); $myArr=array("Id","Product","Company","Description","Web Address","Last Used","Where product was last use","Is product active or inactive?"); $excel->writeLine($myArr); $query = "SELECT * FROM $tablename"; $result = mysql_query($query); if(!$result){ die("Could not query the database: <br/>" . mysql_error()); } while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $id = $row['rowid']; $company = $row['company']; $product = $row['product']; $description = $row['description']; $web = $row['web']; $last = $row['last']; $used = $row['used']; $active = $row['active']; $myArr=array($id,$product,$company,$description,$web,$last,$used,$active); $excel->writeLine($myArr); } $excel->send('hr'); exit; ?>
  15. well...from a DB you would just do: <?php include("db.php"); //Connect to MySQL DB include("excelWriter.inc.php"); $excel=new ExcelWriter(); //Add Column Headers $excel->writeLine(array("FIELD 1","FIELD 2","FIELD 3")); //Add rows from Database $sql = "SELECT `field1`,`field2`,`field3` FROM `table` WHERE `type` = 'test'"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_array($result)){ //Feel free to manipulate the values here //Add row to excel $excel->writeLine(array($row['field1'],$row['field2'],$row['field3'])); } //Send file to browser $excel->send('filename'); //Automatically adds .xls ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.