[FX.php List] This is doing my head in...
Steve Winter
steve at bluecrocodile.co.nz
Sun Nov 25 07:53:12 MST 2007
Hi Roger,
Thanks for taking a look, but no, that line is fine, all that’s saying is
that for either changePassword, or changeMyDetails, at this point the action
is the same... sometimes I can have case statements 4 or 5 options long at
the top of a page, and then gradually break them out to individual sections
of code as I get further down a page...
Cheers
Steve
_____
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Roger Price
Sent: Sunday, 25 November 2007 1:59 p.m.
To: FX.php Discussion List
Subject: Re: [FX.php List] This is doing my head in...
Steve
> case 'changePassword':
Shouldn't this have some action specified such as 'do something; break;'
Roger
----- Original Message -----
From: HYPERLINK "mailto:steve at bluecrocodile.co.nz"Steve Winter
To: HYPERLINK "mailto:fx.php_list at mail.iviking.org"'FX.php Discussion List'
Sent: Thursday, November 22, 2007 2:30 PM
Subject: [FX.php List] This is doing my head in...
Hi all,
I’ve got a block of code;
$listQuery = new FX($serverIP, $serverPort, $dataSourceType);
$listQuery->SetDBUserPass($webUN, $webPW);
$listQuery->SetDBData($databaseName, 'webTutors', 'all');
$listQuery->AddSortParam('tutorNameFirst', 'ascend');
$listQuery->AddSortParam('tutorNameLast', 'ascend');
switch($_REQUEST['action']) {
case 'changePassword':
case 'changeMyDetails':
$listQuery->AddDBParam('tutorID',
$_SESSION['session']['tutorID']);
$listData = $listQuery->FMFind();
break;
default:
$listData = $listQuery->FMFindAll();
break; }
When the page is called via a ‘get’ this code runs perfectly and returns the
records.
I then lay them out in a table, allow the user to make changes, and post
them all back in a series of arrays to the database, which then modifies the
records using this code;
$fieldsToSave =
array('tutorNameTitle','tutorNameFirst','tutorNameLast','tutorFormClass','tu
torEmail','tutorAccessName','tutorAccessPassword','tutorIsAdministrator');
if($_SERVER['REQUEST_METHOD'] == 'POST') {
switch($_REQUEST['action']) {
case 'deleteStaff':
$listUpdateQuery = new FX($serverIP, $serverPort,
$dataSourceType);
$listUpdateQuery->SetDBUserPass($webUN, $webPW);
$listUpdateQuery->SetDBData($databaseName, 'webTutors');
$listUpdateQuery->AddDBParam('-recid', $_REQUEST['recID']);
$listUpdateData = $listUpdateQuery->FMDelete();
if($listUpdateData['errorCode'] == 0) $messages[] = 'mItem
deleted successfully.';
else $messages[] = 'eThe item could not be deleted.';
break;
case 'editStaff':
$sucess = 0; $counter=0;
for($j=0; $j<count($_REQUEST['tutorNameLast']); $j++) {
$listUpdateQuery = new FX($serverIP, $serverPort,
$dataSourceType);
$listUpdateQuery->SetDBUserPass($webUN, $webPW);
$listUpdateQuery->SetDBData($databaseName,
'webTutors');
foreach($fieldsToSave as $field)
$listUpdateQuery->AddDBParam($field,
$_REQUEST[$field][$j]);
if($_REQUEST['recID'][$j] != '') {
$listUpdateQuery->AddDBParam('-recid',
$_REQUEST['recID'][$j]);
$listUpdateData =
$listUpdateQuery->FMEdit(); }
else
$listUpdateData =
$listUpdateQuery->FMNew();
$counter++;
if($listUpdateData['errorCode'] == 0) $sucess++;
echo $j.'<br />'; }
if($sucess == $counter) $messages[] = 'm'.$sucess.' of
'.$counter.' items updated sucessfully.';
else $messages[] = 'e'.$sucess.' of '.$counter.' items updated
were updated. Please verify your data and try again.';
break;
}
}
And then the same piece of code at the top of the page gets called again, to
re-create my table of data.
When it’s run via the get the first time the page loads, all is good.. I get
the page I would expect with no problems...
When it gets called the second time round I get a series of errors
generated;
Warning: urlencode() expects parameter 1 to be string, array given in
D:\server\websites\msClients\3square\conduct\assets\fx\FX.php on line 1425
I’ve turned DEBUG on, the same request is generated by the code block both
times, and clicking on it gives exactly the results I would expect.
If I refresh the page, so I’m using a GET, then all works fine...
What the...?? any clues...??
Cheers
Frustrated Steve
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.3/1144 - Release Date: 21/11/2007
4:28 p.m.
_____
_______________________________________________
FX.php_List mailing list
FX.php_List at mail.iviking.org
http://www.iviking.org/mailman/listinfo/fx.php_list
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.6/1150 - Release Date: 24/11/2007
5:58 p.m.
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.6/1150 - Release Date: 24/11/2007
5:58 p.m.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20071125/76e9a3ac/attachment-0001.html
More information about the FX.php_List
mailing list