Jump to content


Photo

Session no dreamwave


  • Faça o login para participar
1 reply to this topic

#1 Alexandte barros

Alexandte barros

    Novato no fórum

  • Usuários
  • 1 posts
  • Sexo:Masculino
  • Localidade:ouro preto

Posted 23/10/2016, 22:04

Boa noite estou começando um site e preciso de ajuda.

 

1º já conseguir fazer a pagina de login:

2º ja consigo pegar a variavel {Session.MM_Username}

 

Problema nao consigo fazer um recordset que filtre minha tabela usando a variavel MM_Username;

 
SELECT sum(deb_valor)
FROM debito
WHERE comp_nome = colname  
 
no lugar de colname tem entrar a variavel MM_Username mas a consulta sempre volta em branco.
eu acho que aqui deveria receber a varial mas nao recebe
$query_Recordset1 = sprintf("SELECT sum(deb_valor) FROM debito WHERE comp_nome = ******(aqui)%s(aqui) ******", GetSQLValueString($colname_Recordset1, "text"));
 
alguem tem uma luz?
 
desde já agradeço
 
 
Segue codigo da pagina.
 
 
 
<?php require_once('Connections/conexao.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_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_Recordset1 = $_SESSION['MM_Username'];
}
mysql_select_db($database_conexao, $conexao);
$query_Recordset1 = sprintf("SELECT sum(deb_valor) FROM debito WHERE comp_nome = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $conexao) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
 
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}
?>
<?php require_once('Connections/conexao.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
 
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false && 
        stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
 
$queryString_Recordset2 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset2") == false && 
        stristr($param, "totalRows_Recordset2") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset2 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Resumo Cliente</title>
<style type="text/css">
body,td,th {
color: #000;
}
</style>
</head>
 
<body>
<?php echo $_SESSION['MM_Username']; ?>
<?php echo $row_Recordset1['sum(deb_valor)']; ?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
 
 
 

 


Consegui tirando uma parte do codigo.

valeu
$colname_Recordset1 = $_SESSION['MM_Username'];
//$colname_Recordset1 = "-1";
//if (isset($_GET['MM_Username'])) {
//  $colname_Recordset1 = $_GET['MM_Username'];
//}
mysql_select_db($database_conexao, $conexao);
$query_Recordset1 = sprintf("SELECT sum(Deb_valor) FROM debito WHERE comp_nome = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $conexao) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);


#2 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 20/09/2017, 18:36

Alli Weight Loss In Stock cialis Keflex Children
Buy Amoxicillin Boniva
Viagra Discount online pharmacy Propecia Sterilizzazione




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq