Jump to content

AndyB

Staff Alumni
  • Posts

    5,465
  • Joined

  • Last visited

    Never

Posts posted by AndyB

  1. This works for me:

     

    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=$filename");
    header("Content-Transfer-Encoding: binary");
    if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')){
        // IE cannot download from sessions without a cache
        header('Cache-Control: public');
    }
    echo $tsv;

  2. I suppose the 'best' way is something that's rational with sensibly-named folders.

     

    I usually have something like

    . images (sometimes subfolders here depending on usage)

    . support (for css, js files and db-conn file)

    . includes (for files to be included)

    . downloads (if applicable)

    . admin (htpassword protected)

     

  3. 350 lines of code - sorry, I'm not going to go through that looking for your solution.

     

    Add error trapping, remove error suppression, use some echo statements to track progress of the script, test smaller sections ... etc.

  4.  

    output like that select * from patient where pt_name=laura AND pt_surname=

    surname is blank...

     

    Then we now know that $surname is not being retrieved from the POSTed data.  Maybe surname is not the field name in your form; maybe there's an error in your form post array retrieval code; maybe ... Who knows?

  5. I'll try again.

     

    change

    $query = "select * from patient where pt_name like '%".$name."%' AND pt_surname like '%".$surname."%' ";  
    Print "<table border cellpadding=1>";
    $data = mysql_query($query); 

     

    to

    $query = "select * from patient where pt_name like '%".$name."%' AND pt_surname like '%".$surname."%' ";  
    echo $query; // new line
    Print "<table border cellpadding=1>";
    $data = mysql_query($query) or die("Error ". mysql_error(). " with query ". $query); // modified line 

     

    Post EXACTLY what the echo $query line generates. Post EXACTLY the full error message that's generated.

  6. Whats the point in that?

     

    It will just make programming take allot longer.. :S

     

    Taking a little longer to get code that works seems like a reasonable concept ... unless your objective is to write code that doesn't work and save time.

  7. 'page shows nothing' - do you mean you see a completely blank screen or that you see the expected output but with no data/results displayed?

     

    If a querystring isn't returning what you expect, add a line to echo the query to see exactly what it says - which may not be what you think it should be.

     

    And HTTP_POST_VARS is deprecated. Use $_POST['varname'] instead.

  8. change

    $data = mysql_query($query); 

     

    to

    $data = mysql_query($query) or die("Error ". mysql_error(). " with query ". $query); 

     

    If the fix to your problem isn't then obvious, post the error message here.

     

    Presumably, elsewhere in your code ahead of the query you make the database connection and select the database ...

  9. In my opinion that is a business decision. I have worked on projects where JS was a necessity in order to deliver the functionality necessary. It is up to the stakeholders to determine if whatever functionality currently exists through JS is important enough that the site may exclude a small number of visitors ...

     

    approximately 93%-95% of browsers used have JS enabled.

     

    With a site for a Pizza chain, I don't see any reason that JS would need to be required though.

     

    Let's take all that at face value, then rearrange and paraphrase it.

     

    If we could make a change that increased sales by 5-7% would that be a good business decision?

  10. Posting the php code that results in an html page that has validation errors isn't really helpful.

     

    Posting html code with validation errors makes more sense because then we can SEE the code that doesn't validate.  By the way, the whole code is needed, not just a few lines here and there.

     

    There's usually no mystery to this once you study the generated code and look at the validation errors that are displayed.

  11. Ah. Is the database field type for report text?  That will support 65,000 characters.

     

    When you retrieve it and want the 'paragraph' breaks to be shown, use the nl2br() function when echoing the database field contents.

  12. Depends on what you mean.

     

    Restricting the input is one way - use maxlength=whatever in a text input

     

    Echoing a sub-string of what's in your database is another.

     

    If you could explain better what you're trying to achieve, you're likely to get more/better responses.

  13. You don't need a 'printable template'.  The whole point is that defining two different style definitions solves the whole problem.

     

    What you actually need is TWO css files - one for normal view and the other for print. BOTH are loaded within the normal template/page. The print version ONLY applies to print views.

  14. No. You will need to create a new template that will show less detail of the page. Or your own function which strips all the detail and just leaves you with the important stuff which you need to print. This isn't as simple as it sounds, so the best idea is to just create a print template.

     

    Sorry, but that's totally incorrect.

     

    The correct answer is http://www.phpfreaks.com/forums/index.php/topic,198174.msg894658.html#msg894658

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