Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: pdf file..anybody can help me?

  1. #11
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    I think you need to extract only those record or records based on a particular date.

    It is mainly depends upon the SELECT statement you used and the date data type you have used in your table.

    Sometime your database date format is not compatible with the date format used in your table.

    suppose if you've got a date from the user from a form for example: 26-Sep-2006

    Then using the following code I can convert the above mentioned date to a format that supported by MySQL

    PHP Code:
    date("Y-m-d",strtotime("26-Sep-2006")); 
    The o/p would be - 2006-09-26 which is the date format of MySQL

  2. #12
    Join Date
    Sep 2006
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need help..plz...

    plz...help me..i've successfully done with the pdf file...but i still got one problem..which is...i cannot break the record into several page...using the code it display all the total record so..the page being truncated...coula anyone help me...

    this is my code...for the page...

    <?php

    error_reporting(E_ALL);

    include('class.ezpdf.php');

    // $pdf =& new Cezpdf();
    $pdf =& new Cezpdf('A4','Landscape');
    $pdf->selectFont('./fonts/Helvetica');
    $pdf->setEncryption('','rc',array('print'));
    $page=$pdf->ezStartPageNumbers(560,85,8,'','',1);
    $pdf->addText(60,550,10,'Issues : ');
    $pdf->addText(100,550,10,$issue);
    //--------------------------------------------------

    $host = ' localhost';
    $user = 'root';
    $password = ' ';
    $database = 'e-account2';
    $query = "select usr_cc, call_name, rec_time, rec_date, call_no, company, issue, comments from comments WHERE issue='$issue' ORDER BY rec_date";
    //--------------------------------------------------

    // open the connection to the db server
    $link = mysql_connect($host,$user,$password);
    // change to the right database
    mysql_select_db($database);
    // initialize the array
    $data = array();
    // do the SQL query
    $result = mysql_query($query);
    $noRows = mysql_num_rows($result);
    // step through the result set, populating the array, note that this could also have been written:
    // while($data[] = mysql_fetch_assoc($result)) {}

    while($data[] = mysql_fetch_array($result, MYSQL_ASSOC)) {}
    // make the table
    $pdf->ezColumnsStart(array('num'=>2,'gap'=>10));
    // $pdf->ezTable($data);
    $pdf->ezTable($data,array('usr_cc'=>'Agent','rec_date'=>'Date','rec_time'=>'Time','call_name'=>'Caller Name','call_no'=>'Phone','company'=>'Company','comments'=>'Comments'),'Report based on Issues',
    array('xPos'=>430,'xOrientation'=>'center','width'=>750));

    // do the output, this standard testing output code, adding ?d=1
    // to the url puts the pdf code to the screen in raw form, good for checking
    // for parse errors before try to generate the pdf file.
    if (isset($d) && $d){
    $pdfcode = $pdf->output(1);
    $pdfcode = str_replace("\n","\n<br>",htmlspecialchars($pdfcode));
    echo '<html><body>';
    echo trim($pdfcode);
    echo '</body></html>';
    } else {
    $pdf->stream();
    }
    ?>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •