Page 1 of 1

print certificates (something like "creating a printable invoice" in appgini udemy course.

Posted: 2019-05-10 19:31
by fgazza
Hello! I'm trying to create something like the printable bill explained by Ahmad in the udemy course.

Specifically, I would like to generate time sheets with the list of people who register for an activity.

My activity table is called "appuntamenti" but has an alias and in the database is called appuntamenti1

The field with the primary key of the appuntamenti table is called pri_key

I tried to write this code but it doesn't work. Can anyone help me figure out where I'm wrong?

Thanks a lot!


$currDir = dirname(__FILE__);
/* grant access to all users who have access to the appuntamenti table */
$appuntamenti1_from = get_sql_from('appuntamenti1');
if(!$appuntamenti1_from) exit(error_message('Accesso Negato!', false));

(NOTE: if I comment last two line my site give me the error "ID appuntamento non valido!" otherwise the error is Accesso Negato!)

/* get invoice */
$appuntamenti1_id = intval($_REQUEST['pri_key']);
if(!$appuntamenti1_id) exit(error_message('ID appuntamento non valido!', false));

/* retrieve appuntamenti info */
$appuntamenti1_fields = get_sql_fields('appuntamenti1');
$res = sql("select {$appuntamenti1_fields} from {$appuntamenti1_from} and pri_key={$appuntamenti1_id}", $eo);
$appuntamenti1 = db_fetch_assoc($res);