Jump to content

tommy2shoes

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Everything posted by tommy2shoes

  1. Hi I have a site which I am developing on a mac using php/mysql and it all looks fine to me. When I upload it most of the pages are fine but in some cases they appear to lose much of the css. In particular this is true in two sections which require a login to access. The general view is a centered content section but in the pages which go wrong they are left aligned. However, a simple refresh of the page realigns it correctly. Not all pages do it. The index page is one which does and I have tried simply renaming a page that works (eg contacts.php) to index.php and it still fails. I'm at a loss as to what to try. Any suggestions?
  2. Hi I am producing a letter using tcpdf and now want to insert an image version of my signature. (The letter generation minus the signature works fine.) First of all I generate some fields from the mysql database and then put them into the code and generate the pdf. I have pasted the relevant part of the code below. What I need to do is to add the signature image where it says [iNSERT DIGITAL COPY OF SIGNATURE]. I've tried various things but it doesn't seem to work. Can anyone help please? Many thanks $htmlcontent = "<html> <br><br><br><br>$printdate<br><br> <u>To whom it may concern</u><br><br><br> $company <br><br> This letter is to confirm that Appointments Ltd has agreed to act as agent for $company in connection with the documents listed in the schedule hereto for $term years from the date of this letter.<br><br> <br><br><br> [iNSERT DIGITAL COPY OF SIGNATURE]<br><br> For and on behalf of<br> Appointments Ltd<br><br><br pagebreak=\"true\" /> <div style=\"text-align:center\"><strong>SCHEDULE</strong></div> <div style=\"text-align:center\">Parties<span style=\"text-align:justify;\"><br><br> "; while($row = mysql_fetch_array($result3)) { $htmlcontent .= $row['doctitle']."<br />".$row['partylist']."<br /><br />"; } // create new PDF document $pdf = new myPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetPrintHeader(false); // $pdf->SetPrintFooter(false); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings $pdf->setLanguageArray($l); // --------------------------------------------------------- // set font $pdf->SetFont('dejavusans', '', 10); // add a page $pdf->AddPage(); // create some HTML content // set JPEG quality $pdf->setJPEGQuality(100); $pdf->Image('logonew.jpg', 70, 5, 73, 20, '', '', '', true, 100); // output the HTML content $pdf->writeHTML($htmlcontent, true, 0, true, 0, ''); // $pdf->writeHTML($html, true, false, true, false, ''); // $pdf->writeHTML($inlinecss, true, 0, true, 0); // reset pointer to the last page // $pdf->lastPage(); //Close and output PDF document // $pdf->Output('example_006.pdf', 'I'); $directory = '../docs/'; $docname = 'Letter_of_Confirmation_' . $appidpassed . '.pdf'; $path=$directory.$docname; $pdf->Output($path, 'F');
  3. Sorry, if it isn't clear, I want to know how to get all documents associated with a specific idcode, and its linked parties, printed out in a pdf using TCPDF and with the tables and fields as described in the first part. I can only get one printed.
  4. I want to produce a pdf document using mysql and TCPDF. I can do this OK in some circumstances but I now have a problem. I have two tables - documents and parties - they are linked by a common field docid. I have for table documents, the fields: docid, doctitle, idcode and for the parties table: partyid, docid, party (the field party is the name of the party) For any document there could be any number of parties and for a single idcode there could be any number of documents. For example, for idcode = 12345 there might be 2 documents called doctitle 1 and doctitle 2. For doctitle 1 there are 3 parties to it party1, party 2 and party 3. For doctitle 2 there are two parties - party4 and party 5. For any idcode (which is passed through by the url) I want the pdf to give a list such as: Doctitle 1: party name 1 party name 2 party name 3 Doctitle 2: party name 4 party name 5 Part of my code is: mysql_select_db($database_process, $process); $result2 = mysql_query("SELECT parties.docid, GROUP_CONCAT(party SEPARATOR '<br>') AS partylist, documents.doctitle FROM parties INNER JOIN documents ON parties.docid=documents.docid WHERE parties.idcode = '$appidpassed' GROUP BY parties.docid LIMIT 1 ") or die(mysql_error()); while($row = mysql_fetch_array($result2)) { $doctitle = $row['doctitle']; $parties = $row['partylist']; } and then further down the page: $doctitle<br> $parties This only gives one document and the parties associated with it. I know the solution is probably easy but I can't see it. Does anyone have any ideas?
  5. I have produced pdfs before using TCPDF but they have all used results from 1 table. Now I want to get data from two tables - applicant and finance which are linked by the applicantid field. Part of the code is: mysql_select_db($database_process, $process); $result = mysql_query("SELECT applicantid, idcode, type, company, email, concat_ws('<br/>',case when coalesce(add1,'')>''then add1 end,case when coalesce(add2,'')>''then add2 end, case when coalesce(town,'')>''then town end,case when coalesce(postcode,'')>'' then postcode end) as address, DATE_FORMAT(applicationdate,'%D %M %Y') AS fDate, CONCAT(forename,' ',surname) AS name FROM applicant INNER JOIN finance ON finance.applicantid=applicant.applicantid WHERE idcode = '$appidpassed' LIMIT 1 "); while($row = mysql_fetch_array($result)) { $appid = $row['applicantid']; $idcode = $row['idcode']; $type = $row['type']; $company = $row['company']; $email = $row['email']; $address = $row['address']; $printdate = $row['fDate']; $apname = $row['name']; } But when I run this I get an error something like: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in --- .php on line 68 Line 68 is the line while($row = mysql_fetch_array($result)) What am I doing wrong?
  6. Hi I am having problems trying to view some data and wondered if anyone could help. I have a table called 'parties' which contains fields - partyid, docid and party. There is another table called 'documents' which has fields - docid and doctitle. I have a number of documents and for each document there are a number of parties - ie people linked to that document. What I would like to do is get a view on screen (and also printed out) that has the title of the document followed by a list of the parties associated with that document. For example, if in the documents table there was: |docid |doctitle | |1 |first document | |2 |second document| and in the parties table there was: |partyid |docid |party | |1 |1 |Fred | |2 |1 |Jim | |3 |1 |Jane | |4 |2 |Peter | |5 |2 |Fred | I could get a view that looked like: First document: Fred Jim Jane Second document: Peter Fred I suspect it may involve arrays but I have never used them so any guidance would be very welcome. Thanks
  7. So simple!! Very many thanks - that worked fine.
  8. Hi I am sure this is very simple but it's got me beat! I have a page that sends emails to people with their account details. I can get it to work fine with straight plain text but would like it in HTML and I can't get the username and password details into the body of the email. I'm sure it's just a formatting issue but I've tried many things and it fails!! Any suggestions very welcome. The code is below. Many thanks in advance. <?php // MAIL TO AP require_once '../phpmailer/class.phpmailer.php'; $mail = new PHPMailer(); if(isset($_GET['idcode'])){ $idcodepassed = $_GET['idcode']; }else{ $idcodepassed = 111111; // set this to your default value if no URL value is present } mysql_select_db($database_process, $process); $result = mysql_query("SELECT applicantid, idcode, type, company, email, CONCAT('pdf_document_',idcode) AS linkname, length, username, password, DATE_FORMAT(applicationdate,'%D %M %Y') AS formattedDate, parties FROM applicant WHERE idcode = '$idcodepassed' LIMIT 1 "); while($row = mysql_fetch_array($result)) { $appid = $row['applicantid']; $idcode = $row['idcode']; $type = $row['type']; $company = $row['company']; $email = $row['email']; $term = $row['length']; $username = $row['username']; $password = $row['password']; $appdate = $row['formattedDate']; $parties = $row['parties']; } // $body = file_get_contents('EmailTextAP.php'); // $body = eregi_replace("[\]",'',$body); $body = '<html><p>This email TO AP is confirmation of your appointment of Clear Appointments as your agent for service of process under the agreement between $parties. Our appointment starts on $appdate and you have appointed us for $term years from this date. We have attached our letter of confirmation to this email for your records.</p> <p>You can log into your account on our website (<a href=\"http://www.clearappointments.co.uk\">www.clearappointments.co.uk</a>) at any time to review your documents and change your contact details. Your user name is:??? and your password is ???.</p> <p>We appreciate your custom and hope that you will use us again.</p> <p>Kind regards</p> <p>Clear Appointments Team<br /> '; $mail->SetFrom('confirmation@clearappointments.co.uk', 'Clear Appointments'); $mail->AddReplyTo('confirmation@clearappointments.co.uk', 'Clear Appointments'); // set the subject of the email $mail->Subject = "Process Agent Letter of Confirmation Attached"; @MYSQL_CONNECT("localhost","lawwork1_graham","733576"); @mysql_select_db("lawwork1_process"); $query = "SELECT company, email FROM applicant WHERE idcode='$idcodepassed'"; $result = @MYSQL_QUERY($query); // sets name and location of attachment $directory = '../docs/'; $docname = 'Confirmation_Letter_'. $idcodepassed . '.pdf'; $invname = 'Invoice_' . $idcodepassed . '.pdf'; $send=$directory.$docname; $sendinvoice=$directory.$invname; while ($row = mysql_fetch_array ($result)) { $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $mail->AddAddress($row["email"]); // $mail->AddAddress($row["instemail"]); // attachment // $mail->AddAttachment($send); // $mail->AddAttachment($sendinvoice); $mail->AddAttachment($send); // attachment // $mail->AddAttachment($sendinvoice); // attachment if(!$mail->Send()) { echo "Mailer Error (" . str_replace("@", "&#64;", $row["email"]) . ') ' . $mail->ErrorInfo . '<br>'; } else { echo ""; // echo "Message sent to :" . $row["full_name"] . ' (' . str_replace("@", "&#64;", $row["email"]) . ')<br>'; } // Clear all addresses and attachments for next loop $mail->ClearAddresses(); $mail->ClearAttachments(); } ?>
  9. That worked great - very many thanks for the ideas.
  10. Thank you but I get an error - Undefined variable: html_center on line 45 Line 45 is: $html_center .= $row['id']."<br>".$row['name']."<br>".$row['date']."<br>\n<hr>\n"; This part of my code is: $result = mysql_query("SELECT id, date, name FROM events WHERE id>200 "); while($row = mysql_fetch_array($result)) { $html_center .= $row['id']."<br>".$row['name']."<br>".$row['date']."<br>\n<hr>\n"; } // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  11. Hi I am trying to work out how to add a loop statement to my pdf generation (I think that's what I need). I have a mysql table - events with 3 fields - id, name and date. In my php page which is to generate the pdf I have: mysql_select_db($database_events, $events); $result = mysql_query("SELECT id, date, name FROM events_pbw WHERE id>200 "); while($row = mysql_fetch_array($result)) { $id = $row['id']; $date = $row['date']; $name = $row['name']; } and in amongst the $html part of the page I have: $html ="<html> $id<br> $name<br> $date<br> <i>This is a test calendar.</i> This all works fine but (obviously) just gives one result. What do I need to add to make it list out all of the possible events? Many thanks in advance.
  12. Sorry - didn't make it very clear. I have a section in the pdf generation part which is: $id<br> $name<br> $date<br> This only shows up once in the pdf and I want it to repeat to show all relevant values. How do I do that?
  13. Hi I have used TCPDF to generate documents with single values from a mysql table. Now I want to generate a calendar. I have a table events_pbw which contains (amongst others) the fields id, date and name. I would like to generate a pdf which lists all of the results for entries after a particular date (eg Jan 1st) I have this: // get data from events_pbw table $result = mysql_query("SELECT id, date, name FROM events_pbw WHERE `date` > 2011-01-01" "); while($row = mysql_fetch_array($result)) { $appid = $row['id']; $date = $row['date']; $name = $row['name']; } But I don't know how to get the full list of results into the pdf. I'm sure this is very easy but I'm not great on php coding! Does anyone have any examples or help they could give me? Many thanks
  14. Hi I have a table (applicant) that has a number of fields but included are: applicantid party1 party2 party3 party4 party5 Any number of these party entries could have data in them but I need to know, for any specific applicantid, the count of how many non null entries there are. I can't find a way to do it. Does anyone have any ideas. Many thanks
  15. Thank you. I can't see anything wrong either. I've tried removing the width and that makes no difference. If I change the ' to " I get an error - Parse error: syntax error, unexpected T_LNUMBER. (Am using Dreamweaver for this) Hence I'm a bit stuck. Thanks anyway.
  16. I am trying to get a table using tcpdf which will act as an invoice. Whatever I seem to change the column widths seem to stay the same and look equally divided across the table. I'm sure the fix is simple but I've no idea what it is. Any ideas? Part of the code is: $apname <br> $address<br><br> Your ref: $matter<br> Your vat number: $vat<br><br><br> <table width='800' border='0'> <tr> <td width='232'>PRODUCT/SERVICE</td> <td width='400'>DESCRIPTION</td> <td width='75'>UNIT PRICE (£)</td> <td width='75'>LINE TOTAL (£)</td> </tr> <tr> <td>Process Agent Appointment</td> <td>Letter of Confirmation $idcode</td> <td width='75'>500 (£)</td> <td width='75'>500 (£)</td> </tr> </table> "; // output the HTML content $pdf->writeHTML($htmlcontent, true, false, false, false, '');
  17. Hi I am trying to add an image to a pdf file created using tcpdf. Part of the code I have to date is: $pdf->AddPage(); // create some HTML content $htmlcontent = "<html> <strong>THIS IS AN EXAMPLE TITLE<br></strong> <p> This just some straight text that I've added to see what happens This just some straight text that I've added to see what happens This just some straight text that I've added to see what happens This just some straight text that I've added to see what happens This just some straight text that I've added to see what happens </p> <ol> <li>This is some example text for testing. <br> </li> <li>This is some example text for testing.</li> </ol> "; // output the HTML content $pdf->writeHTML($htmlcontent, true, 0, true, 0, ''); I have a logo which is in a folder and can be found at ../img/logo.png What I would like to do is have the image in the centre of the page before all of the text but whatever I've tried has failed. Any suggestions/answers would be much appreciated. Also I've failed at centering the title - any ideas on that. Many thanks.
  18. Many thanks - I'll give this a go.
  19. Thank you - but what about getting an 'and' between the last two? I use a concatenation to get an address from a different query: concat_ws(',',case when coalesce(add1,'')>''then add1 end,case when coalesce(add2,'')>''then add2 end,case when coalesce(add3,'')>''then add3 end,case when coalesce(town,'')>''then town end,case when coalesce(postcode,'')>'' then postcode end) as address which (modified) would work with this party issue except for the 'and'. That's what I'm stuck on.
  20. I have a table (applicants) which has a number of fields including 5 for potential 'parties' - these are party1, party2, party3, party4 and party5. Any particular applicant will always have two parties but could have any number up to 5. I need to export a pdf (which I can do) but I need it to include data drawn from the applicants table in the format: party1, party2 and party3 OR party1 and party2 etc that is, each party has a comma after it except the last but one, which has no comma but an 'and'. (I hope this is clear enough!) I can't work out how to do this for a varying number of 'parties'. Any suggestions/answers gratefully received.
  21. I have a table called parties with 3 fields - partyid, partyname, linkid. For any linkid there will be a number of parties somewhere between 2 and 10. I can get a vertical list but have a couple of issues which I can't fix: I want to have a page that displays the list of partynames (alphabetically) horizontally rather than vertically within a piece of text. For example, "The parties linked to you are Party1, Party2, Party3" Also, ideally, I would like the word 'and' before the last Party name so, using the above example, I would get "The parties linked to you are Party1, Party2 and Party3" I have no idea how to do this or if it can be done. Any ideas would be VERY gratefully received. Thanks
  22. Is there a way of getting today's date (in European format - day-month-year) into the body of an email sent via phpmailer? Many thanks.
  23. Hi I use Dreamweaver to do a lot of my work on a php/mysql database. I have two tables - applications and contacts and they are linked by the id appid. When I view a page with all of the application and contact details the url contains the appid as a number at the end (eg .../Summary.php?appid=639) When I want to edit one of the contacts I go to the edit page but this is identified by a contact id so that url looks like: ../EditContact.php?contactid=32 When I update the contact's details I would like to return to the summary page but can't as the url gets muddled between the two different ids so I end up at a page with no info on it. How can I get round this? I'm sorry my explanation isn't very clear but any help is much appreciated.
  24. That's great - thank you. Also, if I want to save the pdf to a location rather than see it in the browser (for example to a folder called documents) how do I amend the Output line? Once again, many thanks. Graham
  25. Hi I have a table (applicant) and I am looking at producing a pdf displaying various items of data from this table. I have succeeded in getting the look I want but in my query I use a fixed applicantid (in this case an id of 4). What I want to be able to do is to have the id cary according to the url. In other words, when someone comes from one web page to this one and the url is of the format .../pdf_production.php?applicantid=42. I'm not sure I've explained that very well but I hope someone can help - I think this is the last thing I need to sort out. Many thanks in advance. The code I have so far is: <?php require_once('../Connections/process.php'); ?> <?php require_once('../tcpdf/config/lang/eng.php'); require_once('../tcpdf/tcpdf.php'); // get data from users table mysql_select_db($database_process, $process); $result = mysql_query("SELECT * FROM applicant WHERE applicantid = '4'"); while($row = mysql_fetch_array($result)) { $appid = $row['applicantid']; $idcode = $row['idcode']; $type = $row['type']; $company = $row['company']; $email = $row['email']; } // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetPrintHeader(false); $pdf->SetPrintFooter(false); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings $pdf->setLanguageArray($l); // --------------------------------------------------------- // set font $pdf->SetFont('dejavusans', '', 10); // add a page $pdf->AddPage(); // create some HTML content $txt = <<<EOD Below are the details I require Company type: $type Company Name: $company Company email: $email EOD; // output the HTML content // $pdf->writeHTML($htmlcontent, true, 0, true, 0); $pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0); // $pdf->writeHTML($inlinecss, true, 0, true, 0); // reset pointer to the last page // $pdf->lastPage(); //Close and output PDF document $pdf->Output('example_006.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+ ?>
×
×
  • 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.