<?php require_once('../Connections/paivaconex.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_clientes = "-1";
if (isset($_POST['id'])) {
  $colname_clientes = $_POST['id'];
}
mysql_select_db($database_paivaconex, $paivaconex);
$query_clientes = sprintf("SELECT * FROM mfin_clientes WHERE Id = %s", GetSQLValueString($colname_clientes, "int"));
$clientes = mysql_query($query_clientes, $paivaconex) or die(mysql_error());
$row_clientes = mysql_fetch_assoc($clientes);
$totalRows_clientes = mysql_num_rows($clientes);

?>



  <tr>
    
    <td><label for="cli_nome[]"></label>
    <input type="text" name="cli_nome[]" id="cli_nome[]" value="<?php echo htmlentities($row_clientes['NomeFantasia'], ENT_COMPAT, 'iso-8859-1'); ?>">   </td>
    
    <td><label for="cli_valor[]"></label>
    <input type="text" name="cli_valor[]" id="cli_valor" class="valor" value="<?php echo $_POST['valor']; ?>">  
    </td><td><input type="button" name="remover" id="remover" value="X" /></td>
    <input type="hidden" name="cli_id[]" id="cli_id[]" value="<?php echo $row_clientes['Id']; ?>">
  </tr>





<?php
mysql_free_result($clientes);
?>
