Jump to content

tommy2shoes

Members
  • Posts

    28
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tommy2shoes's Achievements

Member

Member (2/5)

0

Reputation

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