Put a custom table into a custom table

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
theyland
Veteran Member
Posts: 32
Joined: 2020-11-04 15:43

Put a custom table into a custom table

Post by theyland » 2024-04-22 14:44

Hello,
I created a custom table called reports, which then runs an sql query.
But I do not want to put several queries on the same page, but rather, when "reports" is opened, more buttons appear, one for each query. How could that be done?
Thanks
Thomas

xbox2007
Veteran Member
Posts: 152
Joined: 2016-12-16 16:49

Re: Put a custom table into a custom table

Post by xbox2007 » 2024-04-22 19:39

hello , it will be like form
when you select button will forward value one value will be post
then use IF statement

this is fast example

Code: Select all

<?php
    define('PREPEND_PATH', '../');
    $report_dir = dirname(__FILE__);
    include("$report_dir/../lib.php");
	include_once("$report_dir/../header.php");	
	
?>	
	<form id="Form" name="Form" autocomplete="off" action='' method="POST">
		<input type="submit" name="query" id="query1" value="query1" class="btn btn-primary btn-lg" role="button">
		<input type="submit" name="query" id="query2" value="query2" class="btn btn-info btn-lg" role="button">
	</form>
	
	<?php
		
		//print_r ($_POST);
	
		if($_POST['query'] == 'query1'){
			//Query1 for other table One
			echo "Query1 for table One ";	
			$resA = sql("SELECT CoNumber, Car_NO FROM rent ORDER BY `rent`.`Car_NO` ASC", $eo); 
					
		}
		elseif($_POST['query'] == 'query2') {  
			//Query2 for other table Two
			echo "Query2 for table Two";		
			$resB = sql("SELECT sum(t1.AmountW) AS INV, t3.CustomerName, t1.CustomerCode AS CCODE , t2.Customer_Name AS CNAme, SUM(t2.Credit) AS STA FROM creditnote t1 LEFT JOIN statement t2 on t1.CreditNO = t2.Type_NO LEFT JOIN customers t3 on t1.CustomerCode = t3.ID WHERE t1.CustomerCode > 0 GROUP by t1.CustomerCode ORDER BY `STA` ASC", $eo); 
		}
		
	?>

please check

theyland
Veteran Member
Posts: 32
Joined: 2020-11-04 15:43

Re: Put a custom table into a custom table

Post by theyland » 2024-04-23 11:26

Thanks for that. I resorted to make a simple html site with several buttons, which then link to other pages, where the atual calculations are done. However the AG formatting is gone and i do not know how to link that.

xbox2007
Veteran Member
Posts: 152
Joined: 2016-12-16 16:49

Re: Put a custom table into a custom table

Post by xbox2007 » 2024-04-23 18:04

hello
if you would like keep style as your AppGini ,you should add this code for all your pages
in my case i was make all custom page at new folder (report)

Code: Select all

<?php
    	define('PREPEND_PATH', '../');
    	$report_dir = dirname(__FILE__);
    	include("$report_dir/../lib.php");
	include_once("$report_dir/../header.php");	
	
?>
if you will keep custom page on hooks folder you can use this code

Code: Select all

<?php
    define('PREPEND_PATH', '../');
    $hooks_dir = __DIR__;
    include("$hooks_dir/../lib.php");
 
    include_once("$hooks_dir/../header.php");
?> 
for more information please check this link
https://bigprof.com/appgini/help/advanc ... cess-pages

Post Reply