Jump to content

PHP database problem


RollTide

Recommended Posts

Hi, if someone could assist me, it would be much appreciated. I have a database website. I generated it using AppGini. Unfortunatly, they haven't answered my emails. What I'm trying to do is change my database to not dynamically load the selected record, but to instead load the direct URL to the record.

 

(Here is the website address: http://2g2egkxd3.site.aplus.net/updates/bad_view.php)

 

If you hover above the record, you will see the full URL for that record.

 

Example: http://2g2egkxd3.site.aplus.net/updates/bad_view.php?SelectedID=Buck%20Allen

 

But when you click it, it doesn't load that URL into the browser. I'm guessing it dynamically loads it into the page.

The reason I'm trying to do this is because I want to have a social/comment system for each record/prospect and it won't work if the record is dynamically loaded.

Link to comment
https://forums.phpfreaks.com/topic/220991-php-database-problem/
Share on other sites

This is the contents of bad_view.php

<?php
// This script and data application were generated by AppGini 4.53
// Download AppGini for free from http://www.bigprof.com/appgini/download/

$d=dirname(__FILE__);
include("$d/defaultLang.php");
include("$d/language.php");
include("$d/lib.php");
@include("$d/hooks/bad.php");
include("$d/bad_dml.php");

// mm: can the current member access this page?
$perm=getTablePermissions('bad');
if(!$perm[0]){
	echo StyleSheet();
	echo "<div class=\"error\">".$Translation['tableAccessDenied']."</div>";
	echo '<script language="javaScript">setInterval("window.location=\'index.php?signOut=1\'", 2000);</script>';
	exit;
}

$x = new DataList;
$x->TableName = "bad";

// Fields that can be displayed in the table view
$x->QueryFieldsTV=array(
	"`bad`.`check1`" => "Prospect",
	"`bad`.`chess3`" => "State",
	"`bad`.`yay4`" => "Ranking",
	"concat('<img src=\"', if(`bad`.`pos5`, 'checked.gif', 'checkednot.gif'), '\" border=\"0\" />')" => "Favorite",
	"`bad`.`prefav6`" => "Visited",
	"`bad`.`com7`" => "Visiting",
	"`bad`.`visiting8`" => "Committed",
	"if(CHAR_LENGTH(`bad`.`flex4`)>2000, concat(left(`bad`.`flex4`,2000),' ...'), `bad`.`flex4`)" => "Notes",
	"`bad`.`comm10`" => "Updated"
);
// Fields that can be displayed in the csv file
$x->QueryFieldsCSV=array(
	"`bad`.`check1`" => "Prospect",
	"`bad`.`chess3`" => "State",
	"`bad`.`yay4`" => "Ranking",
	"`bad`.`pos5`" => "Favorite",
	"`bad`.`prefav6`" => "Visited",
	"`bad`.`com7`" => "Visiting",
	"`bad`.`visiting8`" => "Committed",
	"`bad`.`flex4`" => "Notes",
	"`bad`.`comm10`" => "Updated"
);
// Fields that can be filtered
$x->QueryFieldsFilters=array(
	"`bad`.`check1`" => "Prospect",
	"`bad`.`chess3`" => "State",
	"`bad`.`yay4`" => "Ranking",
	"`bad`.`pos5`" => "Favorite",
	"`bad`.`prefav6`" => "Visited",
	"`bad`.`com7`" => "Visiting",
	"`bad`.`visiting8`" => "Committed",
	"`bad`.`flex4`" => "Notes",
	"`bad`.`comm10`" => "Updated"
);

// Fields that can be quick searched
$x->QueryFieldsQS=array(
	"`bad`.`check1`" => "Prospect",
	"`bad`.`chess3`" => "State",
	"`bad`.`yay4`" => "Ranking",
	"concat('<img src=\"', if(`bad`.`pos5`, 'checked.gif', 'checkednot.gif'), '\" border=\"0\" />')" => "Favorite",
	"`bad`.`prefav6`" => "Visited",
	"`bad`.`com7`" => "Visiting",
	"`bad`.`visiting8`" => "Committed",
	"if(CHAR_LENGTH(`bad`.`flex4`)>2000, concat(left(`bad`.`flex4`,2000),' ...'), `bad`.`flex4`)" => "Notes",
	"`bad`.`comm10`" => "Updated"
);

$x->QueryFrom="`bad` ";
$x->QueryWhere='';
$x->QueryOrder='';

$x->DataHeight = 3000;
$x->AllowSelection = 1;
$x->HideTableView = ($perm[2]==0 ? 1 : 0);
$x->AllowDelete = $perm[4];
$x->AllowInsert = $perm[1];
$x->AllowUpdate = $perm[3];
$x->SeparateDV = 1;
$x->AllowDeleteOfParents = 0;
$x->AllowFilters = 1;
$x->AllowSavingFilters = 1;
$x->AllowSorting = 1;
$x->AllowNavigation = 1;
$x->AllowPrinting = 1;
$x->AllowPrintingMultiSelection = 0;
$x->AllowCSV = 1;
$x->RecordsPerPage = 200;
$x->QuickSearch = 3;
$x->QuickSearchText = $Translation["quick search"];
$x->ScriptFileName = "bad_view.php";
$x->RedirectAfterInsert = "bad_view.php";
$x->TableTitle = "2011";
$x->PrimaryKey = "`bad`.`check1`";

$x->ColWidth   = array(150, 20, 80, 40, 80, 80, 60, 300, 180);
$x->ColCaption = array("Prospect", "State", "Ranking", "Favorite", "Visited", "Visiting", "Committed", "Notes", "Updated");
$x->ColNumber  = array(1, 2, 3, 4, 5, 6, 7, 8, 9);

$x->Template = 'templates/bad_templateTV.html';
$x->SelectedTemplate = 'templates/bad_templateTVS.html';
$x->ShowTableHeader = 1;
$x->ShowRecordSlots = 0;
$x->HighlightColor = '#FFF0C2';

// mm: build the query based on current member's permissions
if($perm[2]==1){ // view owner only
	$x->QueryFrom.=', membership_userrecords';
	$x->QueryWhere="where `bad`.`check1`=membership_userrecords.pkValue and membership_userrecords.tableName='bad' and lcase(membership_userrecords.memberID)='".getLoggedMemberID()."'";
}elseif($perm[2]==2){ // view group only
	$x->QueryFrom.=', membership_userrecords';
	$x->QueryWhere="where `bad`.`check1`=membership_userrecords.pkValue and membership_userrecords.tableName='bad' and membership_userrecords.groupID='".getLoggedGroupID()."'";
}elseif($perm[2]==3){ // view all
	// no further action
}elseif($perm[2]==0){ // view none
	$x->QueryFields = array("Not enough permissions" => "NEP");
	$x->QueryFrom = '`bad`';
	$x->QueryWhere = '';
	$x->DefaultSortField = '';
}

// handle date sorting correctly
if($_POST['SortField']=='9' || $_POST['SortField']=='`bad`.`comm10`' || $_POST['SortField']=='bad.comm10'){
	$_POST['SortField']='`bad`.`comm10`';
	$SortFieldNumeric=9;
}
if($_GET['SortField']=='9' || $_GET['SortField']=='`bad`.`comm10`' || $_GET['SortField']=='bad.comm10'){
	$_GET['SortField']='`bad`.`comm10`';
	$SortFieldNumeric=9;
}
// end of date sorting handler

// hook: bad_init
$render=TRUE;
if(function_exists('bad_init')){
	$args=array();
	$render=bad_init($x, getMemberInfo(), $args);
}

if($render) $x->Render();

// hook: bad_header
$headerCode='';
if(function_exists('bad_header')){
	$args=array();
	$headerCode=bad_header($x->ContentType, getMemberInfo(), $args);
}  
if(!$headerCode){
	include("$d/header.php"); 
}else{
	ob_start(); include("$d/header.php"); $dHeader=ob_get_contents(); ob_end_clean();
	echo str_replace('<%%HEADER%%>', $dHeader, $headerCode);
}

echo $x->HTML;
// hook: bad_footer
$footerCode='';
if(function_exists('bad_footer')){
	$args=array();
	$footerCode=bad_footer($x->ContentType, getMemberInfo(), $args);
}  
if(!$footerCode){
	include("$d/footer.php"); 
}else{
	ob_start(); include("$d/footer.php"); $dFooter=ob_get_contents(); ob_end_clean();
	echo str_replace('<%%FOOTER%%>', $dFooter, $footerCode);
}
?>

 

Here is the code for the HTML template.

<!-- Edit this file to change the layout of each record in the table view -->
<!-- To disable clicking of a field, remove the <%%select%%> and <%%endselect%%> formatters around it-->

<!-- If you wish to hide the table view header that contains the column titles, -->
<!-- open the generated 'bad_view.php' file in your text editor and -->
<!-- change the value of $x->ShowTableHeader to 0 -->

	<td id="bad.check1.<%%VALUE(Prospect)%%>" valign="top" width="150" class="TableBody"><%%SELECT%%><%%VALUE(Prospect)%%><%%ENDSELECT%%></td>
	<td id="bad.chess3.<%%VALUE(Prospect)%%>" valign="top" width="20" class="TableBody"><%%SELECT%%><%%VALUE(State)%%><%%ENDSELECT%%></td>
	<td id="bad.yay4.<%%VALUE(Prospect)%%>" valign="top" width="80" class="TableBody"><%%SELECT%%><%%VALUE(Ranking)%%><%%ENDSELECT%%></td>
	<td id="bad.pos5.<%%VALUE(Prospect)%%>" valign="top" width="40" class="TableBody"><%%SELECT%%><%%VALUE(Favorite)%%><%%ENDSELECT%%></td>
	<td id="bad.prefav6.<%%VALUE(Prospect)%%>" valign="top" width="80" class="TableBody"><%%SELECT%%><%%VALUE(Visited)%%><%%ENDSELECT%%></td>
	<td id="bad.com7.<%%VALUE(Prospect)%%>" valign="top" width="80" class="TableBody"><%%SELECT%%><%%VALUE(Visiting)%%><%%ENDSELECT%%></td>
	<td id="bad.visiting8.<%%VALUE(Prospect)%%>" valign="top" width="60" class="TableBody"><%%SELECT%%><%%VALUE(Committed)%%><%%ENDSELECT%%></td>
	<td id="bad.flex4.<%%VALUE(Prospect)%%>" valign="top" width="300" class="TableBody"><%%SELECT%%><%%VALUE(Notes)%%><%%ENDSELECT%%></td>
	<td id="bad.comm10.<%%VALUE(Prospect)%%>" valign="top" width="180" class="TableBody"><%%SELECT%%><%%VALUE(Updated)%%><%%ENDSELECT%%></td>

 

Thats all that I can think that it uses, besides the CSS stylesheet and I dont see anything thats relevant to what I'm trying to do. Any guidance here would be great. The database actually has a user system but it doesn't have a comment system. I'm not much of a programmer so I used a free Meta-Authentication comment system called Disqus, and it requires static pages.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.