Ir para conteúdo
Fórum Script Brasil

taudujas

Membros
  • Total de itens

    1.244
  • Registro em

  • Última visita

Posts postados por taudujas

  1. Mudei para:

    form.php

    <?

    include "bd.php"

    ?>

    <html>

    <head>

    <title>Buscar anuncios - liga Negocios.</title>

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

    </head>

    <body>

    <form name="form1" method="post" action="busca.php">

      <table width="66%" border="0">

        <tr>

          <td width="22%"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Busca:</font></strong></td>

          <td width="19%"><input name="palavra" type="text" id="palavra"></td>

          <td width="59%"><select name="select">

              <option value="diversos">diversos</option>

              <option value="imoveis">imoveis</option>

              <option value="veiculos">veiculos</option>

            </select>

            <input type="submit" name="Submit" value="Buscar"></td>

        </tr>

      </table>

    </form>

    </body>

    </html>

    busca.php

    <?

    include "bd.php";

    //pega os dados digitados no formulario

    $busca = $_POST["busca"];

    $select = $_POST['select'];

    // seleciona os dados do banco

    $query = mysql_query("SELECT * FROM $select where nome LIKE '$busca'") or die(mysql_error());

    $contagem = mysql_num_rows($query);// verifica os numeros de linhas

    if ($contagem == 0) //se for igual a zero

    {

    echo "<center><font color = \"#0000FF\">Não Achou Nenhum Registro</font></center>

    <a href=\"javascript:history.go(-1)\"><center>Voltar</center></a>";

    exit();

    }

    else{

    while ($select= mysql_fetch_array($query)){

    $nome = $select["nome"];

    echo "$nome<br>";

    echo "Erro: ". mysql_error();

    }

    }

    ?>

    Mas não esta achando nada.. qual sera o problema agora?

  2. <?

    include "bd.php"

    ?>

    <html>

    <head>

    <title>Buscar anuncios - liga Negocios.</title>

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

    </head>

    <body>

    <form name="form1" method="post" action="busca.php">

      <table width="66%" border="0">

        <tr>

          <td width="22%"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Busca:</font></strong></td>

          <td width="19%"><input name="palavra" type="text" id="palavra"></td>

          <td width="59%"><select name="tabela">

                  <option value="select">Selecione</option>

    <?

    $sql = "SELECT nome FROM diversos ORDER BY nome";

    $exec = mysql_query($sql);

    while ($array = mysql_fetch_array($exec))

    {

    $tabela = $array['nome'];

    $tabela = strtoupper($tabela);

        echo "<option value=\"$tabela\">$tabela</option>\n";

    }

    ?>

            </select>

            <input type="submit" name="Submit" value="Buscar"></td>

        </tr>

      </table>

    </form>

    </body>

    </html>

    esta ai em vermelho.

  3. o meu banco é este:

    CREATE TABLE `diversos` (

      `codigo` int(10) unsigned NOT NULL auto_increment,

      `data` date NOT NULL default '0000-00-00',

      `categoria` varchar(60) NOT NULL default '',

      `opnegocio` varchar(40) NOT NULL default '',

      `nome` varchar(60) NOT NULL default '',

      `grupo` varchar(40) NOT NULL default '',

      `valor` varchar(50) NOT NULL default '',

      `descricao` text NOT NULL,

      `foto` varchar(200) NOT NULL default '',

      `contato` varchar(60) NOT NULL default '',

      `cidade` varchar(50) NOT NULL default '',

      `uf` char(2) NOT NULL default '',

      `email` varchar(60) NOT NULL default '',

      PRIMARY KEY  (`codigo`)

    ) TYPE=MyISAM AUTO_INCREMENT=4 ;

    CREATE TABLE `imoveis` (

      `codigo` int(10) unsigned NOT NULL auto_increment,

      `data` date NOT NULL default '0000-00-00',

      `categoria` varchar(70) NOT NULL default '',

      `opnegocio` varchar(40) NOT NULL default '',

      `tipo` varchar(40) NOT NULL default '',

      `bairro` varchar(40) NOT NULL default '',

      `endereco` varchar(60) NOT NULL default '',

      `valor` varchar(40) NOT NULL default '',

      `descricao` text NOT NULL,

      `foto` varchar(200) NOT NULL default '',

      `contato` varchar(70) NOT NULL default '',

      `cidade` varchar(40) NOT NULL default '',

      `uf` char(2) NOT NULL default '',

      `email` varchar(60) NOT NULL default '',

      PRIMARY KEY  (`codigo`)

    ) TYPE=MyISAM AUTO_INCREMENT=1 ;

    CREATE TABLE `veiculos` (

      `codigo` int(10) unsigned NOT NULL auto_increment,

      `data` date NOT NULL default '0000-00-00',

      `categoria` varchar(80) NOT NULL default '',

      `opnegocio` varchar(80) NOT NULL default '',

      `modelo` varchar(40) NOT NULL default '',

      `motor` varchar(40) NOT NULL default '',

      `anomod` varchar(40) NOT NULL default '',

      `cor` varchar(30) NOT NULL default '',

      `valor` varchar(20) NOT NULL default '',

      `descricao` text NOT NULL,

      `foto` varchar(200) NOT NULL default '',

      `contato` varchar(40) NOT NULL default '',

      `uf` char(2) NOT NULL default '',

      `email` varchar(60) NOT NULL default '',

      PRIMARY KEY  (`codigo`)

    ) TYPE=MyISAM AUTO_INCREMENT=1 ;

    A Variavel $busca é o campo onde a pessoa vai digitar as palavras, como d20 por exemplo e select é onde ela vai procurar, na categoria no caso, logo a tabela do banco entendeu?

  4. Olha agora:

    <?

    include "bd.php";

    //pega os dados digitados no formulario

    $busca = $_POST["busca"];

    $select = $_POST['select'];

    // seleciona os dados do banco

    $query = mysql_query("SELECT * FROM $select where $busca LIKE '$busca'") or die(mysql_error());

    $contagem = mysql_num_rows($query);// verifica os numeros de linhas

    if ($contagem == 0) //se for igual a zero

    {

    echo "<center><font color = \"#0000FF\">Não Achou Nenhum Registro</font></center>

    <a href=\"javascript:history.go(-1)\"><center>Voltar</center></a>";

    exit();

    }

    else{

    while ($select= mysql_fetch_array($query)){

    $nome = $select["nome"];

    echo "$nome<br>";

    echo "Erro: ". mysql_error();

    }

    }

    ?>

    ERRO: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where LIKE ''' at line 1

  5. Error coloquei assim:

    <?

    include "bd.php";

    //pega os dados digitados no formulario

    $busca = $_POST["busca"];

    $select = $_POST['select'];

    // seleciona os dados do banco

    $query = mysql_query("SELECT FROM $select where nome LIKE '$busca'") or die(mysql_error());

    $contagem = mysql_num_rows($query);// verifica os numeros de linhas

    if ($contagem == 0) //se for igual a zero

    {

    echo "<center><font color = \"#0000FF\">Não Achou Nenhum Registro</font></center>

    <a href=\"javascript:history.go(-1)\"><center>Voltar</center></a>";

    exit();

    }

    else{

    while ($select= mysql_fetch_array($query)){

    $nome = $select["nome"];

    echo "$nome<br>";

    echo "Erro: ". mysql_error();

    }

    }

    ?>

    e retornou:

    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM '' where nome LIKE ''' at line 1
  6. Mas então por o que que eu teria que mudar ??

    Retornou este erro:

    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'where nome like ''' at line 1
  7. Ok Error estou fazendo assim olha:

    <?

    include "bd.php"

    ?>

    <html>

    <head>

    <title>Buscar anuncios - liga Negocios.</title>

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

    </head>

    <body>

    <form name="form1" method="post" action="busca.php">

      <table width="66%" border="0">

        <tr>

          <td width="22%"><strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Busca:</font></strong></td>

          <td width="19%"><input name="palavra" type="text" id="palavra"></td>

          <td width="59%"><select name="tabela">

                  <option value="select">Selecione</option>

    <?

    $sql = "SELECT nome FROM diversos ORDER BY nome";

    $exec = mysql_query($sql);

    while ($array = mysql_fetch_array($exec))

    {

    $tabela = $array['nome'];

    $tabela = strtoupper($tabela);

        echo "<option value=\"$tabela\">$tabela</option>\n";

    }

    ?>

            </select>

            <input type=submit" name="Submit" value="Buscar"></td>

        </tr>

      </table>

    </form>

    </body>

    </html>

    Busca.php

    <?

    include "bd.php";

    //pega os dados digitados no formulario

    $busca = $_POST["busca];

    $select = $_POST['select'];

    // seleciona os dados do banco

    $query = mysql_query("SELECT $busca where nome like '$select'") or die(mysql_error());

    $contagem = mysql_num_rows($query);// verifica os numeros de linhas

    if ($contagem == 0) //se for igual a zero

    {

    echo "<center><font color = \"#0000FF\">Não Achou Nenhum Registro</font></center>

    <a href=\"javascript:history.go(-1)\"><center>Voltar</center></a>";

    exit();

    }

    else{

    while ($select= mysql_fetch_array($query)){

    $nome = $select["nome"];

    echo "$nome<br>";

    echo "Erro: ". mysql_error();

    }

    }

    ?>

    Mas não da certo, não retorna erro nem nada.

  8. Eu entrei no site do GD

    E lá tava falando pra eu alterar uma linha do php.ini

    De

    extension_dir = "./"
    Para
    extension_dir = "./extensions/"

    Eu fiz, e nada!

    Voce tem que colocar o diretorio onde se encontra as extenções do PHP ai e tirar o ; da frente caso tenha.

×
×
  • Criar Novo...