View unanswered posts | View active topics It is currently Tue May 21, 2024 5:23 am



Reply to topic  [ 2 posts ] 
bloody rookie needs help to integrate SQL SELECT functions 
Author Message
New pChart user
New pChart user

Joined: Wed Nov 02, 2011 7:23 am
Posts: 2
Post bloody rookie needs help to integrate SQL SELECT functions
Hi everybody,

First, please excuse the lousy English, but my native language is German.
I am using a ready PHP solution for my genealogical research: The Next Generation of Genealogy Site Building ("TNG") - http://lythgoes.net/genealogy/software.php
This offers the possibility for reports using SQL SELECT functions to generate. Unfortunately, I really do not know how this works.

Here's an example how the result looks like (marriages per calendar month):
http://www.ahnendaten.de/ahnen/showrepo ... eportID=44

This used the following SQL SELECT function:
SELECT MONTHNAME(marrdatetr) AS month_in_which_married, MONTH(marrdatetr) AS month_of_marriage, COUNT(*) AS Totals, RPAD('',COUNT(*)/10,'=') AS Graphic FROM tng_families WHERE MONTH(marrdatetr)>0 GROUP BY month_of_marriage;

Unfortunately I am a bloody rookie with PHP and pchart, so I need all the help I can get.
Perhaps among the talented and brilliant programmers here there is one who is willing to tell me how to transform the SQL SELECT function so that these result will be displayed as a chart.
I am sure that many of the thousands of worldwide TNG users would be extremely pleased about a solution.

I would be happy for any helping answer and remain with best regards,
Thank you very much in advance for your efforts.
And greetings from Switzerland.

Ingo Gebhard
Frauenfeld, Switzerland


Wed Nov 02, 2011 7:54 am
Profile
New pChart user
New pChart user

Joined: Wed Nov 02, 2011 7:23 am
Posts: 2
Post Re: bloody rookie needs help to integrate SQL SELECT functio
I have tried to solve it myself:

Code:
/* Build the query that will returns the data to graph */
$Requete = "SELECT MONTHNAME(marrdatetr) AS Kalendermonat, MONTH(marrdatetr) AS Monat, COUNT(*) AS Totals FROM tng_families WHERE MONTH(marrdatetr)>0 GROUP BY Monat";
$Result  = mysql_query($Requete);
while($row = mysql_fetch_array($Result))
{
  /* Push the results of the query in an array */
  $Kalendermonat = $row["Kalendermonat"];
  $Totals = $row["Totals"];
}

/* Save the data in the pData array */
$myData->addPoints($Kalendermonat,"Kalendermonat");
$myData->addPoints($Totals,"Totals");


Unfortunately I get this error message:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/web673/html/tng/pChart/xx.php on line 16
- line 16 is while($row = mysql_fetch_array($Result))

Fatal error: Call to a member function addPoints() on a non-object in /var/www/web673/html/tng/pChart/xx.php on line 24
- line 24 is $myData->addPoints($Kalendermonat,"Kalendermonat");

Could anyone help me please?


Sun Nov 13, 2011 6:11 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron