Hello to all,
I am desperate!
I'm trying to follow the example that Ahmed published during udemy "creating a printable invoice".
I have a table called "Partecipazione_evento_pubblico" with a primary key called "pri_key". I have created a "stampa attestato" (=print certificate) button in the dv of the table "partecipazione_evento_pubblico". The button links to the "attestato_evento_pubblico.php" file.
My goal is to create a custom page where some fields of the table "Partecipazione_evento_pubblico" are shown with a particular layout.
Following the tutorial in the udemy course I was hoping to be able to view, in the page https://sullabuonastrada.org/governance ... pri_key=66 (where 66 is the primary key of the record on which I clicked) the fields of the table "partecipazione_evento_pubo "with data of the recors with pri_key 66.
Unfortunately instead I get an error in the query and I just can't understand where I'm wrong!
In fact when I click on the button the page https://sullabuonastrada.org/governance ... pri_key=66 opens but the fields of the form with primary key 66 do not appear on the page and this error appears:
"Column 'pri_key' in where clause is ambiguous".
at link http://circolovega.org/files.rar you can download:
1) error message.docx (full description of error message with the whole query text)
2) the file attestato_evento_pubblico.php (the file that opens by clicking on "stampa attestato" (= print certificate) but showing the error.
3) the file partecipazione_evento_pubblico.php (which is located in the hooks folder and contains the customization of the table "partecipazione_evento_pubblicot").
I really hope someone can help me understand where I'm wrong! THANK YOU ALL!
Fabiano
problem creating printable page
Re: problem creating printable page
Hi Fabian,
try to replace
`pri_key`
with
`partecipazione_evento_pubblico`.`pri_key`
in your query (after the where)
try to replace
`pri_key`
with
`partecipazione_evento_pubblico`.`pri_key`
in your query (after the where)
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: problem creating printable page
Thank you pböttcher!
But my code to generate the query is:
<?php
$currDir = dirname(__FILE__);
include("$currDir/defaultLang.php");
include("$currDir/language.php");
include("$currDir/lib.php");
include_once("$currDir/header.php");
/* grant access to all users who have access to the partecipazione_evento_pubblico table */
$evento_from = get_sql_from('partecipazione_evento_pubblico');
if(!$evento_from) exit(error_message('Accesso Negato!', false));
/* grant access to all logged users
$mi = getMemberInfo();
if(!$mi['username'] || $mi['username'] == 'guest'){
echo "Access denied";
exit;
}
/* get evento */
$evento_id = intval($_REQUEST['pri_key']);
if(!$evento_id) exit(error_message('Identificativo Evento non valido!', false));
/* retrieve evento info */
$evento_fields = get_sql_fields('partecipazione_evento_pubblico');
$res = sql("select {$evento_fields} from {$evento_from} and pri_key={$evento_id}", $eo);
$evento = db_fetch_assoc($res);
var_dump($evento);
include_once("$currDir/footer.php");
?>
... so....
where i have to put `partecipazione_evento_pubblico`.`pri_key`?
Thank you!!!
Fabiano
But my code to generate the query is:
<?php
$currDir = dirname(__FILE__);
include("$currDir/defaultLang.php");
include("$currDir/language.php");
include("$currDir/lib.php");
include_once("$currDir/header.php");
/* grant access to all users who have access to the partecipazione_evento_pubblico table */
$evento_from = get_sql_from('partecipazione_evento_pubblico');
if(!$evento_from) exit(error_message('Accesso Negato!', false));
/* grant access to all logged users
$mi = getMemberInfo();
if(!$mi['username'] || $mi['username'] == 'guest'){
echo "Access denied";
exit;
}
/* get evento */
$evento_id = intval($_REQUEST['pri_key']);
if(!$evento_id) exit(error_message('Identificativo Evento non valido!', false));
/* retrieve evento info */
$evento_fields = get_sql_fields('partecipazione_evento_pubblico');
$res = sql("select {$evento_fields} from {$evento_from} and pri_key={$evento_id}", $eo);
$evento = db_fetch_assoc($res);
var_dump($evento);
include_once("$currDir/footer.php");
?>
... so....
where i have to put `partecipazione_evento_pubblico`.`pri_key`?
Thank you!!!
Fabiano
Re: problem creating printable page
change
$res = sql("select {$evento_fields} from {$evento_from} and pri_key={$evento_id}", $eo);
to
$res = sql("select {$evento_fields} from {$evento_from} and partecipazione_evento_pubblico.pri_key={$evento_id}", $eo);
$res = sql("select {$evento_fields} from {$evento_from} and pri_key={$evento_id}", $eo);
to
$res = sql("select {$evento_fields} from {$evento_from} and partecipazione_evento_pubblico.pri_key={$evento_id}", $eo);
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: problem creating printable page
great! it seems to work! NNow i will continue to create my printable custom page. I will let you to know if I will encounter otrher problems!
For now... thank you so much!!!
Fabiano
For now... thank you so much!!!
Fabiano