[SOLVED] getting the value from a db field array
Posted: Sun Sep 26, 2004 2:51 pm
feyd | Please use
feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
need to collect the value from a particular field in a db as records are added, to be supplied in $NAME AND $NUMBER for the paypal link, like so (if anyone could help i'd be most appreciateive):Code: Select all
$results_table .= "<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" border="0" name="submit" width="87" height="23">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="email@address.com">
<input type="hidden" name="item_name" value=".$NAME.">
<input type="hidden" name="item_number" value=".$NUMBER.">
<input type="hidden" name="amount" value="20.00">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
";
} // end if
$results_table .= "</td>";
for ($i=0; $i<$count_temp; $i++){
if ($fields_labels_ar[$i]["present_results_search_field"] == "1"){ // the user want to display the field in the search results page
$results_table .= "<td class="".$td_results_class."">"; // start the cell
$field_name_temp = $fields_labels_ar[$i]["name_field"];
$field_value = $records_row[$field_name_temp];
$field_type = $fields_labels_ar[$i]["type_field"];
$field_content = $fields_labels_ar[$i]["content_field"];
$field_separator = $fields_labels_ar[$i]["separator_field"];
//$foreign_key_temp = $fields_labels_ar[$i]["foreign_key_field"];
$field_values_ar = array(); // reset the array containing values to display, otherwise for each loop I have the previous values
$primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"];
if ($primary_key_field_field != ""){
$primary_key_field_field = $fields_labels_ar[$i]["primary_key_field_field"];
$primary_key_table_field = $fields_labels_ar[$i]["primary_key_table_field"];
$primary_key_db_field = $fields_labels_ar[$i]["primary_key_db_field"];
$linked_fields_field = $fields_labels_ar[$i]["linked_fields_field"];
$alias_suffix_field = $fields_labels_ar[$i]["alias_suffix_field"];
$linked_fields_ar = explode($fields_labels_ar[$i]["separator_field"], $linked_fields_field);
for ($j=0;$j<count($linked_fields_ar);$j++) {
$field_values_ar[$j] .= $records_row[$linked_fields_ar[$j].$alias_prefix.$alias_suffix_field];
} // end for
}
else{
$field_values_ar[0] = $field_value;
}
$count_temp_2 = count($field_values_ar);
for ($j=0; $j<$count_temp_2; $j++) {
$field_to_display = get_field_correct_displaying($field_values_ar[$j], $field_type, $field_content, $field_separator, "results_table"); // get the correct display mode for the field
if ( $field_to_display == "") {
$field_to_display .= " ";
}
$results_table .= $field_to_display." "; // at the field value to the table
}
$results_table = substr($results_table, 0, -6); // delete the last
$results_table .= "</td>"; // end the cellfeyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]