Jump to content

TCPDF and joining tables


tommy2shoes

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/235068-tcpdf-and-joining-tables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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