The following code produces each result as text. I would like to add some html to each result, to change it from regular text to an href tag:
while (!$recordSet->EOF()) {
if ($pclass_name_list == '') {
$pclass_name_list .= $recordSet->fields['class_name'];
} else {
$pclass_name_list .= ',' . $recordSet->fields['class_name'];
}
$recordSet->MoveNext();
}
The above produces Result 1, Result 2. I'd like to change these to
<a href="">Result 1</a>
<a href="">Result 2</a>
etc..
If you are doing a simple addition of content into a string, you can either wrap the variable in curly braces and include it in a string that has double quotes (as below), or you can use the sprintf function to merge content into a template.
$pclass_name_list = array();
while (!$recordSet->EOF()) {
$current_class_name = $recordSet->fields['class_name'];
$pclass_name_list[] = "<a href=\"#\">{$current_class_name}</a>";
$recordSet->MoveNext();
}
$pclass_name_list = implode(", ", $pclass_name_list);