
Inner Join Socorro!
#1
Posted 07/12/2010, 17:15
<?php require_once('Connections/data.php'); ?>
<?php require_once('Connections/data.php'); ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?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;
}
}
$colname_DetailRS1 = "-1";
if (isset($_GET['recordID'])) {
$colname_DetailRS1 = $_GET['recordID'];
}
mysql_select_db($database_data, $data);
$query_DetailRS1 = sprintf("SELECT * FROM ordemservico INNER JOIN cliente ON ordemservico.Cliente = nome WHERE Cod_Equipamento = %s", GetSQLValueString($colname_DetailRS1, "int"));
$DetailRS1 = mysql_query($query_DetailRS1, $data) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
$totalRows_DetailRS1 = mysql_num_rows($DetailRS1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>.:: Intranet Pro CAB ::.</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p>
<script type="text/javascript">
self.print ();
</script>
<table width="640" border="1" align="center" cellpadding="4" cellspacing=" 0" bordercolor="#000000">
<tr>
<td><table width="100%" border="0" cellspacing=" 0" cellpadding="0">
<tr bgcolor="#FFFFCC">
<td width="151"><img src="img/logo-procab.png" width="224" height="93" alt="Logo Pro CAB" /></td>
<td align="center" bgcolor="#FFFFCC"><p><b>ORDEM
DE SERVIÇO - No. <?php echo $row_DetailRS1['Cod_Equipamento']; ?><br />
</b>Pro CAB TECNOLOGIA EM REDES LTDA - Av. Oito de Dezembro, nº 31, Centro - 36.307-250 - Telefone: (32) 3372-7033 - Site: www.ProcabRedes.com.br</p></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing=" 0" cellpadding="0">
<tr>
<td width="276"><b><font color="#000000">TÉCNICO
RESPONSÁVEL</font></b><font color="#000000"><?php echo $row_DetailRS1['Funcionario']; ?></font> <font color="#000000"><br />
</font></td>
<td width="176"><b>DATA
ENTRADA </b><?php echo $row_DetailRS1['Data_Entrada']; ?><b><br />
</b></td>
<td width="176" valign="top"><b>HORA
ENTRADA </b><?php echo $row_DetailRS1['Hora_Entrada']; ?><b><br />
</b></td>
</tr>
</table></td>
</tr>
<tr>
<td><div align="left">
<table width="100%" border="0" cellspacing=" 0" cellpadding="0">
<tr>
<td><div align="center"><b>DADOS
DO CLIENTE</b></div></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="450"><b>Razão
Social/Nome :</b> <?php echo $row_DetailRS1['Cliente']; ?><br />
</td>
<td><b>CGC/CPF:</b> <?php echo $row_DetailRS1['cpf']; ?><br /></td>
</tr>
</table>
<b>Endereço:</b> <span class="verdana"></span><span class="verdana"></span><?php echo $row_DetailRS1['endereco']; ?><br />
<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="189"><strong>Bairro:</strong> <?php echo $row_DetailRS1['bairro']; ?></td>
<td width="146"><strong>Cidade:</strong> <?php echo $row_DetailRS1['cidade']; ?></td>
<td width="143"><b><strong>Estado: </strong></b><?php echo $row_DetailRS1['estado']; ?></td>
<td width="140"><strong>CEP:</strong> <?php echo $row_DetailRS1['cep']; ?><br /></td>
</tr>
<tr>
<td colspan="3"><b>Telefones: </b> <span class="verdana"></span><?php echo $row_DetailRS1['fone_com']; ?>/<span class="verdana"></span> <?php echo $row_DetailRS1['fone_res']; ?>/<span class="verdana"></span> <?php echo $row_DetailRS1['celular']; ?></td>
<td><b>E-mail: </b><span class="verdana"></span> <?php echo $row_DetailRS1['email']; ?></td>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td colspan="2"><div align="center"><b>DADOS
DO EQUIPAMENTO</b></div></td>
</tr>
<tr>
<td width="239" valign="top"><b> Produtos:
</b><?php echo $row_DetailRS1['Equipamento']; ?><b><br />
</b></td>
<td width="383" valign="top"><b>Tipo de Serviço:
</b><?php echo $row_DetailRS1['Marca']; ?><b><br />
</b></td>
</tr>
<tr>
<td colspan="2" valign="top"><b>Materias Necessários: </b><?php echo $row_DetailRS1['Modelo']; ?><b><br />
</b></td>
</tr>
<tr>
<td colspan="2" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%"><b>Ferramentas Necessárias:<br />
</b><?php echo $row_DetailRS1['Setor']; ?><b><br />
<br />
</b></td>
<td width="26%"><b>Garantia:<br />
</b><?php echo $row_DetailRS1['Garantia']; ?><b><br />
</b></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top"><p><b>Observações:<br />
</b><?php echo $row_DetailRS1['Problemacliente']; ?><b><br />
</b> </p>
<p align="right"> </p></td>
</tr>
<tr>
<td valign="top"> ______________________ <br />
<b> Assinatura
do Técnico</b> </td>
<td valign="top"><div align="right">_____________________ <br />
<b> Assinatura
do Cliente</b> <b> </b></div></td>
</tr>
</table></td>
</tr>
<tr>
<td><div align="center"><b>Pro CAB TECNOLOGIA EM REDES LTDA - Av. Oito de Dezembro, nº 31, Centro - 36.307-250 - Telefone: (32) 3372-7033 - Site: www.ProcabRedes.com.br</b></div></td>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>
<?php
mysql_free_result($DetailRS1);
?>
#2
Posted 09/12/2010, 13:12
$query_DetailRS1 = sprintf("SELECT os.*, cli.* FROM ordemservico os INNER JOIN cliente cli ON os.Cliente = nome WHERE os.Cod_Equipamento = %s", GetSQLValueString($colname_DetailRS1, "int"));
Edição feita por: Laureano Pereira, 09/12/2010, 13:13.
#3
Posted 10/12/2010, 07:14
Tende fazer assim a sua consulta:
$query_DetailRS1 = sprintf("SELECT os.*, cli.* FROM ordemservico os INNER JOIN cliente cli ON os.Cliente = nome WHERE os.Cod_Equipamento = %s", GetSQLValueString($colname_DetailRS1, "int"));
Amigo, trocando a linha, todos os campos ficarão em branco.
#4
Posted 10/12/2010, 10:17
Tende fazer assim a sua consulta:
$query_DetailRS1 = sprintf("SELECT os.*, cli.* FROM ordemservico os INNER JOIN cliente cli ON os.Cliente = nome WHERE os.Cod_Equipamento = %s", GetSQLValueString($colname_DetailRS1, "int"));
Amigo, trocando a linha, todos os campos ficarão em branco.
Testa a consulta diretamente no phpmyadmin, ou mysql query browser, troca só a variável na cláusula where por um valor... e vê o resultado
#5
Posted 10/12/2010, 10:28
vem a resposta: SELECT command denied to user 'procabrede'@'187.17.98.11' for table 'cliente'
#6
Posted 13/12/2010, 10:44
#7
Posted 13/12/2010, 16:50
Segue alguns arquivos os arquivo
Attached Files
Edição feita por: guikassio, 13/12/2010, 16:50.
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)