Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

espiculo

Recordset filtrando por session

Recommended Posts

ola .. fiz um recordeset asim na pagina do ussuario .. para lista os cadastro que o ussuario fez .. quero compra o numero do id do ussuario com o numero que esta em outra tabela que e o numero de id dele ..

 

emtao para saber o id dele ussei o session...

codigo do id do ussaario..

$_SESSION['kt_login_id']

emtao fiz um recordeset asim .... filtrando po session = kt_login_id ..

 

e depois fiz asim ..

 

codigo.

<?php if(isset($row_Recordset[‘primary_key)) {

tabela div ..conteudo que o ussuario cadastro .....

 

<?php } else { ?>

 

nada cadastrado no db ....

 

<?php } ?>

 

mais so mostra nada cadastrado no db ele nao esta fazendo a comparancao dos id .. do ussuario e a outra tabela que esta o id dele para lista os registro so daquele ussario .....

 

.....me ajudem ae uque esta de errado ai ???

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara coloca a parte do Recordset para a galera dar uma olhada..Ok

 

Estou terminando a instalacao do meu DW ...aqui e ja te ajudo nessa parada..

Compartilhar este post


Link para o post
Compartilhar em outros sites

ai o 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;

}

}

 

$colname_anuncio = "-1";

if (isset($_SESSION['kt_login_id'])) {

$colname_anuncio = $_SESSION['kt_login_id'];

}

mysql_select_db($database_hortoweb, $hortoweb);

$query_anuncio = sprintf("SELECT id, empresa, site, email, foto, mapa_cidade, mapa_estado FROM anuncios WHERE primary_key = %s", GetSQLValueString($colname_anuncio, "int"));

$anuncio = mysql_query($query_anuncio, $hortoweb) or die(mysql_error());

$row_anuncio = mysql_fetch_assoc($anuncio);

$totalRows_anuncio = mysql_num_rows($anuncio);

ai eu coloquei rom_recordeset mais e $row_anuncio ... so isso ... mais ainda nao aparece .. so a mensagem que mensonei

Compartilhar este post


Link para o post
Compartilhar em outros sites

codigo da pagina toda

 

<?php require_once('../../Connections/hortoweb.php'); ?>

<?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_anuncio = "-1";

if (isset($_SESSION['kt_login_id'])) {

$colname_anuncio = $_SESSION['kt_login_id'];

}

mysql_select_db($database_hortoweb, $hortoweb);

$query_anuncio = sprintf("SELECT id, empresa, site, email, foto, mapa_cidade, mapa_estado FROM anuncios WHERE primary_key = %s", GetSQLValueString($colname_anuncio, "int"));

$anuncio = mysql_query($query_anuncio, $hortoweb) or die(mysql_error());

$row_anuncio = mysql_fetch_assoc($anuncio);

$totalRows_anuncio = mysql_num_rows($anuncio);

 

// Load the tNG classes

require_once('../includes/tng/tNG.inc.php');

 

// Make unified connection variable

$conn_user = new KT_connection($user, $database_user);

 

//Start Restrict Access To Page

$restrict = new tNG_RestrictAccess($conn_user, "../");

//Grand Levels: Level

$restrict->addLevel("10");

$restrict->Execute();

//End Restrict Access To Page

?>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html><!-- InstanceBegin template="/Templates/user_logado_gratis.dwt" codeOutsideHTMLIsLocked="false" -->

<head>

<!-- InstanceBeginEditable name="doctitle" -->

<title>Admin</title>

<!-- InstanceEndEditable -->

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<style media="all" type="text/css">

@import "../../css/all.css";.style3 {font-size: 13px;

color: #43729F;

width: 300px;

height: 128px;

}

.style4 {font-size: 36px;

color: #43729F;

}

#apDiv1 {

position:absolute;

left:461px;

top:223px;

width:368px;

height:36px;

z-index:1;

visibility: inherit;

}

.maps { background-color: #483F64;

border: 1px solid #C8BA92;

font-family: Arial, Helvetica, sans-serif;

}

</style>

<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->

</head>

<body>

<div id="main">

<div id="header">

<a href="../../index.html" class="logo"><img src="../../img/logo_feito.png" width="330" height="100" alt="" /></a>

<ul id="top-navigation" name="top-navigation">

<li><span><span><a href="../../index.php">Index</a></span></span></li>

<li class="active"><span><span><a href="index.php">Panel Do Assinante</a></span></span></li>

<li><span><span><a href="../../campanha.php">Campanha</a></span></span></li>

<li><span><span><a href="../../planos">Nossos Planos</a></span></span></li>

<li><span><span><a href="#">Area de Cobertura</a></span></span></li>

<li ><span><span><a href="#">Anuncie</a></span></span></li>

<li><span><span><a href="#">Contato</a></span></span></li>

 

</ul>

</div>

<div id="middle">

<div id="left-column">

<h3>Panel </h3>

<ul class="nav">

<li><a href="#">Editar dados pessoais</a></li>

<li ><a href="#">Exibir anuncios/ Altera</a></li>

<li><a href="#">Mudar meu Plano</a></li>

<li><a href="#">Help Desk</a></li>

<li class="last"><a href="#">Cadastra minha Cidade</a></li>

</ul>

<a href="#" class="link">Sair </a>

 

</div>

<div id="center-column">

<div class="top-bar">

<a href="#" class="button">ajuda </a>

<div class="style3">

<div class="style4" id="apDiv1">Bem-Vindo </div>

<img src="../../img/Favorite.png" alt="mapa" width="128" height="128" /></div>

<h1> </h1>

<!-- InstanceBeginEditable name="menus" -->

<p>

<!--consuta pelo primery_key do ussuario -->

</p>

<p>

<?php if(isset($row_anuncio[‘primary_key)) { /* essa linha verifica se existe algum registro listado no recordset banner, se existir vai aparecer a tabela referente ao banner */ ?>

</p>

<p>lista </p>

<p>

<? } else {?>

</p>

<table width="550" height="73" border="0" cellpadding="0" cellspacing="0" class="box">

<tr>

<th class="box" ><p align="left" >Iniciar Sua campanha on-line </p>

<p align="left">Quando estiver tudo pronto, o seu anúncios serão veiculado na Hortoweb </p>

<p align="left">

<label>

<input type="submit" name="button2" id="button2" value="Cadastra meu Anuncio" />

</label>

</p></th>

</tr>

</table>

 

<p>

<? } ?>

</p>

<p> </p>

<!-- InstanceEndEditable -->

<div class="breadcrumbs"></div>

</div><br />

</div>

<div id="right-column">

<strong class="h">Obrigado</strong>

<div class="box">Sua participação em Nosso Site com certeza beneficiará sua empresacom como eficiência ainda maior!!. Obrigado por Cadastra</div>

</div>

</div>

<div id="footer"></div>

</div>

 

</body>

<?php

mysql_free_result($anuncio);

?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom , eu utilizo muito ASP.... e acho q o seu problema esta nessa linha aqui.

 

mysql_select_db($database_hortoweb, $hortoweb);
$query_anuncio = sprintf("SELECT id, empresa, site, email, foto, mapa_cidade, mapa_estado FROM anuncios WHERE primary_key = %s", GetSQLValueString($colname_anuncio, "int"));
$anuncio = mysql_query($query_anuncio, $hortoweb) or die(mysql_error());
$row_anuncio = mysql_fetch_assoc($anuncio);
$totalRows_anuncio = mysql_num_rows($anuncio);

Tente assim no lugar de primary_key, coloque o ID.

 

Pelo q entendi , você quer pegar o ID da tabela anuncios e comparar com o ID do usuario logado...

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.