Jump to content
TNG Community
Sign in to follow this  
Michael T. Jones

SQL error inside PHP

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

Share this post


Link to post
Share on other sites
bhemph

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

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×