Membership Signup Form Syntax question

By gkornbluth - August 29, 2011 - edited: August 30, 2011

Hi All,

It's time to feel silly again...

But, I could use some guidance regarding the correct syntax to use in this situation.

In a membership signup form, I want to pull the number of records allowed (maxRecords) from a text field called “entry_level_records”, in a single record editor called “subscriber_level_values”.

At the top of the page I loaded the records with:
list($subscriber_level_valuesRecords, $subscriber_level_valuesMetaData) = getRecords(array(
'tableName' => 'subscriber_level_values',
'where' => whereRecordNumberInUrl(1),
'limit' => '1',
));
$subscriber_level_valuesRecord = @$subscriber_level_valuesRecords[0]; // get first record

I defined a variable as:
<?php $records_allowed = $subscriber_level_valuesRecord['entry_level_records']; ?>
I can print out the correct value of the $records_allowed variable with:
<?php echo $records_allowed ; ?>
But when I insert the variable in the "create access list" code as below, I get a 0 as the maxRecords value.
($userNum, 'master_subscription_pages', '6', '(echo $records_allowed)', '1234567890'),
I've also tried
'echo $records_allowed'
'echo [$records_allowed]'
'(echo [$records_allowed])'

and they also rendered 0 for the maxRecords value.

Any suggestions?

Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [robin] Membership Signup Form Syntax question

By gkornbluth - August 30, 2011 - edited: August 30, 2011

Robin,

I think I found the answer.

It appears the code should be '$records_allowed' without the "echo".

Oh well.

Learning comes slow sometimes.

Thanks,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Membership Signup Form Syntax question

By robin - August 30, 2011

Hey Jerry,

Glad you got the problem fixed. Problems within a string can be hard to track down!

Thanks,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Membership Signup Form Syntax question

By gkornbluth - August 30, 2011 - edited: August 31, 2011

OK, I spoke too soon.

The code works with numerical values as the value pulled from the subscriber_level_values text field, but doesn’t work when I try to insert the value NULL.

I’ve attached the Viewer code in the hope that it's an easy solution.

Thanks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Attachments:

platinumlevelsignup.php 27K

Re: [gkornbluth] Membership Signup Form Syntax question

By robin - August 31, 2011

Hey Jerry,

I think your problem might be database related. If you try to insert a NULL into a integer field in MySQL you can't use single quotes because then it's a string 'NULL' instead of a real NULL.

so

$records_allowed instead of '$records_allowed'

Hope that helps,
Robin
Robin
Programmer
interactivetools.com

Re: [robin] Membership Signup Form Syntax question

By gkornbluth - August 31, 2011

You're SOOOO smart.

Thanks Robin
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php