Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL error when accessing preferred individual (#1) #672

Closed
torefahlstrom opened this issue Aug 7, 2015 · 6 comments
Closed

SQL error when accessing preferred individual (#1) #672

torefahlstrom opened this issue Aug 7, 2015 · 6 comments

Comments

@torefahlstrom
Copy link

Created a tree and inserted records from a .ged-file. After that, added and updated records manually. At some point in time, i tried to access the preferred individual (me, record nr 1) and got the following error:
#0 /app/Statement.php:82 PDOException("SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''223')' at line 1")
#1 /app/Individual.php:64 execute()
#2 /app/Family.php:45 load()
#3 /app/GedcomRecord.php:205 __construct()
#4 /app/Fact.php:97 getInstance()
#5 /app/Controller/GedcomRecordController.php:48 getTarget()
#6 /app/Controller/IndividualController.php:61 __construct()
#7 /individual.php:31 __construct()

I am running webtrees 1.7.1. and php 5.5.x. I have been using older versions of webtrees (1.6.2) without seeing this type of error before.

@fisharebest
Copy link
Owner

This particular function is new for 1.7

It loads all members of a family in one SQL query to improve performance.

The query is very simple, and I cannot see any obvious errors.

Can you add some debug to see what is happening.

app/Individual.php, line ~58:

        if (count($args) > 1) {
            $rows = Database::prepare(

Change to

        if (count($args) > 1) {
            var_dump($sql, $args);
            $rows = Database::prepare(

You should now see debug info on the individual page.

@ghost
Copy link

ghost commented Aug 10, 2015

That var_dump gives me:

string(12) ",:x1,:x2,:x3" 
array(4) { 
   ["tree_id"]=> int(1) 
   ["x1"]=> string(2) "16" 
   ["x2"]=> string(1) "3" 
   ["x3"]=> string(1) "4" 
}

@fisharebest
Copy link
Owner

Can you add one more line of debug

        var_dump($xrefs);
        foreach (array_unique($xrefs) as $n => $xref) {

@ghost
Copy link

ghost commented Aug 10, 2015

That gives:

array(4) {
   [0]=> string(1) "1" 
   [1]=> string(2) "16"
   [2]=> string(1) "3" 
   [3]=> string(1) "4" 
}

@fisharebest
Copy link
Owner

Thanks. I see the problem now..

@torefahlstrom
Copy link
Author

Unfortunately i was on a trip and was not able to help. However, i can confirm that the fix resolved the issue that i had.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants