Using a php generator "appgini" having a problem I believe with the script. 1 table with 4 fields, fields 2 & 3 are text and field 4 is an image field.
Everything works but field 4, when you upload a image along with text in fields 2 & 3 it does not display the image both text fields are fine. I don't know much about php that is why I am trying this program. I have attached 3 files, lib.php, lanuage.php and table1_view.php. If anyone could look at and see where the problem is. The website is here.

lib.php
<?php
// This script and data application were generated by AppGini 2.61 on 11/11/2004 at 8:47:37 AM
// Download AppGini for free from http://www.bigprof.com/appgini/download/



error_reporting(E_ALL ^ E_NOTICE);
include("./datalist.php");


function sql($statment,$assoc=1)
{


global $Translation;


$dbhost = "localhost";
$dbuser = "root";
$dbpass = "oliver06";
$dbname = "cndb_plants";


/****** Connect to MySQL ******/
if(!mysql_connect($dbhost, $dbuser, $dbpass))
{
echo StyleSheet() . "\n\n<div class=Error>";
echo $Translation["error:"] . mysql_error();
echo "</div>";
exit;
}
/****** Select DB ********/
if(!mysql_select_db($dbname))
{
echo StyleSheet() . "\n\n<div class=Error>";
echo $Translation["error:"] . mysql_error();
echo $Translation["if you haven't set up"];
echo "</div>";
exit;
}


if(!$result = mysql_query($statment))
{
echo StyleSheet() . "\n\n<div class=Error>";
echo "<br><b>" . $Translation["sql error:"] . "</b><br><br>
<strong>" . $Translation["query:"] . "</strong><br> $statment<br><br>
" . mysql_error();
if(stristr($statment, "select ")) echo ".<br>" . $Translation["if you haven't set up"];
echo "</div>";
echo "<a href=\"javascript:history.go(-1);\">" . $Translation["< back"] . "</a>";
exit;
}
return $result;
}


function NavMenus()
{
global $Translation;


$t = time();
$menu  = "<select name=nav_menu onChange='window.location=document.myform.nav_menu.options[document.myform.nav_menu.selectedIndex].value;'>";
$menu .= "<option value='#' class=SelectedOption style='color:black;'>" . $Translation["select a table"] . "</option>";
$menu .= "<option value='table1_view.php?t=$t' class=SelectedOption>Our Most Popular Plants</option>";
$menu .= "</select>";
return $menu;
}


function StyleSheet()
{
return "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\">";
}
function PrepareUploadedFile($FieldName, $MaxSize){
global $HTTP_POST_FILES, $Translation;
$f = $HTTP_POST_FILES[$FieldName];


if($f != UPLOAD_ERR_NO_FILE){
if($f>$MaxSize || $f){
echo StyleSheet()."<div class=Error>Error: The file you uploaded exceeds the maximum allowed size of " . intval($MaxSize/1024) . " KB.</div>";
exit;
}
if(!eregi('\.(jpg|jpeg|gif|png)$', $f, $ft)){
echo StyleSheet()."<div class=Error>Error: This file type is not allowed. Only JPEG, GIF or PNG files can be uploaded</div>";
exit;
}


$n  = microtime();
$n  = str_replace(" ", "_", $n);
$n  = str_replace("0.", "", $n);
$n .= $ft[0];


if(!file_exists("./images")){
@mkdir("./images", 0755);
}


@move_uploaded_file($f, $Translation . $n);
return $n;
}
return "";
}
?>
Lanuage.php
<?php


// IMPORTANT:
// ==========
// When translating, only translate the strings that are
// TO THE RIGHT OF the equal sign (=).
//
// Do NOT translate the strings between square brackets ([])
//
// Also, leave the text between < and > untranslated.
// =====================================================



// datalist.php
$Translation["powered by"] = "Powered by";
$Translation["quick search"] = "Quick Search";
$Translation["records x to y of z"] = "Records <FirstRecord> to <LastRecord> of <RecordCount>";
$Translation["filters"] = "Filters";
$Translation["filter"] = "Filter";
$Translation["filtered field"] = "Filtered field";
$Translation["comparison operator"] = "Comparison Operator";
$Translation["comparison value"] = "Comparison Value";
$Translation["and"] = "And";
$Translation["or"] = "Or";
$Translation["equal to"] = "Equal to";
$Translation["not equal to"] = "Not equal to";
$Translation["greater than"] = "Greater than";
$Translation["greater than or equal to"] = "Greater than or equal to";
$Translation["less than"] = "Less than";
$Translation["less than or equal to"] = "Less than or equal to";
$Translation["like"] = "Like";
$Translation["not like"] = "Not like";
$Translation["apply filters"] = "Apply filters";
$Translation["save filters"] = "Save and apply filters";
$Translation["saved filters title"] = "HTML Code For The Applied Filters";
$Translation["saved filters instructions"] = "Copy the code below and paste it to an HTML file to save the filter you just defined so that you can return to it at any time in the future without having to redefine it. You can save this HTML code on your computer or on any server and access this prefiltered table view through it.";
$Translation["hide code"] = "Hide this code";
$Translation["printer friendly view"] = "Printer-friendly view";
$Translation["save as csv"] = "Download as csv file (comma-separated values)";
$Translation["edit filters"] = "Edit filters";
$Translation["clear filters"] = "Clear filters";


// _dml.php
$Translation["are you sure?"] = "Are you sure you want to delete this record?";
$Translation["add new record"] = "Add new record";
$Translation["update record"] = "Update record";
$Translation["delete record"] = "Delete record";
$Translation["deselect record"] = "Deselect record";
$Translation["couldn't delete"] = "Couldn't delete record due to presence of <RelatedRecords> related record(s) in table '<TableName>'";
$Translation["pkfield empty"] = " field is a primary key field and cannot be empty.";
$Translation["upload image"] = "Upload new image ";
$Translation["select image"] = "Select an image ";
$Translation["remove image"] = "Remove image";
$Translation["month names"] = "January,February,March,April,May,June,July,August,September,October,November,December";
$Translation["field not null"] = "You can't leave this field empty.";
$Translation["*"] = "*";


// lib.php
$Translation["select a table"] = "Go to table";
$Translation["error:"] = "Error:";
$Translation["sql error:"] = "SQL error:";
$Translation["query:"] = "Query:";
$Translation["< back"] = "&lt; Back";
$Translation["if you haven't set up"] = "If you haven't set up the database yet, you can do so by clicking <a href='setup/setup.php'>here</a>.";


// setup.php
$Translation["error while connecting to mysql:"] = "Error while connecting to MySQL: ";
$Translation["attempting to create db"] = "Attempting to create database '<DBName>' ... ";
$Translation["error while creating db"] = "Error while creating database: ";
$Translation["please make sure username has permissions"] = "Please make sure that the username you are using has enough permissions to create the database '<DBName>'";
$Translation["done"] = "Done ... ";
$Translation["attempting to create table"] = "Attempting to create table '<TableName>' ... ";
$Translation["finished setup"] = "Finished database setup ...";
$Translation["to access your db"] = "To access your database, <a href=../index.html>click here</a>. If setup was successful, you may safely delete the 'setup' folder.";


// general config
// DO NOT TRANSLATE THE FOLLOWING
$Translation[ImageFolder] = "images";



?>
Table1_view.php
<?php
// This script and data application were generated by AppGini 2.61 on 11/11/2004 at 8:47:33 AM
// Download AppGini for free from http://www.bigprof.com/appgini/download/


include("./language.php");
include("./lib.php");
include("./table1_dml.php");


$x = new DataList;
if($HTTP_POST_VARS["Filter_x"] != ""  || $HTTP_POST_VARS != "")
{
// Query used in filters page and CSV output
$x->Query = "select table1.field1 as 'Data', table1.field2 as 'Plant Name', table1.field3 as 'Description', table1.field4 as 'Photo' from table1";
}
else
{
// Query used in table view
$x->Query = "select table1.field1 as 'Data', table1.field2 as 'Plant Name', table1.field3 as 'Description', if(length(table1.field4), concat('<img src=" . $Translation . "',table1.field4,' border=0>'), '') as 'Photo' from table1";
}
$x->DataHeight = 150;
$x->AllowSelection = 1;
$x->AllowDelete = 1;
$x->AllowInsert = 1;
$x->AllowUpdate = 1;
$x->AllowFilters = 1;
$x->AllowSavingFilters = 0;
$x->AllowSorting = 1;
$x->AllowNavigation = 1;
$x->AllowPrinting = 1;
$x->AllowCSV = 0;
$x->HideTableView = 0;
$x->RecordsPerPage = 10;
$x->QuickSearch = 0;
$x->QuickSearchText = $Translation["quick search"];
$x->ScriptFileName = "table1_view.php";
$x->TableTitle = "Our Most Popular Plants";
$x->PrimaryKey = "table1.field1";
$x->ColWidth[] = 150;
$x->ColWidth[] = 150;
$x->ColWidth[] = 150;
$x->ColWidth[] = 150;
$x->Render();


include("./header.php");
echo $x->HTML;
include("./footer.php");
?>

Edited 3 Years Ago by happygeek: fixed formatting

This article has been dead for over six months. Start a new discussion instead.