Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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