Jump to content

thomasw_lrd

Members
  • Posts

    71
  • Joined

  • Last visited

Posts posted by thomasw_lrd

  1. I've just run into a really weird error. I'm hoping someone can help. When I run the code with the $rs = myexecute($sql); line commented out, it prints

    INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies - Cardio POs (43).msg';

    INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies - Cardio POs (44).msg';

    INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies - Cardio POs (45).msg';

    INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies - Cardio POs.msg';

    INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies Account Receivable 4170.msg';

    INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI.msg';

     

    Which is offsets 0-5.

    When I uncomment that line I get this. Can anyone help? myexecute is a custom function for inserting data into our database. It handles all the error processing, and credentials.

     

    INSERT INTO tbl_full_text set ft_path = '../intranet/Documents/CPOA 2011/Account Receivable - (Don\'t Touch)/AR 1001-1100 Series/PMI -1 - AR-1001/RE PMI Technologies - Cardio POs (43).msg';

    Notice: Undefined offset: 1 in /var/www/portal.certifiedpreownedincome.com/www/app/test.php on line 16 Notice: Undefined offset: 1 in /var/www/portal.certifiedpreownedincome.com/www/app/test.php on line 17

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

     

    SELECT id, parent, name from folders where id = ;

     

    <?php
    include (dirname(__FILE__).'/../includes/menuhead.inc');
    include ('apptable_functions.inc');
    require('includes/html2text.php');
    //PHP Error Reporting
    ini_set('display_errors',1);
    error_reporting(-1);
    $sql = "SELECT filename, parent from files where filename like '%.msg';";
    $rs = myload($sql);
    $count = count($rs);
    echo $count; echo "<br>";
    for($i = 0; $i < 6; $i++){
    $path = $rs[$i]['filename'];
    $parent = "SELECT id, parent, name from folders where id = ".$rs[$i]['parent'].";";
    $parent_rs = myload($parent);
    $folder = $rs[$i]['parent'];
    do {
    $parent = "SELECT id, parent, name from folders where id = ".$folder.";";
    $parent_rs = myload($parent);
    $folder = $parent_rs[0]['parent'];
    $path = $parent_rs[0]['name'] ."/". $path;
    
    } while ($folder >= 1);
    $path = "../intranet/". $path;
    
    $fplog = fopen($path,'r');
    $string = fread($fplog, filesize($path));
    $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string);
    $string = addslashes($string);
    $path = addslashes($path);
    $sql = "INSERT INTO tbl_full_text set ft_path = '$path';";//, ft_data = '$string';";
    echo $sql; echo "<br>";
    //$rs = myexecute($sql);
    }
    

  2. You can only output one content-type per http request.

     

    For the http request for your web page, you cannot switch in the middle and try to download a vcard. You must put a link to the vcard that you want to be downloaded. If that vcard is dynamically created, the link would be to the .php script that creates the vcard. The .php script would retrieve the data from your database, output the correct content-type header, followed by the dynamically produced vcard data.

     

    The one thing that you could do to your current code that would allow the vcard download to work, would prevent the web page up to that point from being output, so it would be kind of pointless.

     

    That's exactly the solution I just thought of.  Thank you very much. 

  3. I'm trying to create a vcard from our database, but I keep running into headers already sent error.

     

    Warning: Cannot modify header information - headers already sent by (output started at  in  on line 102 Warning: Cannot modify header information - headers already sent by (output started at ) in  on line 103

     

    I understand why the error is occurring, but is there any way around it?  I want to create a downloadable vcard on the fly.  Any help would be appreciated.

     

     

  4. I did figure this out and have posted the solution for everyone's edification. 

     

    $objPHPExcel->getActiveSheet()->getStyle("A".($excel_row).":AJ".($excel_row))->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    [\code]
    
    I was confused how to use a variable in place of the row number.  You have to (duh!!!) use the proper dot notation.  

  5. I'm having a problem using PHPExcel.

     

    I'm trying to set row colors based on the status of a case in our system

     

    This code works, but it's inelegant, and basically sucks.  I also need to go all way out to column 35, but anything past column 17 gives me a corrupted excel file that can't be opened.  I've tried using a for loop, but the same problem exists.  I have roughly 1700 records that I need to export a spreadsheet. 

     

    I know that I need to go from A* to AJ* where * = row number, but I'm not sure how to do this dynamically.

     

    Any ideas? 

    $column++;
    $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($column, $excel_row, $row['pol_policy_status']);	
    if ($row['pol_policy_status'] == 'Closed')
    {
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(0, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(1, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(2, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(3, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(4, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(5, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(6, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(7, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(8, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(9, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(10, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(11, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(12, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(13, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(14, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(15, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(16, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    	$objPHPExcel->getActiveSheet()->getStyleByColumnAndRow(17, $excel_row)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setARGB('FF228B22');
    }//end the if $row = Closed
    

  6. I think this will work, since then I have a while loop, and an inner while loop to handle the files.  I'm gonna test it Monday morning.  I forgot to post the outer while loop in my original question. 

     

    Logic is a while loop to loop through all cases, an inner loop to loop through all files for a particular case.  So we will loop through, if a file does not exist, then we set $funding_book = False, so as long as we get one false, it should email the case manager, if we get no falses, then $funding_book = True, and we will email the compliance officer.  That makes logical sense to me, but I may be wrong. 

     

    //another while loop to select cases.
    $funding_book = True;
    //This is an inner while loop will loop through all files for all that cases that were selected in outer while loop
    
    while($files_names=mysql_fetch_array($files)) {
    
    	//Find files with SAA in the filename
    	if (!preg_match("/SAA/i", $files_names['name'])){
    			$funding_book = False;
    	}//end the SAA if statement
    
    	//Find files with CSP Seller in the filename
    	if !(preg_match("/CSP Seller/i", $files_names['name'])){
    	$funding_book = False
                    }   //end the CSP Seller if statement
    if ($funding_book = False) {
        //email case manager;
    }
    else 
    {
       //email compliance officer
    }
    
    
    } //end the files_names while loop
    
    } //end row while loop
    [\code]

  7. That is what I was looking for.  Thank you. 

     

    I also didn't how to handle not true preg_matches.  It's the ! in the front.  Again, thanks so much.

     

    And you are correct, I want to email the case manager which files are not there.  I was going to set up an array to handle that.

     

    I seem to have misplaced the solved button again? 

  8. I'm writing a script that will email our compliance officer if all the files have been uploaded for a case, but if the files are not uploaded, it will email the case manager to let them know that the files don't exist and they need to get them.

     

    The problem I am having is that I do not want to have 7 variables for each file.  I want one variable, and when it's false, send an email.  If it comes back true 7 times, then email compliance.  I've considered using an array, but I'm not sure how to check if all the values are true.  I've considered using switch or do-while loops to handle it.  Any thoughts or suggestions are much appreciated. 

     

    Here is what I have so far, and of course the if statements won't handle it, because if the last file is there, then the variable will be set to true.  I also can't exit out of the $files_names while loop, because we will have multiple cases that need to be checked.

     

    //This while loop will loop through all files for all that cases that were selected in 
    while($files_names=mysql_fetch_array($files)) {
    
    	//Find files with SAA in the filename
    	if (preg_match("/SAA/i", $files_names['name'])){
    			$funding_book = True;
    	} else {
    			$funding_book = False;
    	}//end the SAA if statement
    
    	//Find files with CSP Seller in the filename
    	if (preg_match("/CSP Seller/i", $files_names['name'])){
    		//echo "CSP Seller: "; echo $files_names['name']; echo "<br>";
    		$funding_book = True;
    		//echo "New Value: "; echo $funding_book; echo "<br>";
    	} else {
    		$funding_book = False;	
    	}//end the CSP Seller if statement
    
    	//Find files with STA POA in the filename
    	if (preg_match("/STA POA/i", $files_names['name'])){
    			echo "STA POA Seller: "; echo $files_names['name']; echo "<br>";
    			$funding_book = True;
    			echo "New Value: "; echo $funding_book; echo "<br>";
    	} else {
    		$funding_book = False;	
    	} //end the STA POA if statement
    
    } //end the files_names while loop
    
    } //end row while loop
    

  9. I'm curious on this topic myself.  As I've said in a previous post, our database/php program is being handed over to my former boss, since it's his IP, but the company I work for actually paid for all the developement costs.  We get to keep one "license" for our use, but we need two copies, one for production and one for development.  I was planning on keeping the backend database, and copying the code to a new domain for testing.  But is this legal? 

     

    IANAL, but personally, I think you can use the database, and stop paying for the licensing if you wrote you're own front end.  You might want to add some delimiter to the field names though, just in case. 

  10. I've been using an open source program to  store documents on our server (OWl intranet).

     

    $sql->query("INSERT INTO $default->owl_files_table (name,filename,f_size,creatorid, updatorid,parent,created, description,metadata,security,groupid,smodified,checked_out, major_revision, minor_revision, url, doctype, approved, expires) values ('$title', '" . addslashes(stripslashes($userfile)) . "', '0', '$userid', '$userid', '$parent', $dCreateDate,'$description', '$metadata', '$security', '$groupid',$smodified,'$checked_out','$major_revision','$minor_revision','1','$doctype','1', '$expires')");
             $id = $sql->insert_id($default->owl_files_table, 'id'); 
    

     

    I need to know how to extract the filename from this code?  Does anybody have any ideas?  Like I said, I'm sure this is not the correct place to ask this, but I was hoping someone may be able to help.

  11. I work for a company in Sydney. We develop administration software for schools.

     

    I assume you mean Australia?  I live in the USA, and would love to move to Australia. 

     

    I'm the only member of our dev team :) work for a small startup in the finance industry.  So we don't really have any process in place.  It's just code, release, fix problems as they come in, and try to keep too many things from piling up on my plate. 

  12. Hi all,

     

    I currently have a webapp written using php with a mysql backend.  It's a huge project, and I came in on the tail end of it.  It works great, but my problem now is, that we had two owners of the company I work for.  Well long story short they are splitting apart because of bad mojo.  They both want ownership of the project and only one is going to keep it.  Ive been tasked with possibly rewriting the system from scratch.  What would be the best framework to use to take the least amount of time?  CakePhp, Zend Framework, something else? 

     

     

    Thanks in advance.

  13. I've actually started a database where I keep track of everything we buy, the price, the quanity, and forth, and our income.  I even keep track of sales tax.  I haven't gotten around to writing any code for it though.  It's nice to be able to run querys that say we've made $xx,xxx this year, and we've spend $x,xxxx on wal-mart, $x,xxx on sales tax. 

     

    What I'd like to be able to do is have an app that I could scan the bar code on a product, store it in a database.  If the code exists, then I can just enter the price, if not, then I could enter the product details. 

  14. Thanks I knew it was a stupid error on my part.

     

    I had actually tried

     

    
    "select * from ". $fields $operator '$criteria';
    
    

     

    But that didn't work, and I didn't think of trying any other variations of that. 

  15. I've got a select statement that looks like this in php.

    $sql = "Select * from inventory where ".$fields."".$operator."".$criteria;
    

    Everything posts correctly, everything is dereferenced correctly.    My only question is how do I get $criteria have single quotes around it?

     

    So that when I actually run the query it says

     

    select * from inventory where field = 'value';

     

     

    I've tried

    $sql = "Select * from inventory where ".$fields."".$operator.""'.$criteria';
    
    $sql = "Select * from inventory where ".$fields."".$operator.""'$criteria';
    

    and a bunch of variations like that. 

     

    Thanks for you help.

     

     

  16. We are in the process of fighting this right now at the company I work for.  I'll let you know how it all works out in the end.

     

    The main gist of the argument is, the former owner came up with the idea, while the company spent the money to make the idea possible.  So who owns our software? 

     

    It gets really complicated though.  Before I was hired they had a contractor work on the project, he copyrighted all the code to his name.  So now who owns it?  Luckily, the contractor isn't trying to apply any rights, since we paid him for the work.  But who really owns the software?  The company, the former owner, the writer of the software, me? 

×
×
  • 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.