Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Ola pessoal,
Estou com problemas no codigo:
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_Recordset1 = 5;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$colname_Recordset1 = "-1";
if (isset($_GET['vendedor,mes,ano'])) {
$colname_Recordset1 = $_GET['vendedor,mes,ano'];
}
mysql_select_db($database_data, $data);
$query_Recordset1 = sprintf("SELECT * FROM os WHERE vendedor,mes,ano LIKE %s", GetSQLValueString($colname_Recordset1 . "%", "text"));
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $data) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
$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);
?>
O problema ta nesse código:
$colname_Recordset1 = "-1";
if (isset($_GET['vendedor,mes,ano'])) {
$colname_Recordset1 = $_GET['vendedor,mes,ano'];
}
mysql_select_db($database_data, $data);
$query_Recordset1 = sprintf("SELECT * FROM os WHERE vendedor,mes,ano LIKE %s", GetSQLValueString($colname_Recordset1 . "%", "text"));
Geralmente esse código funciona assim:
$colname_Recordset1 = "-1";
if (isset($_GET['ano'])) {
$colname_Recordset1 = $_GET['ano'];
}
mysql_select_db($database_data, $data);
$query_Recordset1 = sprintf("SELECT * FROM os WHERE ano LIKE %s ORDER BY ano ASC", GetSQLValueString($colname_Recordset1 . "%", "text"));
no primeiro código, da erro de sintax.
o que tenho que mudar no primeiro código para poder dar certo?
Se alguem puder ajudar
Desde já agradeço.
Carregando comentários...