I am trying to create a condition in which basis
Column Name Field Name Field Value
of mysql database, a conditional script should show in - Attached Table

ColumnName - FormId Fieldname - Listing Fieldvalue - Listing Value
Below is script
$max = 1;
$listing = JRequest::getInt('listing');
if($listing) {
$db = JFactory::getDBO();
$db->setQuery("SELECT COUNT(`SubmissionId`) FROM #__rsform_submission_values WHERE `FormId`='".(int) $formId."' AND `FieldName`='listing' AND `FieldValue`='".$listing."' ");
$nrSub = $db->loadResult();
if ($nrSub >= $max) {
$formLayout = '<p>Sorry, no more submissions are accepted for this car.</p>';
}
}
I think am messing up with Fieldvalue column - may be it might not be able to fetch in value. Can someone help and advise pls
COUNT(SubmissionId), you have to use column names if you need values