ao hostdesigner:
sim... concordo com vc, mas e qnd eu quero fazer relacionamento de n pra 1 ?
ou seja, qnd eu quero q o usuario "john" e mais uns 20 possam ler a noticia ?
do jeito que eu fiz, foi o melhor q eu encontrei!
com 3 tabelas
uma de usuario
uma de noticia
uma de usuario e noticia (q lista o id do usuario e o id da noticia)
a minha duvida eh em relacao ao "warning".. como tirar ele.. e pq ele aparece ?!
- Fórum WMO
- → Viewing Profile: Posts: Igor_baballo
Community Stats
- Group Usuários
- Active Posts 25
- Profile Views 844
- Member Title Turista
- Age Age Unknown
- Birthday Birthday Unknown
-
Sexo
Não informado
0
Neutral
User Tools
Friends
Igor_baballo hasn't added any friends yet.
Latest Visitors
-
Guest
04/11/2007, 05:56
Posts I've Made
In Topic: Um 'warning' Q Eu Nunca Vi....
14/06/2005, 23:12
In Topic: Um 'warning' Q Eu Nunca Vi....
14/06/2005, 20:43
o codigo tah ai:
se alguem puder ajudar!
ahhhhhhhh
outra pergunta:
pq eu naum to conseguindo vizualizar qnd coloco pagina.php?acao=entrar?
if($acao == 'buscar') { ######### BUSCA PELO CALENDARIO #########
$data = $_GET['data']; ########## PEGA A DATA PELA URL #########
######### FAZ UM SELECT NO BANCO DE DADOS #########
$busca = "SELECT tb_noticias.* FROM tb_noticias, tb_usuario_noticia WHERE tb_usuario_noticia.ID_NOTICIA = tb_noticias.ID_NOTICIA AND tb_usuario_noticia.ID_USUARIO = '".$_SESSION["id"]."' AND tb_noticias.DATA = '$data' order by tb_noticias.ID_NOTICIA desc";
$total_reg = "3"; //Número de registros por página
if(!$pagina) {
$pagina = "1";
$pc = $pagina;
} else {
$pc = $pagina;
}
$inicio = $pc-1;
$inicio = $inicio*$total_reg;
//vamos selecionar os dados
$limite = mysql_query("$busca LIMIT $inicio,$total_reg");
$todos = mysql_query("$busca");
$tr = mysql_num_rows($todos); // verifica o número total de registros
$tp = $tr / $total_reg; // verifica o número total de páginas
########## INSERE OS DADOS EM UMA TABELA #########
echo
"<body bgcolor=#FFFFFF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<table width=799 border=1 cellspacing=0 cellpadding=0>
<tr>
<td>
<table width=200 border=0 cellspacing=0 cellpadding=0>
<tr>
<td colspan=3><img src=imagens/cliente/cliente_r1_c1.jpg width=200 height=65></td>
</tr>
<tr>
<td><img src=imagens/cliente/cliente_r2_c1.jpg width=23 height=48></td>
<td align=center width=155 bgcolor=#FFFFFF><font size=2 face=Verdana, Arial, Helvetica, sans-serif><strong>".$_SESSION["nome"];
echo "</strong></font><br><br><a href=logout.php>Sair</a></td>
<td><img src=imagens/cliente/cliente_r2_c3.jpg width=22 height=48></td>
</tr>
<tr>
<td colspan=3><img src=imagens/cliente/cliente_r3_c1.jpg width=200 height=37></td>
</tr>
</table>
</td>
<td width=480 bgcolor=#F8F8F8 align=center>
<table width=260 border=0 cellspacing=0 cellpadding=0>
<tr>
<td valign=top>
<font size=1 face=Verdana, Arial, Helvetica, sans-serif><strong>Busca por Palavra-Chave:</strong></font>
</td>
</tr>
<tr>
<td valign=top>
<form name=fmrConsulta method=get action=?consulta>
<input name=valor type=text id=a size=30>
<input name=Submit type=submit id=Submit value=Buscar>
</form>
</td>
</tr>
</table>
</td>
<td bgcolor=#f8f8f8>
<img src=imagens/busca_data.jpg width=179 height=26>";
include("agenda/calendario.php");
echo "
</td>
</tr>
<tr>
<td colspan=3>
<br><br><br>
<table width=799 border=0 cellpadding=3 cellspacing=2>";
########## LINHAS AFETADAS PELA CONSULTA #########
while($dados = mysql_fetch_array($limite)) {
$not_id = $dados["ID_NOTICIA"];
$not_titulo = $dados["TITULO"];
$not_noticia = $dados["NOTICIA"];
$not_data = $dados["DATA"];
$not_hora = $dados["HORA"];
$not_radio = $dados["RADIO"];
$not_programa = $dados["PROGRAMA"];
$not_reporter = $dados["REPORTER"];
$not_audio = $dados["AUDIO"];
$str = substr($not_noticia, 0, 450);
echo
" <tr>
<td>
<font color=#666666 size=1 face=Verdana, Arial, Helvetica, sans-serif> $not_hora - </font>
<font size=1 face=Verdana, Arial, Helvetica, sans-serif><strong>
<a href=?acao=detalhe&month=$month&year=$year&cod=$not_id>$not_titulo</a></strong></font>
</td>
</tr>
<tr>
<td>
<div align=justify>
<font color=#666666 size=1 face=Verdana, Arial, Helvetica, sans-serif>$str</font>
</div>
</td>
</tr>
<tr>
<td>
<font color=#666666 size=1 face=Verdana, Arial, Helvetica, sans-serif>$not_data - $not_radio - $not_programa - $not_reporter
<a href=?acao=detalhe&month=$month&year=$year&cod=$not_id>mp3</a></font>
</td>
</tr>
<tr>
<td>
<font size=1 face=Verdana, Arial, Helvetica, sans-serif>
------------------------------------------------------------------------------------------------
</font>
</td>
</tr>";
} ######### FECHA LOOP #########
echo
" </table><center>";
$anterior = $pc -1;
$proximo = $pc +1;
if($pc>1) {
echo " <a href='?acao=buscar&data=$data&pagina=$anterior'><- Anterior</a> ";
}
if(($tr%$total_reg!=0)):
while($tr%$total_reg!=0) { $tr++; }
endif;
for($i=1;$i<=$tr;$i++) {
if($i%$total_reg==0) {
$link = $i;
$link /= $total_reg;
if($link!=$pagina) {
echo " <a href=?acao=buscar&data=$data&pagina=$link>$link</a>";
} else {
echo " <strong>[</strong>$link<strong>]</strong>";
}
}
}
if($pc<$tp) {
echo " <a href='?acao=buscar&data=$data&pagina=$proximo'>Próxima -></a>";
}
echo "</center>
</td>
</tr>
</tabela>";
} ########## FECHA O IF #########
se alguem puder ajudar!
ahhhhhhhh
outra pergunta:
pq eu naum to conseguindo vizualizar qnd coloco pagina.php?acao=entrar?
In Topic: Como Selecionar Apenas Os 200 Caracters..
07/06/2005, 21:47
pois eh... queria saber no mysql pq o php eh sei como q eh...
mas valeu
quem souber se dah pra fazer isso no select agradeço!
mas valeu
quem souber se dah pra fazer isso no select agradeço!
In Topic: "devidos" Usuarios Lendo "devidas"noticias
31/05/2005, 16:55
jah tinha pensando em usar um array
essa rotina q eu vou fazer dentro do LOOP
vai inserir esses dados do array aonde ? em q campo...
vaum tudo em um campo soh ?
obrigado!
essa rotina q eu vou fazer dentro do LOOP
vai inserir esses dados do array aonde ? em q campo...
vaum tudo em um campo soh ?
obrigado!
In Topic: "devidos" Usuarios Lendo "devidas"noticias
31/05/2005, 15:50
cara...no campo ID_USUARIO tu coloca o id do usuario q poderá ver esta noticia
eu intendi tudo agora...
O PROBLEMA EH COMO PASSAR TODOS OS ID_USUARIO
EU NAUM TO SABENDO COMO INSERIR VARIOS ID`S EM UM CAMPO DO BANCO DE DADOS... EH ISSO Q TENHO Q FAZER ?
EU SEI FAZER ASSIM:
PASSAR SOMENTE UM VALOR PRO CAMPO ID_USUARIO
AGORA COMO EU VOU PASSAR VÁRIOS VALORES PRA DENTRO DE UM CAMPO (ID_USUARIO)... intendeu ? eh isso q quero saber!
preciso fazer a comparação de UMA NOTICIA pra N USUARIOS
O OBJETIVO EH COMO INSERIR EM UM CAMPO DA TABELA VÁRIOS ID_USUARIO...
SE ALGUEM PUDER ME AJUDAR MAIS... TO PRECISANDO SOH FALTA ISSO PRA INTREGRAR O SISTEMA!
- Fórum WMO
- → Viewing Profile: Posts: Igor_baballo
- Privacy Policy
- Regras ·



Postagens