Jump to content

Using variables to find a db field: PHP FM12


This topic is 2589 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi, I have a field called 'mytournament1'.  I also have a field called 'mytournament1played'.  With a form, I create the variable $tournament to bring 'mytournament1' to my results page.

$tournament = $_GET['tournament'];

I'd like to force the results page to search for the field 'mytournament1played' for each record by using the variable $tournament and combining the word 'played' or the variable $played.  

$played = 'played';

$tournamentplayed = $tournament . $played;

$tournamentplayed2 = $record->getField('$tournamentplayed');

(I want it to deliver)      $record->getField('mytournament1played');


I know the 1st '$record->getField' line is wrong.  Can I combine 2 variables that spell out a database field name (mytournament1played) that can be used to call up a field in a search?  i.e.

if ($tournamentplayed2!='1') {


thanks in advance for your help!

 

Link to comment
Share on other sites

This topic is 2589 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.