[FX.php List] FX.php problem ... Record Not Found

VanBuskirk, Patricia pvanbuskirk at otc.fsu.edu
Sat Jun 6 06:44:45 MDT 2009


Hi group .. this is driving me crazy.  I've managed to get all the
records showing on one page, in a form to edit.  However, when I click
the SAVE button, I receive a "Record Not Found" error.  Can someone see
where I've gone wrong?  The first part is the form the user goes to
after logging on, the second part is the response page.  Note: The
delete buttons work, as well as the create-new form.  The Edit portion
gives me the error.  Thanks in advance!

 

<?php

session_start();

require_once('server_data3.php');

require_once('FX.php');

include_once('FMErrors.php');

 

$userID = $_SESSION['UID'];

 

// configure a connection to FileMaker Server Advanced

$users=new FX(FM_IP, FM_PORT, FM_VERSION);

// set database and layout information (uses info in included file
'server_data3.php)

$users->SetDBData(FM_DATABASE, 'SG_Users');

// set database username and password (uses info in included file
'server_data3.php)

$users->SetDBPassword(FM_USERNAME, FM_PASSWORD);

// specify the search criteria

$users->AddDBParam ('_p_UserID', $userID, 'eq');

// performs find

$usersResult=$users->FMFind();

 

$sectionName=new FX(FM_IP, FM_PORT, FM_VERSION);

$sectionName->SetDBData(FM_DATABASE, 'SG_Sections', 'all');

$sectionName->SetDBUserPass(FM_USERNAME, FM_PASSWORD);

$sectionName->AddDBParam ('_UserID', $userID, 'eq');

$sectionName->AddDBParam ('SectionIncorrect', "X", 'neq');

$sectionName->AddSortParam('_SectionID','ascend');

$sectionResult=$sectionName->FMFind();

 

$deptListQuery=new FX(FM_IP, FM_PORT, FM_VERSION);

$deptListQuery->SetDBData(FM_DATABASE, 'SeeAll', 'all');

$deptListQuery->SetDBUserPass(FM_USERNAME, FM_PASSWORD);

$deptListQuery->AddDBParam ('_UserID', $userID, 'eq');

$deptListQuery->AddDBParam ('SG_Sections::SectionIncorrect', "X",
'neq');

$deptListQuery->AddSortParam('SG_Sections::SectionName','ascend');

$deptListQuery->AddSortParam('PrintOrder','ascend');

$deptListQuery->AddSortParam('Main','descend');

$deptListQuery->AddSortParam('PrintLine','ascend');

$deptList = $deptListQuery->FMFind();

 

include_once('SG_header.php');

?>

<link href="../main.css" rel="stylesheet" type="text/css" />

<table width="842" border="0" align="center" bgcolor="#FFFFFF">

  <tr>

    <td>

      <table>

        <tr class="SGtable">

          <td colspan="9" align="center" valign="bottom"
class="blue">You Have <?php echo $deptList['foundCount']; ?>
LISTING(S)</td>

        </tr>

        <tr valign="bottom">

          <td align="center" class="ColumnHeader">Delete</td>

          <td nowrap="nowrap" class="ColumnHeader">Section Name</td>

          <td align="center" class="ColumnHeader">Print<br />

            Order</td>

          <td align="center" class="ColumnHeader"><span
class="style2">*<br />

            </span>Main<br />

            Listing?</td>

          <td nowrap="nowrap" class="ColumnHeader">Listing</td>

          <td class="ColumnHeader">Address<br /></td>

          <td align="center" nowrap="nowrap" class="ColumnHeader"
id="t_Phone">Phone # <br />

            &nbsp;<span class="crumbs">XXX-XXXX</span></td>

          <td align="center" class="ColumnHeader"><span
class="style2">**</span><br />

            Embarq?</td>

          <td align="center" class="ColumnHeader">Save<br />

          Changes</td>

        </tr>

        <tr valign="bottom">

          <td colspan="9" align="right" class="crumbs"><strong> Address
Format: Room number, Building abbreviation - i.e. 6100 UCC</strong></td>

        </tr>

        <?php

                foreach($deptList['data'] as $currentID=>$Listing){

                $recordDetails=explode('.',$currentID);

                $Record=$recordDetails[0];

                ?>

        <form action='edit_response.php' method='post'>

          <input type='hidden' name='_SectionID' value='<?php echo
$Listing['_SectionID'][0]; ?>' />

          <input type='hidden' name='recid' value='<?php $Record ?>' />

          <tr>

            <td align='center' valign='top'><a
href="delete.php?recid=<?php echo $Record; ?>"><img
src="images/delete.png" alt="delete" width="16" height="16" border="0"
/></a></td>

            <td valign="top" class='data'><?php echo
$Listing['SG_Sections::SectionName'][0] ?></td>

            <td valign="top"><input type='text' class='formfields'
name='web_newsort' value='<?php echo $Listing['PrintOrder'][0] ?>'
size='3' align='center' /></td>

            <td valign="top"><input type='text' class='formfields'
name='Main' value='<?php echo $Listing['Main'][0] ?>' size='2' /></td>

            <td align='center' valign="top"><input type='text'
class='formfields' name='PrintLine' value='<?php echo
$Listing['PrintLine'][0] ?>' size='50' /></td>

            <td valign="top"><input type='text' class='formfields'
name='Address' value='<?php echo $Listing['Address'][0] ?>' size='15'
/></td>

            <td align='center' valign="top"><input type='text'
class='formfields' name='Phone' value='<?php echo $Listing['Phone'][0]
?>' size='10' /></td>

            <td align='center' valign="top"><input type='text'
class='formfields' name='Embarq' value='<?php echo $Listing['Embarq'][0]
?>' size='2' /></td>

            <td valign='top'><input name='update_record' type='submit'
class='tiny' value='Save' />            </td>

          </tr>

                                  <?php

                                  }

                                  ?>

        </form>

      </table>

      <table width="100%" align="center" class="SGtable" valign='top'>

    <tr>

      <td class="whitecaps" style="background-color:#999999">ADD NEW
LINE:</td>

  </tr>

</table>

<table width="100%" align="center" class="SGtable">

  <tr class="SGtable">

    <td align="center" valign="bottom" class="ColumnHeader">Section 

      Name</td>

    <td align="center" valign="bottom" class="ColumnHeader">Print<br>

      Order</td>

    <td align="center" valign="bottom" class="ColumnHeader">Main</td>

    <td align="center" valign="bottom" class="ColumnHeader">Listing</td>

    <td align="center" valign="bottom" class="ColumnHeader">Address</td>

    <td align="center" valign="bottom" class="ColumnHeader">Phone<br>

      #</td>

    <td align="center" valign="bottom" class="ColumnHeader">Embarq</td>

    <td align="center" valign="bottom" class="ColumnHeader">&nbsp;</td>

  </tr>

    <form action="new_response.php" method="post"
name="create_new_record">

      <tr>

        <td valign="bottom">

          <select name="_tempText" class="formfields">

            <?php

 
foreach($sectionResult['data'] as $key=>$sectionData) {

 
echo "<option>".$sectionData['SectionNameCombined'][0]."</option> \n";

 
}

 
?>

          </select>                                   </td>

          <td align="center" valign="bottom"><input name="web_newsort"
type="text" class="formfields" value="" size="5" /></td>

          <td align="center" valign="bottom"><input name="Main"
type="text" class="formfields" value="" size="3" maxlength="1" /></td>

          <td align="left" valign="bottom"><input type="text"
class="formfields" name="PrintLine" value="" /></td>

          <td valign="bottom"><input type="text" class="formfields"
name="Address" value="" size="20" /></td>

          <td valign="bottom"><input type="text" class="formfields"
name="Phone" value="" size="10" /></td>

          <td align="center" valign="bottom"><input name="Embarq"
type="text" class="formfields" value="" size="3" maxlength="1" /></td>

          <td align="center"><span class="style13">

            <input name="clear" type="reset" class="tiny" value="Clear
Input">

          </span></td>

      </tr>

      <tr>

        <td colspan="8" align="center" valign="bottom">&nbsp;

          <label>

                                 <input type="hidden" name="Web"
value="Y" />

         <input name="new_record" type="submit" class="header"
value="Submit NEW">

          </label></td>

        </tr>

  </form>

</table>

                </td>

  </tr>

</table>

<br>

<?php

include_once('SG_footer.php');

?>

 

 

 

Edit_response.php:

 

<?php

session_start(); // Turn on sessions

include_once('FX.php');

include_once('server_data3.php');

include_once('FMErrors.php');

 

if (!isset($_POST['recid'])) {

                include_once('SG_header.php');

                echo "<table width='845' class='SGtable' align='center'
cellpadding='6' cellspacing='2' bgcolor='#FFFFFF'><tr><td>";

                echo "<p align='center' class='bold-red'>ERROR: You must
be logged in to go to this page!</p>";

                echo "<p align='center'><a href='Login.php'
class='SG_buttons'>Login</a></p><br></td></tr></table>";

                include_once('SG_footer2.php');

                exit();

                } else {

                

$userID=$_SESSION['UID'];

$recid=$_POST['recid'];

 

function convert_smart_quotes($string) 

{

     $search = array(chr(145),

                                 chr(146),

 
chr(147),

 
chr(148),

 
chr(150),

 
chr(151),

 
"-",

 
"-",

 
"#",

 
";",

 
"[",

 
"]",

 
"{",

 
"}",

 
"<",

 
">",

 
"=",

 
"http://",

 
"URL=http://");

      $replace = array("'",

                                   "'",

 
'"',

 
'"',

 
"-",

 
"-",

 
"---",

 
"--",

 
"no.",

 
",",

 
"",

 
"",

 
"",

 
"",

 
"",

 
"",

 
"-",

 
"",

 
"");

      return str_replace($search, $replace, $string); }

 

$printline = convert_smart_quotes($_POST['PrintLine']);

$address = convert_smart_quotes($_POST['Address']);

 

$editRecordArray = array('Main' => $_POST['Main'],'PrintLine' =>
stripslashes($printline), 'Address' => stripslashes($address),'Phone' =>
stripslashes($_POST['Phone']), 'Embarq' => $_POST['Embarq']);

 

$edit=new FX(FM_IP, FM_PORT, FM_VERSION);

$edit->SetDBData(FM_DATABASE, 'SeeAll');

$edit->SetDBUserPass(FM_USERNAME, FM_PASSWORD);

$edit->AddDBParam('-recid',$recid);

$edit->AddDBParamArray($editRecordArray);

$editResult=$edit->FMEdit();

 

if ($editResult['errorCode']!=0) {

                echo "<br>Error Code:  ".$editResult['errorCode'];

                } else {

                echo "Thanks!";

                echo $recid;

                //header("Location:
http://www2.otc.fsu.edu/Forms/DD_Test/show_all3.php");

                }

}

?>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20090606/b5c41f69/attachment-0001.html


More information about the FX.php_List mailing list