PDA

View Full Version : page not updating until refreshed


roby258376
05-14-2009, 11:59 AM
Hi folks,

I have followed the instructions in the tutorials for creating a profile update page that allows a user to upload a new picture.

I've used security assist, data assist and digital file pro to accomplish this.

I have the page set to go back to itself after the update, but when I test it, I don't see the update until after I refresh the page. The information changes in the database without a problem but the page is not auto refreshing when the submit button is pressed.

is there a setting I should change to make sure the user is seeing the updated profile? after submit, without having to force a refresh?

Thanks

Ray Borduin
05-14-2009, 12:02 PM
Make sure the recordset occurs below the update code. That way it will be updated by the time you get the data.

roby258376
05-14-2009, 12:21 PM
Sorry Ray, I'm a bit new to this, and what I tried didn't work at all, so I'm posting my code, hoping you can see the error, or what I should move where.

Thanks in advance, you know, I don't know what we'd do without your expertise!


<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php require_once('Connections/members.php'); ?>
<?php require_once( "WA_SecurityAssist/Helper_PHP.php" );

?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once("WA_DigitalFilePro/HelperPHP.php"); ?>

<?php
if (!WA_Auth_RulePasses("Logged in to members")){
WA_Auth_RestrictAccess("members_LogIn.php?notLogged=true");
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$ParamUserID_WAATKmembers = "-1";
if (isset($_SESSION['UserID'])) {
$ParamUserID_WAATKmembers = (get_magic_quotes_gpc()) ? $_SESSION['UserID'] : addslashes($_SESSION['UserID']);
}
mysql_select_db($database_members, $members);
$query_WAATKmembers = sprintf("SELECT * FROM members WHERE UserID = %s", $ParamUserID_WAATKmembers);
$WAATKmembers = mysql_query($query_WAATKmembers, $members) or die(mysql_error());
$row_WAATKmembers = mysql_fetch_assoc($WAATKmembers);
$totalRows_WAATKmembers = mysql_num_rows($WAATKmembers);

mysql_select_db($database_members, $members);
$query_rsPP = "SELECT * FROM yesno";
$rsPP = mysql_query($query_rsPP, $members) or die(mysql_error());
$row_rsPP = mysql_fetch_assoc($rsPP);
$totalRows_rsPP = mysql_num_rows($rsPP);

mysql_select_db($database_members, $members);
$query_rsProvince = "SELECT * FROM province_state";
$rsProvince = mysql_query($query_rsProvince, $members) or die(mysql_error());
$row_rsProvince = mysql_fetch_assoc($rsProvince);
$totalRows_rsProvince = mysql_num_rows($rsProvince);

mysql_select_db($database_members, $members);
$query_rsMemberStatus = "SELECT * FROM member_status";
$rsMemberStatus = mysql_query($query_rsMemberStatus, $members) or die(mysql_error());
$row_rsMemberStatus = mysql_fetch_assoc($rsMemberStatus);
$totalRows_rsMemberStatus = mysql_num_rows($rsMemberStatus);

mysql_select_db($database_members, $members);
$query_rsBusCat = "SELECT * FROM business_category";
$rsBusCat = mysql_query($query_rsBusCat, $members) or die(mysql_error());
$row_rsBusCat = mysql_fetch_assoc($rsBusCat);
$totalRows_rsBusCat = mysql_num_rows($rsBusCat);

mysql_select_db($database_members, $members);
$query_rsCommittees = "SELECT * FROM committee_names";
$rsCommittees = mysql_query($query_rsCommittees, $members) or die(mysql_error());
$row_rsCommittees = mysql_fetch_assoc($rsCommittees);
$totalRows_rsCommittees = mysql_num_rows($rsCommittees);?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Update_x"])){
WA_DFP_UploadFile("WA_UploadResult1", "pictureFile", "".((isset($_POST["picture"]))?$_POST["picture"]:"") ."", "images/members/", "[FileName]", "2", "[FileName]_[Increment]", "0", "true", "125", "0");
}?>
<?php
// WA Application Builder Update
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_connection = $members;
$WA_table = "members";
$WA_redirectURL = "members_Profile.php";
$WA_keepQueryString = false;
$WA_indexField = "UserID";
$WA_fieldNamesStr = "userName|password|lastName|firstName|member_status |company|title|address|city|province_state|pc_zip| telephone|fax|cell_phone|url|business_category|pic ture|committee_ID|committee_2_ID";
$WA_fieldValuesStr = "".((isset($_POST["userName"]))?$_POST["userName"]:"") ."" . "|" . "".((isset($_POST["password"]))?$_POST["password"]:"") ."" . "|" . "".((isset($_POST["lastName"]))?$_POST["lastName"]:"") ."" . "|" . "".((isset($_POST["firstName"]))?$_POST["firstName"]:"") ."" . "|" . "".((isset($_POST["member_status"]))?$_POST["member_status"]:"") ."" . "|" . "".((isset($_POST["company"]))?$_POST["company"]:"") ."" . "|" . "".((isset($_POST["title"]))?$_POST["title"]:"") ."" . "|" . "".((isset($_POST["address"]))?$_POST["address"]:"") ."" . "|" . "".((isset($_POST["city"]))?$_POST["city"]:"") ."" . "|" . "".((isset($_POST["province_state"]))?$_POST["province_state"]:"") ."" . "|" . "".((isset($_POST["pc_zip"]))?$_POST["pc_zip"]:"") ."" . "|" . "".((isset($_POST["telephone"]))?$_POST["telephone"]:"") ."" . "|" . "".((isset($_POST["fax"]))?$_POST["fax"]:"") ."" . "|" . "".((isset($_POST["cell_phone"]))?$_POST["cell_phone"]:"") ."" . "|" . "".((isset($_POST["url"]))?$_POST["url"]:"") ."" . "|" . "".((isset($_POST["business_category"]))?$_POST["business_category"]:"") ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."" . "|" . "".((isset($_POST["committee_ID"]))?$_POST["committee_ID"]:"") ."" . "|" . "".((isset($_POST["committee_2_ID"]))?$_POST["committee_2_ID"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''|',none,''";
$WA_comparisonStr = "=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

$WA_where_fieldValuesStr = "".$row_WAATKmembers['UserID'] ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);

$WA_connectionDB = $database_members;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>

Ray Borduin
05-14-2009, 12:28 PM
It should be:

<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php require_once('Connections/members.php'); ?>
<?php require_once( "WA_SecurityAssist/Helper_PHP.php" );

?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once("WA_DigitalFilePro/HelperPHP.php"); ?>

<?php
if (!WA_Auth_RulePasses("Logged in to members")){
WA_Auth_RestrictAccess("members_LogIn.php?notLogged=true");
}
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Update_x"])){
WA_DFP_UploadFile("WA_UploadResult1", "pictureFile", "".((isset($_POST["picture"]))?$_POST["picture"]:"") ."", "images/members/", "[FileName]", "2", "[FileName]_[Increment]", "0", "true", "125", "0");
}?>
<?php
// WA Application Builder Update
if ($_SERVER["REQUEST_METHOD"] == "POST") // Trigger
{
$WA_connection = $members;
$WA_table = "members";
$WA_redirectURL = "members_Profile.php";
$WA_keepQueryString = false;
$WA_indexField = "UserID";
$WA_fieldNamesStr = "userName|password|lastName|firstName|member_status |company|title|address|city|province_state|pc_zip| telephone|fax|cell_phone|url|business_category|pic ture|committee_ID|committee_2_ID";
$WA_fieldValuesStr = "".((isset($_POST["userName"]))?$_POST["userName"]:"") ."" . "|" . "".((isset($_POST["password"]))?$_POST["password"]:"") ."" . "|" . "".((isset($_POST["lastName"]))?$_POST["lastName"]:"") ."" . "|" . "".((isset($_POST["firstName"]))?$_POST["firstName"]:"") ."" . "|" . "".((isset($_POST["member_status"]))?$_POST["member_status"]:"") ."" . "|" . "".((isset($_POST["company"]))?$_POST["company"]:"") ."" . "|" . "".((isset($_POST["title"]))?$_POST["title"]:"") ."" . "|" . "".((isset($_POST["address"]))?$_POST["address"]:"") ."" . "|" . "".((isset($_POST["city"]))?$_POST["city"]:"") ."" . "|" . "".((isset($_POST["province_state"]))?$_POST["province_state"]:"") ."" . "|" . "".((isset($_POST["pc_zip"]))?$_POST["pc_zip"]:"") ."" . "|" . "".((isset($_POST["telephone"]))?$_POST["telephone"]:"") ."" . "|" . "".((isset($_POST["fax"]))?$_POST["fax"]:"") ."" . "|" . "".((isset($_POST["cell_phone"]))?$_POST["cell_phone"]:"") ."" . "|" . "".((isset($_POST["url"]))?$_POST["url"]:"") ."" . "|" . "".((isset($_POST["business_category"]))?$_POST["business_category"]:"") ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."" . "|" . "".((isset($_POST["committee_ID"]))?$_POST["committee_ID"]:"") ."" . "|" . "".((isset($_POST["committee_2_ID"]))?$_POST["committee_2_ID"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''|',none,''";
$WA_comparisonStr = "=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

$WA_where_fieldValuesStr = "".$row_WAATKmembers['UserID'] ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);

$WA_connectionDB = $database_members;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$ParamUserID_WAATKmembers = "-1";
if (isset($_SESSION['UserID'])) {
$ParamUserID_WAATKmembers = (get_magic_quotes_gpc()) ? $_SESSION['UserID'] : addslashes($_SESSION['UserID']);
}
mysql_select_db($database_members, $members);
$query_WAATKmembers = sprintf("SELECT * FROM members WHERE UserID = %s", $ParamUserID_WAATKmembers);
$WAATKmembers = mysql_query($query_WAATKmembers, $members) or die(mysql_error());
$row_WAATKmembers = mysql_fetch_assoc($WAATKmembers);
$totalRows_WAATKmembers = mysql_num_rows($WAATKmembers);

mysql_select_db($database_members, $members);
$query_rsPP = "SELECT * FROM yesno";
$rsPP = mysql_query($query_rsPP, $members) or die(mysql_error());
$row_rsPP = mysql_fetch_assoc($rsPP);
$totalRows_rsPP = mysql_num_rows($rsPP);

mysql_select_db($database_members, $members);
$query_rsProvince = "SELECT * FROM province_state";
$rsProvince = mysql_query($query_rsProvince, $members) or die(mysql_error());
$row_rsProvince = mysql_fetch_assoc($rsProvince);
$totalRows_rsProvince = mysql_num_rows($rsProvince);

mysql_select_db($database_members, $members);
$query_rsMemberStatus = "SELECT * FROM member_status";
$rsMemberStatus = mysql_query($query_rsMemberStatus, $members) or die(mysql_error());
$row_rsMemberStatus = mysql_fetch_assoc($rsMemberStatus);
$totalRows_rsMemberStatus = mysql_num_rows($rsMemberStatus);

mysql_select_db($database_members, $members);
$query_rsBusCat = "SELECT * FROM business_category";
$rsBusCat = mysql_query($query_rsBusCat, $members) or die(mysql_error());
$row_rsBusCat = mysql_fetch_assoc($rsBusCat);
$totalRows_rsBusCat = mysql_num_rows($rsBusCat);

mysql_select_db($database_members, $members);
$query_rsCommittees = "SELECT * FROM committee_names";
$rsCommittees = mysql_query($query_rsCommittees, $members) or die(mysql_error());
$row_rsCommittees = mysql_fetch_assoc($rsCommittees);
$totalRows_rsCommittees = mysql_num_rows($rsCommittees);?>

roby258376
05-15-2009, 04:23 AM
Hi Ray,

I reworked the code, as you suggested, and I've pasted it below. Still not working though, now it doesn't update the db at all. Is there something else I'm missing?


<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php require_once('Connections/members.php'); ?>
<?php require_once( "WA_SecurityAssist/Helper_PHP.php" );

?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once("WA_DigitalFilePro/HelperPHP.php"); ?>

<?php
if (!WA_Auth_RulePasses("Logged in to members")){
WA_Auth_RestrictAccess("members_LogIn.php?notLogged=true");
}
?>


<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Update_x"])){
WA_DFP_UploadFile("WA_UploadResult1", "pictureFile", "".((isset($_POST["picture"]))?$_POST["picture"]:"") ."", "images/members/", "[FileName]", "2", "[FileName]_[Increment]", "0", "true", "125", "0");
}?>

<?php
// WA Application Builder Update
if (isset($_POST["Update_x"])) // Trigger
{
$WA_connection = $members;
$WA_table = "members";
$WA_redirectURL = "members_Profile.php";
$WA_keepQueryString = false;
$WA_indexField = "UserID";
$WA_fieldNamesStr = "userName|password|lastName|firstName|member_status |company|title|address|city|province_state|pc_zip| telephone|fax|cell_phone|url|business_category|pic ture|committee_ID|committee_2_ID";
$WA_fieldValuesStr = "".((isset($_POST["userName"]))?$_POST["userName"]:"") ."" . "|" . "".((isset($_POST["password"]))?$_POST["password"]:"") ."" . "|" . "".((isset($_POST["lastName"]))?$_POST["lastName"]:"") ."" . "|" . "".((isset($_POST["firstName"]))?$_POST["firstName"]:"") ."" . "|" . "".((isset($_POST["member_status"]))?$_POST["member_status"]:"") ."" . "|" . "".((isset($_POST["company"]))?$_POST["company"]:"") ."" . "|" . "".((isset($_POST["title"]))?$_POST["title"]:"") ."" . "|" . "".((isset($_POST["address"]))?$_POST["address"]:"") ."" . "|" . "".((isset($_POST["city"]))?$_POST["city"]:"") ."" . "|" . "".((isset($_POST["province_state"]))?$_POST["province_state"]:"") ."" . "|" . "".((isset($_POST["pc_zip"]))?$_POST["pc_zip"]:"") ."" . "|" . "".((isset($_POST["telephone"]))?$_POST["telephone"]:"") ."" . "|" . "".((isset($_POST["fax"]))?$_POST["fax"]:"") ."" . "|" . "".((isset($_POST["cell_phone"]))?$_POST["cell_phone"]:"") ."" . "|" . "".((isset($_POST["url"]))?$_POST["url"]:"") ."" . "|" . "".((isset($_POST["business_category"]))?$_POST["business_category"]:"") ."" . "|" . "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."" . "|" . "".((isset($_POST["committee_ID"]))?$_POST["committee_ID"]:"") ."" . "|" . "".((isset($_POST["committee_2_ID"]))?$_POST["committee_2_ID"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''|',none,''|',none,''| ',none,''|',none,''|',none,''|',none,''";
$WA_comparisonStr = "=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);

$WA_where_fieldValuesStr = "".$row_WAATKmembers['UserID'] ."";
$WA_where_columnTypesStr = "none,none,NULL";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);

$WA_connectionDB = $database_members;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>





<?php

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$ParamUserID_WAATKmembers = "-1";
if (isset($_SESSION['UserID'])) {
$ParamUserID_WAATKmembers = (get_magic_quotes_gpc()) ? $_SESSION['UserID'] : addslashes($_SESSION['UserID']);
}
mysql_select_db($database_members, $members);
$query_WAATKmembers = sprintf("SELECT * FROM members WHERE UserID = %s", $ParamUserID_WAATKmembers);
$WAATKmembers = mysql_query($query_WAATKmembers, $members) or die(mysql_error());
$row_WAATKmembers = mysql_fetch_assoc($WAATKmembers);
$totalRows_WAATKmembers = mysql_num_rows($WAATKmembers);

mysql_select_db($database_members, $members);
$query_rsPP = "SELECT * FROM yesno";
$rsPP = mysql_query($query_rsPP, $members) or die(mysql_error());
$row_rsPP = mysql_fetch_assoc($rsPP);
$totalRows_rsPP = mysql_num_rows($rsPP);

mysql_select_db($database_members, $members);
$query_rsProvince = "SELECT * FROM province_state";
$rsProvince = mysql_query($query_rsProvince, $members) or die(mysql_error());
$row_rsProvince = mysql_fetch_assoc($rsProvince);
$totalRows_rsProvince = mysql_num_rows($rsProvince);

mysql_select_db($database_members, $members);
$query_rsMemberStatus = "SELECT * FROM member_status";
$rsMemberStatus = mysql_query($query_rsMemberStatus, $members) or die(mysql_error());
$row_rsMemberStatus = mysql_fetch_assoc($rsMemberStatus);
$totalRows_rsMemberStatus = mysql_num_rows($rsMemberStatus);

mysql_select_db($database_members, $members);
$query_rsBusCat = "SELECT * FROM business_category";
$rsBusCat = mysql_query($query_rsBusCat, $members) or die(mysql_error());
$row_rsBusCat = mysql_fetch_assoc($rsBusCat);
$totalRows_rsBusCat = mysql_num_rows($rsBusCat);

mysql_select_db($database_members, $members);
$query_rsCommittees = "SELECT * FROM committee_names";
$rsCommittees = mysql_query($query_rsCommittees, $members) or die(mysql_error());
$row_rsCommittees = mysql_fetch_assoc($rsCommittees);
$totalRows_rsCommittees = mysql_num_rows($rsCommittees);?>

Ray Borduin
05-15-2009, 07:10 AM
All we did is move the update code higher on the page. I can't imagine how that would make it stop working.

Do you get an error? Anything else you might have changed? Changing the order of the code is unlikely to make it stop working, expecially moving it up should just make it run that much sooner, so it is difficult to imagine that being the cause of it not working now.

roby258376
05-15-2009, 10:29 AM
Hi Ray,

I don't get an error, the page seems to do it's thing but the db is not updated and when the page reloads the change is not there.

There was one thing I changed, which I assumed would be ok.

In my orignal code, 2 of the blocks of code you had me move were surrounded by the same php tags <?php ?> Since you indicated they needed to be split, I added the ending tag to the first block and an opening tag to the second block, creating 2 seperate blocks. ie.


<?php
if (!isset($_SESSION)) {
session_start();
}
?>
<?php require_once('Connections/members.php'); ?>
<?php require_once( "WA_SecurityAssist/Helper_PHP.php" );

?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once("WA_DigitalFilePro/HelperPHP.php"); ?>

<?php
if (!WA_Auth_RulePasses("Logged in to members")){
WA_Auth_RestrictAccess("members_LogIn.php?notLogged=true");
}


**********
you had me split the code here and insert the WA_DFP_SetupUploadStatusStruct and WA Application Builder Update code. essentially moving the next chunk of code down, so I ended the code block above with ?> and added a <?php tag to the next chunk.
**************

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>

Ray Borduin
05-15-2009, 10:31 AM
It shouldn't matter if code is broken into one two or more blocks.

I would use die() statements to debug what is happenning. It seems like it would work if it worked before. No errors? Does it redirect? Did you update the button on the page by any chance?

roby258376
05-15-2009, 03:07 PM
Didn't touch the button, didn't do anything other than reorder the code. I'm redirecting back to the same page, so when a user updates their profile they see the profile page again but with the new data. Worked before except the page didn't refresh and needed to be refreshed manually. Now it's just not updating at all.

Can you point me in the direction of a die statement to debug? I'm kind of new to this.

Thanks

Ray Borduin
05-18-2009, 06:31 AM
Do you still have a copy of the page that was working and just needed a refresh?

Let's start over with that. Then post a support incident on the WebAssist web site. It will allow you to share your files in a private forum and somebody can help you directly.

roby258376
05-21-2009, 12:34 PM
Hey Ray,

Thanks for your help with this. I was playing with the files over the weekend and voila, now it's working, although I have no clue what I did that made it work.

thanks again for your help.