Ir para conteúdo

POWERED BY:

Arquivado

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

Peter Lopes

[Resolvido] erro no "ysql_fetch_array():" e só mudei o

Recommended Posts

Ola galera! Eu ja estou enlouquecendo com esse escript ele esta dando erro Warning: mysql_fetch_array(): supplied argument is not a valid MySQL, só porque eu mudei o nome da tabela

o mais imprecionante é que as duas tabala são iguais só muda o nome, e quando eu coloco o nome da tabela anteriao ele volta afuncionar e outro problema é que o include ="config"

parou de funcionar agora ele só funciona se eu colocar o conteuco da pagína config dentro do script como esta no codigo abaixo

 

<?php
$local_serve = "**********";
$usuario_serve = "***********";
$senha_serve = "********";	 	 
$banco_de_dados = "***********";
$conn = mysql_connect($local_serve, $usuario_serve, $senha_serve) or die ("O servidor não responde!");
$db = mysql_select_db($banco_de_dados,$conn) 
	or die ("Não foi possivel conectar-se ao banco de dados!");
	
	$numreg = 5;
	if (!isset($pg)) {
		$pg = 0;
	}
	$inicial = $pg * $numreg;
		
$consulta = mysql_query("Select id, titulo, autor, texto, DATE_FORMAT(pdate, '%d/%m/%Y') as date From [b]AKI ESTA O PROBLEMA[/b] WHERE categoria='venda_de_veiculos' ORDER BY titulo") 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style3 {font-size: 16px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #000000; font-weight: bold; }
-->
</style>
</head>

<body>
<table width="0" border="0" cellspacing="1" cellpadding="1">
  <tr>
	<th scope="col"> </th>
	<th align="center" valign="middle" scope="col" ><p align="left" class="style3">Venda de Veículos</p>	</th>
	<th scope="col"> </th>
  </tr>
  <tr>
	<td> </td>
	<td>
	<?php 
include ('paginacao.php');
 echo "<br>";
 while ($linha = mysql_fetch_array($consulta)) {
	
	$id = substr($linha['id'],0,150);
	$titulo = substr($linha['titulo'],0,150); 
	$texto = substr($linha['texto'],0,150); 
	$autor = substr($linha['autor'],0,150);
	$data = substr($linha['date'],0,150);

		
echo "<table width=150 height=200 border=1 cellspacing=1 cellpadding=1>";
echo "<tr><th scope=col height=30>$titulo</th></tr>";
echo "<tr><td>$texto</td></tr>";
echo "<tr><td height=30>$data</td></tr>";
echo "</table>";
echo "<br>";
echo "<br>";
		 }?>
		 <?php include ('paginacao.php'); ?>
		 </td>
	<td> </td>
  </tr>
  <tr>
	<td> </td>
	<td> </td>
	<td> </td>
  </tr>
</table>
</body>
</html>

Alguem pode me ajudar?????? eu ja estou enlouquecendo.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Camarada... complicado te ajudar sem a estrutura da sua tabela!!!

você já ferificou todos os campos??? Tem certeza que só mudou o nome da tabela???

Compartilhar este post


Link para o post
Compartilhar em outros sites

Eu ja verifiquei varias vezes + eu sei que tem algumacoisa errada pq ele não esta funcionando

 

tabela 1 (obs: esta é a que funcionava)

CREATE TABLE `noticias` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `pdate` timestamp(14) NOT NULL,
  `categoria` varchar(15) NOT NULL,
  `titulo` varchar(240) NOT NULL default '',
  `autor` varchar(240) NOT NULL default '',
  `texto` text NOT NULL,
  `tempo` int(9) NOT NULL,
 PRIMARY KEY  (id),
 KEY pdate (pdate)
)

tabela 2 (esta é a que parou de funcionar)

CREATE TABLE `aprovar` (
  `id` int(10) unsigned NOT NULL,
  `autor` varchar(15) NOT NULL default '',
  `titulo` varchar(25) NOT NULL default '',
  `categoria` varchar(15) NOT NULL,  
  `tempo` int(9) NOT NULL,
  `texto` text NOT NULL,
 PRIMARY KEY  (id)
)

Compartilhar este post


Link para o post
Compartilhar em outros sites

C.....ARA.....LHOOOOOOUUUUUU eu sou muito burro......

agora que eu vi o erro P*Q*P o erro esta nas tabelas e não no codigo, quando eu criei a segunda tabela era pra repetir alina "pdate" e eu repeti a linha `tempo`

ai quando o codigo procurava a função "DATE_FORMAT(pdate, '%d/%m/%Y') as date" ele não encontrava e dava erro no mysql_fetch_array agora eu mudei e funcionaou

Obrigado by_stoco se você não tivesse pedido para copiar as tabela eu nunca ia ver isso e ia continuar achando que as tabelas eram iguais.

Bem fia ai a diaca pra quem estiver com o mesmo problema....

Valeu um abração

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.