Jump to content
TNG Community

SQL error inside PHP


Michael T. Jones

Recommended Posts

Michael T. Jones

I'm working on tweaking @Bill Herndon's Citation Master mod to incorporate the repository table website address field. I did contact him recently, but I'm thinking he is away from TNG at the moment as I haven't heard back. I can create an SQL query in phpmyadmin that shows the information I'm looking for, but in the Citation Master mod, it looks like the SQL is buried in some PHP functions and I get the following error:

Query: SELECT sourceID, title, reponame, tng_sources.repoID as repoID, www, tng_repositories.addressID as addressID FROM tng_sources LEFT JOIN tng_repositories ON tng_sources.repoID = tng_repositories.repoID LEFT JOIN ON tng_repositories.addressID = .addressID AND tng_sources.gedcom = tng_repositories.gedcom WHERE tng_sources.sourceID = "S1" AND tng_sources.gedcom = "Jones"

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON tng_repositories.addressID = .addressID AND tng_sources.gedc' at line 8

For some reason, it is dropping the tng_addresses table name before the addressID field name. Do any of you gurus have an idea on why that's happening? I've attached my modified citem_lib_citation.php file which I am experimenting with. Let me know if you have any ideas.

Thanks!

citem_lib_citation.php

Link to comment
Share on other sites

Michael,
     You're going to kick yourself, but the variable is $address_table not $addresses_table.  Remove the extra "es" and it runs just fine.

Brent

Link to comment
Share on other sites

Michael T. Jones

Thank you, Brent!

That cleared the error. A victory - however, I'm still not able to get the www field to show up in the preview field. I've tried adding www to the "standard fields" area and the "custom event fields" area, but neither seems to work for me - no SQL or php errors, just no affect. I'll keep playing around and see if I can have some success. Thanks!

Link to comment
Share on other sites

Michael T. Jones

 

I'm not exactly sure what changed, but I successfully did get www to show up now by adding it to the "8 supported standard fields" in the Citation Master citem_lib_citation.php file:

  if (isset($stdevent['www'])) 
    $result['WWW'] = array("info" => $stdevent['www']);

Thanks, again @bhemph

Link to comment
Share on other sites

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.   Paste as plain text instead

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