This topic is locked

Edits not taking online

11/16/2005 12:59:43 PM
PHPRunner General questions
P
poopsie author

Hi there! Newbie to PHP and MYSQL, I have a database made and it shows up great. What I am making is a website that shows school closures so the database has state, county, city, school name, STATUS, REMARKS. I left that last two blank so they can be filled in when they close. I made a drop down for status with closed and delayed and a textfield for remarks. WHen I edit a school I make the changes on the edit screen and it says saved to database but when I go back to the main screen everything still looks the same. I am enabled editing of those two so the others can't be changed. I can't seem to figure out whats wrong. THanks!!!
Here is the code for my list file:

<?php

ini_set("display_errors","1");

ini_set("display_startup_errors","1");

header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");

session_start();

set_magic_quotes_runtime(0);
include("include/dbconnection.php");

include("include/School_Closings_variables.php");

include("include/School_Closings_functions.php");

CheckFileTime();
if(!@$_SESSION["UserID"])

{

$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];

header("Location: login.php?message=expired");

return;

}

if(!CheckSecurity(@$_SESSION["OwnerID"],"Search") && !CheckSecurity(@$_SESSION["OwnerID"],"Add"))

{

echo "<p>"."You don't have permissions to access this table"."<a href=\"login.php\">"."Back to login page"."</a></p>";

return;

}
?>

<link REL="stylesheet" href="include/style.css" type="text/css">

<?php

set_error_handler("error_handler");
$ownerid=RemoveFieldWrappers("``");

$conn=db_connect();
// process posted data, set session variables

// orderby

$action=postvalue("a");

$postvalue=postvalue("value");

if(!$action)

{

$sess_unset = array();

foreach($SESSION as $key=>$value)

if(substr($key,0,strlen($strTableName)+1)==$strTableName."
" &&

strpos(substr($key,strlen($strTableName)+1),"_")===false)

$sess_unset[] = $key;

foreach($sess_unset as $key)

unset($_SESSION[$key]);

}
if(!@$_SESSION[$strTableName."_fieldinfo"])

GetQueryInfo();

$queryfields = array_keys($_SESSION[$strTableName."_fieldinfo"]);
if(@$action=="language")

$_SESSION["language"]=@$postvalue;

if(@$action=="orderby")

$_SESSION[$strTableName."_orderby"]=@$postvalue;

else if(@$action=="goto")

$_SESSION[$strTableName."_pagenumber"]=@$postvalue;

else if(@$action=="pagesize")

{

$_SESSION[$strTableName."_pagesize"]=@$postvalue;

$_SESSION[$strTableName."_pagenumber"]=1;

}

else if(@$action=="showall")

$_SESSION[$strTableName."_search"]=0;

else if(@$_REQUEST["a"]=="search")

{

$_SESSION[$strTableName."_searchfield"]=postvalue("SearchField");

if(!array_key_exists($_SESSION[$strTableName."_searchfield"],$fieldlist))

$_SESSION[$strTableName."_searchfield"]=-1;

$_SESSION[$strTableName."_searchoption"]=postvalue("SearchOption");

$_SESSION[$strTableName."_searchfor"]=postvalue("SearchFor");

if(postvalue("SearchFor")!="" || postvalue("SearchOption")=='Empty')

$_SESSION[$strTableName."_search"]=1;

else

$_SESSION[$strTableName."_search"]=0;

$_SESSION[$strTableName."_pagenumber"]=1;

}

else if(@$action=="advsearch")

{

$_SESSION[$strTableName."_asearchopt"]=array();

$_SESSION[$strTableName."_asearchfor"]=array();

$_SESSION[$strTableName."_asearchfor2"]=array();

$tosearch=0;

$asearchopt = postvalue("asearchopt");

$asearchfield = postvalue("asearchfield");

foreach($asearchopt as $ii => $asopt)

{

$i=@$asearchfield[$ii];

$value1=postvalue("value".$i);

$type=postvalue("type".$i);

$value2=postvalue("value".($i+10000));

if($value1 || $asopt=='Empty')

{

$tosearch=1;

$_SESSION[$strTableName."_asearchopt"][$i]=$asopt;

if(!is_array($value1))

$_SESSION[$strTableName."_asearchfor"][$i]=$value1;

else

$_SESSION[$strTableName."_asearchfor"][$i]=combinevalues($value1);

$_SESSION[$strTableName."_asearchfortype"][$i]=$type;

if($value2)

$_SESSION[$strTableName."_asearchfor2"][$i]=$value2;

}

}

if($tosearch)

$_SESSION[$strTableName."_search"]=2;

else

$_SESSION[$strTableName."_search"]=0;

$_SESSION[$strTableName."_pagenumber"]=1;

}
// process session variables

// order by

$strOrderBy="";

$order_ind=-1;

if(@$_SESSION[$strTableName."_orderby"])

{

$order_dir=substr($_SESSION[$strTableName."_orderby"],0,1);

$order_ind=(integer)substr($_SESSION[$strTableName."_orderby"],1);

if(array_key_exists($order_ind,$queryfields) && ($order_dir=="a" || $order_dir=="d"))

{

if($order_dir=="a")

$strOrderBy="order by ".($order_ind+1)." asc";

else

$strOrderBy="order by ".($order_ind+1)." desc";

}

}

if(!$strOrderBy)

$strOrderBy=$gstrOrderBy;
// page number

$mypage=(integer)$_SESSION[$strTableName."_pagenumber"];

if(!$mypage)

$mypage=1;
// page size

$PageSize=(integer)$_SESSION[$strTableName."_pagesize"];

if(!$PageSize)

$PageSize=$gPageSize;
// delete record

if (@$_POST["mdelete"])

{

foreach(@$_POST["mdelete"] as $ind)

{

$key=make_db_value($strKeyField,refine(@$_POST["mdelete1"][$ind-1]));

$key2=make_db_value(@$strKeyField2,refine(@$_POST["mdelete2"][$ind-1]));

$key3=make_db_value(@$strKeyField3,refine(@$_POST["mdelete3"][$ind-1]));

$strSQL="delete from ".AddTableWrappers($strTableName)." where ".AddFieldWrappers($strKeyField)."=".$key;

if ($strKeyField2)

$strSQL.=" and ".AddFieldWrappers($strKeyField2)."=".$key2;

if ($strKeyField3)

$strSQL.=" and ".AddFieldWrappers($strKeyField3)."=".$key3;
LogInfo($strSQL);

db_exec($strSQL,$conn);

}

}
// make sql "select" string
if(!$gstrSQL)

$strSQL="select * from ".AddTableWrappers($strTableName);

else

$strSQL = $gstrSQL;

// add search params
if(@$_SESSION[$strTableName."_search"]==1)

// regular search

{

$strSearchFor=trim($_SESSION[$strTableName."_searchfor"]);

$strSearchOption=trim($_SESSION[$strTableName."_searchoption"]);

if(@$_SESSION[$strTableName."_searchfield"]>=0)

{

$strSearchField = $fieldlist[$_SESSION[$strTableName."_searchfield"]];

if($where = StrWhere($strSearchField, $strSearchFor, $strSearchOption, ""))

$strSQL = AddWhere($strSQL,$where);

else

$strSQL = AddWhere($strSQL,"1=0");

}

else

{

$strWhere = "1=0";
if($where=StrWhere("State", $strSearchFor, $strSearchOption, ""))

$strWhere .= " or ".$where;

else

$strWhere .= " or 1=0";
if($where=StrWhere("County", $strSearchFor, $strSearchOption, ""))

$strWhere .= " or ".$where;

else

$strWhere .= " or 1=0";
if($where=StrWhere("City", $strSearchFor, $strSearchOption, ""))

$strWhere .= " or ".$where;

else

$strWhere .= " or 1=0";
if($where=StrWhere("School Name", $strSearchFor, $strSearchOption, ""))

$strWhere .= " or ".$where;

else

$strWhere .= " or 1=0";
if($where=StrWhere("Status", $strSearchFor, $strSearchOption, ""))

$strWhere .= " or ".$where;

else

$strWhere .= " or 1=0";
if($where=StrWhere("Remarks", $strSearchFor, $strSearchOption, ""))

$strWhere .= " or ".$where;

else

$strWhere .= " or 1=0";
$strSQL = AddWhere($strSQL,$strWhere);

}

}

else if(@$_SESSION[$strTableName."_search"]==2)

// advanced search

{

$sWhere="";

foreach(@$_SESSION[$strTableName."_asearchfor"] as $i => $sfor)

{

$strSearchFor=trim($sfor);

$strSearchFor2="";

$type=@$_SESSION[$strTableName."_asearchfortype"][$i];

if(array_key_exists($i,@$_SESSION[$strTableName."_asearchfor2"]))

$strSearchFor2=trim(@$_SESSION[$strTableName."_asearchfor2"][$i]);

if($strSearchFor!="" || true)

{

if (!$sWhere)

$sWhere="1=1";

$strSearchOption=trim($_SESSION[$strTableName."_asearchopt"][$i]);

if($where=StrWhereAdv($fieldlist[$i], $strSearchFor, $strSearchOption, $strSearchFor2,$type))

$sWhere .= " and ".$where;

}

}

$strSQL = AddWhere($strSQL,$sWhere);

}
// order by

$strSQL.=" ".trim($strOrderBy);
// save SQL for use in "Export" and "Printer-friendly" pages
$_SESSION[$strTableName."_sql"] = $strSQL;
echo("<html>");

echo("<head>");

echo("<title>".$strTableName."</title>");

echo("</head>");

echo("<body topmargin=5 bgcolor=white");

if(@$_POST || @$_GET) echo(" onLoad=\" if ( document.forms['frmSearch']!=undefined && document.forms.frmSearch.SearchFor.value!='') document.forms.frmSearch.SearchFor.focus();\"");

echo(">");

if(file_exists("include/supertop.php"))

include("include/supertop.php");

?>
<!-- log out form -->

<form name=logout method=post action="login.php">

<input type=hidden name=a value="logout">

</form>
<!-- view form -->

<form method="GET" action="School_Closings_view.php" name="viewform">

<input type=hidden id="editid" name="editid" value="" >

<?php if($strKeyField2) { ?>

<input type=hidden id="editid2" name="editid2" value="" >

<?php }

if($strKeyField3) { ?>

<input type=hidden id="editid3" name="editid3" value="" >

<?php } ?>

</form>
<form method="GET" action="School_Closings_add.php" name="copyform">

<input type=hidden id="editid" name="copyid" value="" >

<?php if($strKeyField2) { ?>

<input type=hidden id="editid2" name="copyid2" value="" >

<?php }

if($strKeyField3) { ?>

<input type=hidden id="editid3" name="copyid3" value="" >

<?php } ?>

</form>
<!-- edit form -->

<form method="GET" action="School_Closings_edit.php" name="editform">

<input type=hidden id="editid" name="editid" value="" >

<?php if($strKeyField2) { ?>

<input type=hidden id="editid2" name="editid2" value="" >

<?php }

if($strKeyField3) { ?>

<input type=hidden id="editid3" name="editid3" value="" >

<?php } ?>

</form>
<?php

// Pagination: Control Variables

$iNumberOfRows =0;

$maxRecords = 0;

$maxpages = 0;

if (!$mypage)

$mypage=1;

if((integer)$mypage<1)

$mypage=1;

?>
<table align='center' border='0'>

<tr>

<td width=10>&nbsp;</td>
<?php

if($_SESSION["UserID"]) {

?>

<td align=center>Logged as&nbsp;<b><?php echo $_SESSION["UserID"];?></b>&nbsp;

<a href="#" onclick="document.forms.logout.submit();return true;">Log out</a>

</td><td width=20>&nbsp;</td>

<?php } ?>
<?php if(CheckSecurity($_SESSION["OwnerID"], "Search")) { ?>

<td align=center>

<a href="School_Closings_search.php">Advanced search</a>

</td><td width=20>&nbsp;</td>

<?php } ?>
<?php if(CheckSecurity($_SESSION["OwnerID"], "Export")) { ?>
<?php } ?>

</tr></table>

<span id=pwait><p align=center>Please wait ...</p></span>
<?php // Control Functions ?>

<form method="GET" action="School_Closings_list.php" name="frmAdmin">

<input type="hidden" id="a" name="a" value="goto">

<input type="hidden" id="value" name="value" value="<?php echo $mypage;?>">

</form>

<?php include("include/jsvariables.php");?>

<script language="JavaScript" src="include/jsfunctions.js">

</script>

<script>

var bSelected=false;

function GotoPage(nPageNumber)

{

document.forms.frmAdmin.a.value = 'goto';

document.forms.frmAdmin.elements['value'].value = nPageNumber;

document.forms.frmAdmin.submit();

}

</script>
<?php // Pagination: Write Search result Header?>

<?php

flush();

$SESSION[$strTableName."_SQL"]=$strSQL;

$rsDetails = setupRs($strSQL,$PageSize)

?>

<script language="JavaScript">

document.getElementById('pwait').style.display='none';

</script>
<table rows='1' cols='1' align='center' width='95%' border='0'>

<tr><td align="right">
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>

<TR><TD BGCOLOR=black align=center>
<table border=0 width=100% CELLPADDING=3 CELLSPACING=1><tr valign=center>
<?php

if(CheckSecurity(@$_SESSION["OwnerID"], "Search")) {

?>

<!-- Search form -->

<form name="frmSearch" method="GET" action="School_Closings_list.php">

<input type="Hidden" name="a" value="search">

<input type="Hidden" name="value" value="1">

<td align=center valign=middle class=shade>

<b>Search for: </b> &nbsp;&nbsp;&nbsp;

<SELECT ID="SearchField" NAME="SearchField" SIZE="1">

<OPTION VALUE="AnyField" <?php if(!@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchfield"]==-1) echo "selected";?>>Any field</option>
<OPTION VALUE="<?php $i=array_search("State",$fieldlist); echo $i.'"'; if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchfield"]==$i) echo " selected "; echo ">"; echo Label("State"); ?></option>
<OPTION VALUE="<?php $i=array_search("County",$fieldlist); echo $i.'"'; if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchfield"]==$i) echo " selected "; echo ">"; echo Label("County"); ?></option>
<OPTION VALUE="<?php $i=array_search("City",$fieldlist); echo $i.'"'; if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchfield"]==$i) echo " selected "; echo ">"; echo Label("City"); ?></option>
<OPTION VALUE="<?php $i=array_search("School Name",$fieldlist); echo $i.'"'; if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchfield"]==$i) echo " selected "; echo ">"; echo Label("School Name"); ?></option>
<OPTION VALUE="<?php $i=array_search("Status",$fieldlist); echo $i.'"'; if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchfield"]==$i) echo " selected "; echo ">"; echo Label("Status"); ?></option>
<OPTION VALUE="<?php $i=array_search("Remarks",$fieldlist); echo $i.'"'; if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchfield"]==$i) echo " selected "; echo ">"; echo Label("Remarks"); ?></option>
</SELECT>
<SELECT ID="SearchOption" NAME="SearchOption" SIZE="1">

<OPTION VALUE="Contains"<?php if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchoption"]=="Contains") echo " selected ";?>>Contains</option>

<OPTION VALUE="Equals"<?php if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchoption"]=="Equals") echo " selected ";?>>Equals</option>

<OPTION VALUE="Starts with ..."<?php if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchoption"]=="Starts with ...") echo " selected ";?>>Starts with ...</option>

<OPTION VALUE="More than ..."<?php if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchoption"]=="More than ...") echo " selected ";?>>More than ...</option>

<OPTION VALUE="Less than ..."<?php if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchoption"]=="Less than ...") echo " selected ";?>>Less than ...</option>

<OPTION VALUE="Equal or more than ..."<?php if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchoption"]=="Equal or more than ...") echo " selected ";?>>Equal or more than ...</option>

<OPTION VALUE="Equal or less than ..."<?php if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchoption"]=="Equal or less than ...") echo " selected ";?>>Equal or less than ...</option>

<OPTION VALUE="Empty"<?php if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchoption"]=="Empty") echo " selected ";?>>Empty</option>

</SELECT>
<input type=text size=20 name=SearchFor value="<?php if(@$_SESSION[$strTableName."_search"]==1 && @$_SESSION[$strTableName."_searchfor"]!="") echo htmlspecialchars(@$_SESSION[$strTableName."_searchfor"]);?>">

<input type=button class=button name="SearchButton" value="Search"

onClick="java script: document.forms.frmSearch.a.value = 'search';

document.forms.frmSearch.submit();">

<input type=button class=button value="Show all" onClick="java script: document.forms.frmSearch.a.value = 'showall';

document.forms.frmSearch.submit();"> </td>

</form>

<!-- How many records found-->

<td align=center class=shade>

Details found: <?php echo $maxRecords?>
Page <?php echo $mypage?> of <?php echo $maxpages?>
</td>

<td align=center class=shade>

<!--Records per page-->

Records Per Page::
<SELECT id=PageSizeSelect onChange="java script: document.forms.frmAdmin.a.value='pagesize'; document.forms.frmAdmin.elements['value'].value = document.getElementById('PageSizeSelect').options[document.getElementById('PageSizeSelect').selectedIndex].value;document.forms.frmAdmin.submit();">

<OPTION value=10 <?php if($PageSize==10) echo " selected";?>>10

<OPTION value=20 <?php if($PageSize==20) echo " selected";?>>20

<OPTION value=30 <?php if($PageSize==30) echo " selected";?>>30

<OPTION value=50 <?php if($PageSize==50) echo " selected";?>>50

<OPTION value=100 <?php if($PageSize==100) echo " selected";?>>100

<OPTION value=500 <?php if($PageSize==500) echo " selected";?>>500

<?php } ?>

<!--START-->

<script language="JavaScript">DisplayHeader();</script>
<!-- delete form -->

<form method="POST" action="School_Closings_list.php" name="deleteform">

<input type=hidden id="a" name="a" value="delete">
<table align='center' width='95%' border='0' cellpadding=3 cellspacing=2>

<?php

if(CheckSecurity(@$_SESSION["OwnerID"],"Search"))

{

if(db_numrows($rsDetails))

{

$nColumns = 0;
$LookupSQL="";

loopRs($rsDetails, $PageSize);

}

else

echo "<p>&nbsp;</p><p align=center><b>"."No records found"."</b></p>";

}

?>
</table>

</form>
<?php // Pagination: Write Control?>

<script language="JavaScript">WritePagination(<?php echo $mypage;?>,<?php echo $maxpages;?>);</script>
<?php

if(file_exists("include/superbottom.php"))

include("include/superbottom.php");

?>
</body>

</html>
<?php
function setupRs($strSQL,$nPageSize)

{

global $mypage,$maxRecords,$maxpages,$maxrecs;

$dbConnection=db_connect();

LogInfo($strSQL);

$setuprs=db_query($strSQL,$dbConnection);

// Pagination:

if(db_numrows($setuprs))

{

$maxRecords = db_numrows($setuprs);

$maxpages=ceil($maxRecords/$nPageSize);

if($mypage > $maxpages)

$mypage = $maxpages;

$maxrecs=$nPageSize;

db_pageseek($setuprs,$nPageSize,$mypage);

}

return $setuprs;

}
function WriteTableHeader()

{

global $fieldlist,$order_ind,$order_dir,$rsDetails,$nColumns,$queryfields;

$nColumns = 0;

?>

<tr CLASS="blackshade" valign=top>
<?php if(CheckSecurity(@$_SESSION["OwnerID"],"Edit")) { ?>

<TD align=center><img src=images/icon_edit.gif></td>

<?php $nColumns++; } ?>
<TD>

<table><tr><td class=blackshade>

<?php if(IsBinaryField($rsDetails,"State"))

echo Label("State")."</td>";

else

{

$dir="a";

if($order_ind>=0 && $queryfields[$order_ind]=="State" && $order_dir=="a")

$dir="d";

?>

<a class=blackshade href="School_Closings_list.php" onClick="java script:

document.forms.frmAdmin.a.value = 'orderby';

document.forms.frmAdmin.elements['value'].value = '<?php echo $dir.array_search("State", $queryfields);?>';

document.forms.frmAdmin.submit(); return false; "><?php echo Label("State")?>

</td>

<?php

if($order_ind>=0 && $queryfields[$order_ind]=="State" )

echo "<td><img src=images/".($order_dir=="a"?"up.gif":"down.gif")." border=0></td>";

}

?>

</tr></table>

</TD>
<TD>

<table><tr><td class=blackshade>

<?php if(IsBinaryField($rsDetails,"Status"))

echo Label("Status")."</td>";

else

{

$dir="a";

if($order_ind>=0 && $queryfields[$order_ind]=="Status" && $order_dir=="a")

$dir="d";

?>

<a class=blackshade href="School_Closings_list.php" onClick="java script:

document.forms.frmAdmin.a.value = 'orderby';

document.forms.frmAdmin.elements['value'].value = '<?php echo $dir.array_search("Status", $queryfields);?>';

document.forms.frmAdmin.submit(); return false; "><?php echo Label("Status")?>

</td>

<?php

if($order_ind>=0 && $queryfields[$order_ind]=="Status" )

echo "<td><img src=images/".($order_dir=="a"?"up.gif":"down.gif")." border=0></td>";

}

?>

</tr></table>

</TD>
<TD>

<table><tr><td class=blackshade>

<?php if(IsBinaryField($rsDetails,"County"))

echo Label("County")."</td>";

else

{

$dir="a";

if($order_ind>=0 && $queryfields[$order_ind]=="County" && $order_dir=="a")

$dir="d";

?>

<a class=blackshade href="School_Closings_list.php" onClick="java script:

document.forms.frmAdmin.a.value = 'orderby';

document.forms.frmAdmin.elements['value'].value = '<?php echo $dir.array_search("County", $queryfields);?>';

document.forms.frmAdmin.submit(); return false; "><?php echo Label("County")?>

</td>

<?php

if($order_ind>=0 && $queryfields[$order_ind]=="County" )

echo "<td><img src=images/".($order_dir=="a"?"up.gif":"down.gif")." border=0></td>";

}

?>

</tr></table>

</TD>
<TD>

<table><tr><td class=blackshade>

<?php if(IsBinaryField($rsDetails,"Remarks"))

echo Label("Remarks")."</td>";

else

{

$dir="a";

if($order_ind>=0 && $queryfields[$order_ind]=="Remarks" && $order_dir=="a")

$dir="d";

?>

<a class=blackshade href="School_Closings_list.php" onClick="java script:

document.forms.frmAdmin.a.value = 'orderby';

document.forms.frmAdmin.elements['value'].value = '<?php echo $dir.array_search("Remarks", $queryfields);?>';

document.forms.frmAdmin.submit(); return false; "><?php echo Label("Remarks")?>

</td>

<?php

if($order_ind>=0 && $queryfields[$order_ind]=="Remarks" )

echo "<td><img src=images/".($order_dir=="a"?"up.gif":"down.gif")." border=0></td>";

}

?>

</tr></table>

</TD>
<TD>

<table><tr><td class=blackshade>

<?php if(IsBinaryField($rsDetails,"City"))

echo Label("City")."</td>";

else

{

$dir="a";

if($order_ind>=0 && $queryfields[$order_ind]=="City" && $order_dir=="a")

$dir="d";

?>

<a class=blackshade href="School_Closings_list.php" onClick="java script:

document.forms.frmAdmin.a.value = 'orderby';

document.forms.frmAdmin.elements['value'].value = '<?php echo $dir.array_search("City", $queryfields);?>';

document.forms.frmAdmin.submit(); return false; "><?php echo Label("City")?>

</td>

<?php

if($order_ind>=0 && $queryfields[$order_ind]=="City" )

echo "<td><img src=images/".($order_dir=="a"?"up.gif":"down.gif")." border=0></td>";

}

?>

</tr></table>

</TD>
<TD>

<table><tr><td class=blackshade>

<?php if(IsBinaryField($rsDetails,"School Name"))

echo Label("School Name")."</td>";

else

{

$dir="a";

if($order_ind>=0 && $queryfields[$order_ind]=="School Name" && $order_dir=="a")

$dir="d";

?>

<a class=blackshade href="School_Closings_list.php" onClick="java script:

document.forms.frmAdmin.a.value = 'orderby';

document.forms.frmAdmin.elements['value'].value = '<?php echo $dir.array_search("School Name", $queryfields);?>';

document.forms.frmAdmin.submit(); return false; "><?php echo Label("School Name")?>

</td>

<?php

if($order_ind>=0 && $queryfields[$order_ind]=="School Name" )

echo "<td><img src=images/".($order_dir=="a"?"up.gif":"down.gif")." border=0></td>";

}

?>

</tr></table>

</TD>
</tr>

<?php

}
// display table with results

function loopRs($rsData,$nPageSize)

{

global $mypage,$strKeyField,$strKeyField2,$strKeyField3,$ownerid,$fieldlist,$LookupSQL,$conn,$nColumns,$strTableName,$thumbnail_fields,$thumbnail_prefixes,$thumbnail_maxsize;

// Pagination:

$iShadeTheDetail=0;

$iNumberOfRows = 0;

$nDelete=1;

$totals=array();
if($rsData)

{

while(($data=db_fetch_array($rsData)) && $iNumberOfRows<$nPageSize)

{
// To insure that every other one is shaded

if($iShadeTheDetail==0)

{

$sShadeClass = "class=shade";

$iShadeTheDetail = 1;

}

else

{

$sShadeClass = "";

$iShadeTheDetail = 0;

}

?>

<tr valign=top

class=shade

>

<td width=30%><table cellspacing=5><tr>
<?php if(CheckSecurity(@$_SESSION["OwnerID"],"Edit")) { ?>

<td align=center>

<?php

$strOwnerID = $ownerid;

if($strOwnerID) $strOwnerID = $data[$ownerid];

if(CheckSecurity($strOwnerID, "Edit"))

{

?>

<a href="School_Closings_edit.php"

onClick="java script:

document.forms.editform.editid.value = '<?php echo db_addslashes($data[$strKeyField]);?>';

<?php if($strKeyField2) {?>

document.forms.editform.editid2.value = '<?php echo db_addslashes($data[$strKeyField2]);?>';

<?php } ?>

<?php if($strKeyField3) {?>

document.forms.editform.editid3.value = '<?php echo db_addslashes($data[$strKeyField3]);?>';

<?php } ?>

document.forms.editform.submit();

return false;" >Edit</a>

<?php } ?>

&nbsp;</td>

<?php } ?>
</tr></table></td><td>&nbsp;</td>
<?php

echo "</tr><tr><td class=shade>".Label("State")."</td>";

?>
<TD>

<?php

$iquery="field=".array_search("State",$fieldlist)."&key=".htmlspecialchars($data[$strKeyField]);

if($strKeyField2)

$iquery.="&key2=".htmlspecialchars($data[$strKeyField2]);

if($strKeyField3)

$iquery.="&key3=".htmlspecialchars($data[$strKeyField3]);

?>
<?php

if(IsBinaryField($rsData,"State"))

{

$value=db_stripslashesbinary($data["State"]);

$fileinfo="";

$itype=SupposeImageType($value);

if($itype)

$disp='<img border=0 src="School_Closings_imager.php?'.$iquery.'">';

else

{

if(strlen($value))

{

$disp='<img border=0 src="images/file.gif">';

$fileinfo=' ('.strlen($value).' bytes)';

}

else

$disp='<img border=0 src="images/no_image.gif">';

}

if(!"" || !($filename=$data[""]))

$filename="file.bin";

else if($fileinfo)

$fileinfo=" ".$filename.$fileinfo;
if(Format("State")==FORMAT_DATABASE_FILE)

echo '<a href="School_Closings_getfile.php?filename='.htmlspecialchars($filename).'&'.$iquery.'".>'.$disp.'</a>'.$fileinfo;

else

echo $disp;

}

else

{
if(""!=FORMAT_HTML && ""!=FORMAT_FILE_IMAGE)

echo ProcessLargeText(GetData($rsData,$data,"State", ""));

else

echo GetData($rsData,$data,"State", "");
}

?>
</td>
<?php

echo "</tr><tr><td class=shade>".Label("Status")."</td>";

?>
<TD width=100 align=center>

<?php

$iquery="field=".array_search("Status",$fieldlist)."&key=".htmlspecialchars($data[$strKeyField]);

if($strKeyField2)

$iquery.="&key2=".htmlspecialchars($data[$strKeyField2]);

if($strKeyField3)

$iquery.="&key3=".htmlspecialchars($data[$strKeyField3]);

?>
<b> <i>

<?php

if(IsBinaryField($rsData,"Status"))

{

$value=db_stripslashesbinary($data["Status"]);

$fileinfo="";

$itype=SupposeImageType($value);

if($itype)

$disp='<img border=0 src="School_Closings_imager.php?'.$iquery.'">';

else

{

if(strlen($value))

{

$disp='<img border=0 src="images/file.gif">';

$fileinfo=' ('.strlen($value).' bytes)';

}

else

$disp='<img border=0 src="images/no_image.gif">';

}

if(!"" || !($filename=$data[""]))

$filename="file.bin";

else if($fileinfo)

$fileinfo=" ".$filename.$fileinfo;
if(Format("Status")==FORMAT_DATABASE_FILE)

echo '<a href="School_Closings_getfile.php?filename='.htmlspecialchars($filename).'&'.$iquery.'".>'.$disp.'</a>'.$fileinfo;

else

echo $disp;

}

else

{
if(""!=FORMAT_HTML && ""!=FORMAT_FILE_IMAGE)

echo ProcessLargeText(GetData($rsData,$data,"Status", ""));

else

echo GetData($rsData,$data,"Status", "");
}

?>

</i> </b>
</td>
<?php

echo "</tr><tr><td class=shade>".Label("County")."</td>";

?>
<TD>

<?php

$iquery="field=".array_search("County",$fieldlist)."&key=".htmlspecialchars($data[$strKeyField]);

if($strKeyField2)

$iquery.="&key2=".htmlspecialchars($data[$strKeyField2]);

if($strKeyField3)

$iquery.="&key3=".htmlspecialchars($data[$strKeyField3]);

?>
<?php

if(IsBinaryField($rsData,"County"))

{

$value=db_stripslashesbinary($data["County"]);

$fileinfo="";

$itype=SupposeImageType($value);

if($itype)

$disp='<img border=0 src="School_Closings_imager.php?'.$iquery.'">';

else

{

if(strlen($value))

{

$disp='<img border=0 src="images/file.gif">';

$fileinfo=' ('.strlen($value).' bytes)';

}

else

$disp='<img border=0 src="images/no_image.gif">';

}

if(!"" || !($filename=$data[""]))

$filename="file.bin";

else if($fileinfo)

$fileinfo=" ".$filename.$fileinfo;
if(Format("County")==FORMAT_DATABASE_FILE)

echo '<a href="School_Closings_getfile.php?filename='.htmlspecialchars($filename).'&'.$iquery.'".>'.$disp.'</a>'.$fileinfo;

else

echo $disp;

}

else

{
if(""!=FORMAT_HTML && ""!=FORMAT_FILE_IMAGE)

echo ProcessLargeText(GetData($rsData,$data,"County", ""));

else

echo GetData($rsData,$data,"County", "");
}

?>
</td>
<?php

echo "</tr><tr><td class=shade>".Label("Remarks")."</td>";

?>
<TD width=100 align=center>

<?php

$iquery="field=".array_search("Remarks",$fieldlist)."&key=".htmlspecialchars($data[$strKeyField]);

if($strKeyField2)

$iquery.="&key2=".htmlspecialchars($data[$strKeyField2]);

if($strKeyField3)

$iquery.="&key3=".htmlspecialchars($data[$strKeyField3]);

?>
<b> <i>

<?php

if(IsBinaryField($rsData,"Remarks"))

{

$value=db_stripslashesbinary($data["Remarks"]);

$fileinfo="";

$itype=SupposeImageType($value);

if($itype)

$disp='<img border=0 src="School_Closings_imager.php?'.$iquery.'">';

else

{

if(strlen($value))

{

$disp='<img border=0 src="images/file.gif">';

$fileinfo=' ('.strlen($value).' bytes)';

}

else

$disp='<img border=0 src="images/no_image.gif">';

}

if(!"" || !($filename=$data[""]))

$filename="file.bin";

else if($fileinfo)

$fileinfo=" ".$filename.$fileinfo;
if(Format("Remarks")==FORMAT_DATABASE_FILE)

echo '<a href="School_Closings_getfile.php?filename='.htmlspecialchars($filename).'&'.$iquery.'".>'.$disp.'</a>'.$fileinfo;

else

echo $disp;

}

else

{
if(""!=FORMAT_HTML && ""!=FORMAT_FILE_IMAGE)

echo ProcessLargeText(GetData($rsData,$data,"Remarks", ""));

else

echo GetData($rsData,$data,"Remarks", "");
}

?>

</i> </b>
</td>
<?php

echo "</tr><tr><td class=shade>".Label("City")."</td>";

?>
<TD>

<?php

$iquery="field=".array_search("City",$fieldlist)."&key=".htmlspecialchars($data[$strKeyField]);

if($strKeyField2)

$iquery.="&key2=".htmlspecialchars($data[$strKeyField2]);

if($strKeyField3)

$iquery.="&key3=".htmlspecialchars($data[$strKeyField3]);

?>
<?php

if(IsBinaryField($rsData,"City"))

{

$value=db_stripslashesbinary($data["City"]);

$fileinfo="";

$itype=SupposeImageType($value);

if($itype)

$disp='<img border=0 src="School_Closings_imager.php?'.$iquery.'">';

else

{

if(strlen($value))

{

$disp='<img border=0 src="images/file.gif">';

$fileinfo=' ('.strlen($value).' bytes)';

}

else

$disp='<img border=0 src="images/no_image.gif">';

}

if(!"" || !($filename=$data[""]))

$filename="file.bin";

else if($fileinfo)

$fileinfo=" ".$filename.$fileinfo;
if(Format("City")==FORMAT_DATABASE_FILE)

echo '<a href="School_Closings_getfile.php?filename='.htmlspecialchars($filename).'&'.$iquery.'".>'.$disp.'</a>'.$fileinfo;

else

echo $disp;

}

else

{
if(""!=FORMAT_HTML && ""!=FORMAT_FILE_IMAGE)

echo ProcessLargeText(GetData($rsData,$data,"City", ""));

else

echo GetData($rsData,$data,"City", "");
}

?>
</td>
<?php

echo "</tr><tr><td class=shade>".Label("School Name")."</td>";

?>
<TD>

<?php

$iquery="field=".array_search("School Name",$fieldlist)."&key=".htmlspecialchars($data[$strKeyField]);

if($strKeyField2)

$iquery.="&key2=".htmlspecialchars($data[$strKeyField2]);

if($strKeyField3)

$iquery.="&key3=".htmlspecialchars($data[$strKeyField3]);

?>
<?php

if(IsBinaryField($rsData,"School Name"))

{

$value=db_stripslashesbinary($data["School Name"]);

$fileinfo="";

$itype=SupposeImageType($value);

if($itype)

$disp='<img border=0 src="School_Closings_imager.php?'.$iquery.'">';

else

{

if(strlen($value))

{

$disp='<img border=0 src="images/file.gif">';

$fileinfo=' ('.strlen($value).' bytes)';

}

else

$disp='<img border=0 src="images/no_image.gif">';

}

if(!"" || !($filename=$data[""]))

$filename="file.bin";

else if($fileinfo)

$fileinfo=" ".$filename.$fileinfo;
if(Format("School Name")==FORMAT_DATABASE_FILE)

echo '<a href="School_Closings_getfile.php?filename='.htmlspecialchars($filename).'&'.$iquery.'".>'.$disp.'</a>'.$fileinfo;

else

echo $disp;

}

else

{
if(""!=FORMAT_HTML && ""!=FORMAT_FILE_IMAGE)

echo ProcessLargeText(GetData($rsData,$data,"School Name", ""));

else

echo GetData($rsData,$data,"School Name", "");
}

?>
</td>
</tr>

<tr height=30><td colspan=3>&nbsp;</td></tr>

<?php

$iNumberOfRows = $iNumberOfRows + 1;

}
}

}
?>

admin 11/17/2005

Hi,
could you give me a URL to your PHP files ?

You can post it here or send to support@xlinesoft.com
If not, please zip and send to support@xlinesoft.com a full set of generated PHP files along with your database creation script and PHPRunner project file.