Ir para conteúdo
Fórum Script Brasil

manogaucho

Membros
  • Total de itens

    79
  • Registro em

  • Última visita

Posts postados por manogaucho

  1. nas duas tabelas existe algum campo igual? Se tiver algum campo igual, da pra fazer uma junção delas.

    Entendeu, precisa existir um campo IGUAL nas duas tabelas, para fazera a ligação entre eles. Ai da pra usar o INNER JOIN.

    Me mostra os campos das tabelas.

    Primeiro Obrigado pela ajuda. Sim existe uma tabela iguais, é a tabela " categoryID ", abaixo esta a lista das tabela e seus campos, lembarndo que somente o campo " categoryID " é igual ou o mesmo das duas tabelas.

    Tabela > SS_categories

    Campos Abaixo:

    categoryID ( Este campo é o mesmo entre as duas tabelas )

    name

    parent

    products_count

    description

    picture

    products_count_admin

    Tabela > SS_products

    Campos Abaixo:

    productID

    categoryID ( Este campo é o mesmo entre as duas tabelas )

    name

    description

    customers_rating

    Price

    picture

    in_stock

    thumbnail

    customer_votes

    items_sold

    big_picture

    enabled

    brief_description

    list_price

    product_code

  2. Tudo bem!

    Assim tenho um sistema rodando, eu modifiquei um pouco ele, para torna-lo adaptável para uma amiga, mas agora estou precisando criar uma lista para mostrar certos produtos, mas to quebrando a cabeça e bem perdido, vamos lá vou tentar explicar.

    Neste Link abaixo aparece uma lista com vários produtos com nomes e preços:

    Veja aqui o Link

    Assim, veja a figura abaixo:

    veja_01.jpg

    Nos itens com a fecha vermelha, aparece o resultado da tabela SS_categories e os resultados da fecha azul aparece o resultado da tabela SS_products .

    Mas queria montar uma função que mostrasse apenas os resultados da tabela SS_categories, que só tivesse na tabela SS_products o campo “product_code “ preenchido com o valor 01.tambem teria que aparecer o campo name e o Price da mesma tabela, como mostra a figura acima.

    Fiz alguma coisa nesse código abaixo.

    <?

    $conexao = mysql_connect("host","nome usuario","senha");

    $bd = mysql_select_db("nome banco", $conexao) or die ("Não foi possível selecionar o Banco de dados.");

    $sql = "SELECT * FROM SS_products WHERE product_code = '01'";

    $resultado = mysql_query($sql, $conexao) or die ("Não foi possível executar a consulta");

    echo "<TABLE BORDER=1>

    <TR><TH>Nome Produto</TH> <TH>Valor</TH>";

    while ($linha = mysql_fetch_array($resultado)) {

    $id_item = $linha["name"];

    $titulo_item = $linha["Price"];

    echo "<TR><TD>$id_item</TD>

    <TD>$titulo_item</TD></TR>";

    }

    echo "</TABLE>";

    ?>

    Esse código que fiz, só aparece o resultado da tabela SS_products, com os campos “name” e ”Price”, que são preenchidos com 01 do campo product_code. Assim falta aparecer o nome que esta na tabela SS_categories ( Fecha Vermelha - imagem acima ).Não sei se me fiz entender , abaixo esta o link da função que fiz acima.

    Veja o Codigo acima, rodando aqui

    Agradeço desde já a ajuda!!!

  3. Tudo bem!

    Fiz um topo em flash, mas quero que carrege apenas uma vez no site, não sei se faço no "Macromedia Flash MX" ou no codigo php.

    Codigo abaixo:

    <param name="movie" value="http://www.www.meusite.com.br/modelo01//flash/topo.swf">
         <param name="quality" value="high">
         <embed src="http://www.meusite.com.br/modelo01//flash/topo.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="530" height="340"></embed>

    No " "Macromedia Flash MX" " fiz bem basico,sem menu, so umas imagens carregando,com 10qps e o tempo total e de 4 segundos ( 40 quadros).

    Demais Muito Obrigado!!!

  4. Ta funcionando, Agradeço desde já a grande ajuda de todos...

    Abaixo ficou o codigo pronto, os dados do banco foram mudados, por segurança...

    <?

    $conexao = mysql_connect("endereço banco de dados","usuario","senha"); //Faz conexão com o mysql

    $db = mysql_select_db("nome banco");

    $sql = "TRUNCATE TABLE SS_categories_2 ";

    mysql_query( $sql )or die( mysql_error() );

    $sql = "TRUNCATE TABLE SS_products_2 ";

    mysql_query( $sql )or die( mysql_error() );

    ?>

    <?php

    header("Location: index.php");

    exit();

    ?>

    OBRIGADÃO!!!!

  5. Adicione mysql_error para ver os possíveis erros:

    $conexao = mysql_connect("endereço banco de dados","usuario","senha") or die(mysql_error()); //Faz conexão com o mysql
    $db = mysql_select_db("nome banco");
    $sql = "TRUNCATE TABLE SS_categories_2,SS_products_2 ";
    mysql_query($sql) die(mysql_error());
    Fiz e apresentou esse erro:
    Parse error: syntax error, unexpected T_EXIT in /home/buscariogr3/public_html/milleniunn/bate_bola/apagar_sim.php on line 12

  6. você não executou a query

    Exemplo:

    $sql = "TRUNCATE TABLE SS_categories_2,SS_products_2";
    mysql_query($sql);
    Mudei ficou assim:
    <?
    $conexao = mysql_connect("endereço banco de dados","usuario","senha"); //Faz conexão com o mysql
    $db = mysql_select_db("nome banco");
    $sql = "TRUNCATE TABLE SS_categories_2,SS_products_2 ";
    mysql_query($sql);
    
    
    
    ?>
    <?php
    header("Location: index.php");
    exit();
    ?>

    Mas assim mesmo não limpa os regitros das tabelas, não apresenta erro, vai direito para a pagina index.php

  7. Oi Tudo bem!

    Quero esvaziar duas tabelas, usando TRUNCATE.

    Fiz esse codigo:

    <?
    $conexao = mysql_connect("endereço banco de dados","usuario","senha"); //Faz conexão com o mysql
    $db = mysql_select_db("nome banco");
    $sql = "TRUNCATE TABLE SS_categories_2,SS_products_2";
    
    
    
    ?>
    <?php
    header("Location: index.php");
    exit();
    ?>

    Ele não apresenta erro, volta para pagina index.php, mas não esvazia as tabelas..

    O que esta faltando para funcionar.

    Agradeço desde já a ajuda!!!

  8. Tudo bem!

    Quero mostar so um registro da tabela editor (que possui os campos id , titulo , texto )

    por exemplo tenho dois registros:

    id= 1 titulo= inicial texto= XXXXXXX

    id= 2 titulo= segundo texto= YYYYYYY

    Fiz este codigo abaixo:

    <?php
    
    $conexao = mysql_connect("endereçobanco","usuario","senha");
    $db = mysql_select_db("nomebanco");
    
    
    
    $sql_texto = "SELECT * FROM editor"; 
    $query_texto = mysql_query($sql_texto) or die(mysql_error());
    $row_texto = mysql_fetch_assoc($query_texto);
    $id = $row_texto['id'];
    $titulo = $row_texto['titulo'];
    $texto = $row_texto['texto'];
    
    // mostra a tabela
    echo"$texto";
    ?>

    Mas quero que mostre somente o conteudo do registro do campo texto com o titulo ( INICIAL ), e não mostre com o titulo ( SEGUNDO e outros) .

    Sei que é facil, mas para mim, que estou começando, não é muito facil.. hahaha

    Obrigado desde já!!!

  9. Tudo bem! Fiz uma procura sobre edição WYSIWYG, e vi que o TinyMCE é um dos melhores, mas sobre a instalação e configuração, não achei muita coisa, o que achei estava em ingles, já baixei a ultima versão e o pack de linguagem em PT, mas poderia me ajudar, com algum site em portugues que fala sobre INstalação e Configuração do TinyMCE .

    Demais Muito Obrigado!!

  10. Tenho um Script rodando em outro sistema e tem uma pagina que lista do jeito que falei...

    Estou mandando o codigo da pagina que lista:

    <?php
    
    
        // show whole price list
    
    function pricessCategories($parent,$level)
    {
    
        //same as processCategories(), except it creates a pricelist of the shop
    
        $out = array();
        $cnt = 0;
    
        $q1 = db_query("select categoryID, name from ".CATEGORIES_TABLE." where parent=$parent order by name") or die (db_error());
        while ($row = db_fetch_row($q1))
        {
    
            //define back color of the cell
            $r = hexdec(substr(CONF_LIGHT_COLOR, 0, 2)); 
            $g = hexdec(substr(CONF_LIGHT_COLOR, 2, 2)); 
            $b = hexdec(substr(CONF_LIGHT_COLOR, 4, 2)); 
            $m = (float)max($r, max($g,$b));
            $r = round((190+20*min($level,3))*$r/$m);
            $g = round((190+20*min($level,3))*$g/$m);
            $b = round((190+20*min($level,3))*$b/$m);
            $c = dechex($r).dechex($g).dechex($b); //final color
    
            //add category to the output
            $out[$cnt][0] = $row[0];
            $out[$cnt][1] = $row[1];
            $out[$cnt][2] = $level;
            $out[$cnt][3] = $c;
            $out[$cnt][4] = 0; //0 is for category, 1 - product
            $cnt++;
    
            //add products
            $q = db_query("select productID, name, Price from ".PRODUCTS_TABLE." where categoryID=".$row[0]." and Price>0 and enabled=1 order by Price") or die (db_error());
            while ($row1 = db_fetch_row($q))
             {
                if ($row1[2] <= 0)
                    $row1[2]= "n/a";
                else
                    $row1[2] = show_price($row1[2]);
    
                //add product to the output
                $out[$cnt][0] = $row1[0];
                $out[$cnt][1] = $row1[1];
                $out[$cnt][2] = $level;
                $out[$cnt][3] = "FFFFFF";
                $out[$cnt][4] = 1; //0 is for category, 1 - product
                $out[$cnt][5] = $row1[2];
                $cnt++;
    
             }
    
            //process all subcategories
            $sub_out = pricessCategories($row[0], $level+1);
    
            //add $sub_out to the end of $out
            for ($j=0; $j<count($sub_out); $j++)
            {
                $out[] = $sub_out[$j];
                $cnt++;
            }
         }
    
        return $out;
    
    } //pricessCategories
    
    
    
        if (isset($_GET["show_price"])) //show pricelist
        {
            $pricelist_elements = pricessCategories(0, 0);
            $smarty->assign("pricelist_elements", $pricelist_elements);
            $smarty->assign("main_content_template", "pricelist.tpl.html");
        }
    
    ?>

  11. Tudo Bem!!!

    Estou modificando um sistema que era de imobiliária para deixa-lo adaptável para necessidades de uma amiga, transformar em sistema igual ao leilão, onde ela cadastrará os produtos e os usuários ( Vendedores) entrarão e vão cadastrar no produtos seus preços, no final da semana ela pegara cada produto e verá qual o preço menor de cada e entrar em contato com o vendedor que fez a oferta, o sistema já quase pronto na parte de cadastro de categoria e produto e de cadastramento de usuário ( vendedor) de fato o que estou tentando criar é uma pagina que mostrar resultados de todos os produtos, a com o nome e valor oferecido por cada vendedor eu precisarei de alguns campos de 4 tabelas. Abaixo estão as 4 tabelas que falei, elas estão completas, mas não uso todos os campos, mas decidi colocar só para mostrar:

    1ª tabela re2_categories campos: PRIMARY - CategoryName

    2ª tabela re2_subcategories campos: SubcategoryID - SubcategoryName - CategoryID

    3ª tabela re2_agents campos: AgentID - TipodeConta - username - password - FirstName -LastName - resume - phone - cellular - pager - ResumeImages - email - logo - RegDate – ExpDate- AccountStatus - PriorityLevel - offers - news - NewsletterType - days10 - days5 - days1

    4ª tabela re2_listings campos: ListingID - AgentID - CategoryID - SubcategoryID - address city - state - country - ShortDesc - DetailedDesc - Price - PropertyType - neighbourhood - rooms - bathrooms - fireplace - garage - SquareMeters - LotSize - HomeAge - NearSchool - NearTransit - NearPark - OceanView - LakeView - MountainView - OceanWaterfront -LakeWaterfront - RiverWaterfront - image- DateAdded -visits

    O sistema esta funcionando :

    Na tabela 1 ( re2_categories) , transformei ela em e uma categoria para inserir dois dados um “ Produto: “ e outro “Ofertas do Cliente” , veja abaixo ( já está Funcionando )

    CategoryID: 9

    CategoryName: Produto:

    CategoryID: 10

    CategoryName: Ofertas do Vendedor

    A tabela 2 ( re2_subcategories ) Mudei ela para inserir os produtos , para mostrar para os usuários ( vendedores) cadastrar seus preços, inserir 3 dados para dar um exemplo: ( já está Funcionando )

    SubcategoryID: 21

    SubcategoryName:Açucar Dolce

    CategoryID: 9

    SubcategoryID: 20

    SubcategoryName:Sabão

    CategoryID: 9

    SubcategoryID: 24

    SubcategoryName: Carvão

    CategoryID: 10

    Na tabela 3 ( re2_agents ) inserir 2 usuários ( 2 Vendedores) nos campos abaixo: Este é tabela de cadastro dos usuários do sistema: ( já está Funcionando )

    AgentID : 21

    FirstName : maninho

    AgentID : 22

    FirstName : mano

    Agora a tabela 4 (re2_listings ), Fica os dados que os usuários cadastrarão seu preços nos produtos, cadastrei 2 preço para o mesmo produto de cada vendedor, com valores diferente, ficou assim Só coloquei os campos preenchidos no momento do cadastro do preço para o produto: ( já está Funcionando ),

    ListingID:1

    AgentID:21

    CategoryID:9

    SubcategoryID:21

    Price:1.56

    ListingID:3

    AgentID:22

    CategoryID:9

    SubcategoryID:21

    Price:1.22

    Agora o que estou tentando criar, mas não estou conseguindo é um Select que mostre em uma única pagina a lista o nome de cada Produto que esta tabela re2_subcategories no campo SubcategoryName, e abaixo os nomes de cada vendedor que esta no campo FirstName da tabela re2_agents e o valor da sua oferta para o produto, este valor esta no campo Price da tabela re2_listings,na lista pode aparecer todos os produtos cadastrados, se tiver ou não oferta de um ou mais vendedores ele aparecerá abaixo do nome do produto com sua a oferta do lado do nome. Quero usar em apenas uma pagina, por que vai ser impresso no final, todos os produtos com suas ofertas, um grande detalhe é que o “ order by “ tem que ser pelo campo Price , para poder ficar o menor preço oferecido no topo dos preços de cada produto...Para informar, apaguei toda a pagina que mostrará este select, só tem um require_once("configuracao_mysql.php"); que faz a conexão ao banco de dados.

    Abaixo esta o sql de toas as tabelas do sistema:

    -- phpMyAdmin SQL Dump

    -- version 3.2.4

    -- http://www.phpmyadmin.net

    --

    -- Servidor: localhost

    -- Tempo de Geração: Jun 30, 2010 as 02:01

    -- Versão do Servidor: 5.1.41

    -- Versão do PHP: 5.3.1

    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;

    /*!40101 SET NAMES utf8 */;

    --

    -- Banco de Dados: `bate_bola`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_admin`

    --

    CREATE TABLE IF NOT EXISTS `re2_admin` (

    `AdminID` varchar(50) NOT NULL,

    `AdminPass` varchar(32) NOT NULL,

    `AdminName` varchar(100) NOT NULL,

    `AdminEmail` varchar(150) NOT NULL,

    PRIMARY KEY (`AdminID`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

    --

    -- Extraindo dados da tabela `re2_admin`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_agents`

    --

    CREATE TABLE IF NOT EXISTS `re2_agents` (

    `AgentID` int(10) NOT NULL AUTO_INCREMENT,

    `TipodeConta` int(1) NOT NULL DEFAULT '0',

    `username` varchar(50) NOT NULL,

    `password` varchar(32) NOT NULL,

    `FirstName` varchar(150) NOT NULL,

    `LastName` varchar(150) NOT NULL,

    `resume` text NOT NULL,

    `phone` varchar(50) NOT NULL,

    `cellular` varchar(50) NOT NULL,

    `pager` varchar(50) NOT NULL,

    `ResumeImages` text NOT NULL,

    `email` varchar(150) NOT NULL,

    `logo` varchar(255) NOT NULL,

    `RegDate` int(10) NOT NULL DEFAULT '0',

    `ExpDate` int(10) NOT NULL DEFAULT '0',

    `AccountStatus` varchar(20) NOT NULL DEFAULT 'pending',

    `PriorityLevel` int(1) NOT NULL DEFAULT '2',

    `offers` int(3) NOT NULL DEFAULT '0',

    `news` char(1) NOT NULL DEFAULT 'y',

    `NewsletterType` varchar(10) NOT NULL DEFAULT 'plain',

    `days10` char(1) NOT NULL DEFAULT 'n',

    `days5` char(1) NOT NULL DEFAULT 'n',

    `days1` char(1) NOT NULL DEFAULT 'n',

    PRIMARY KEY (`AgentID`),

    UNIQUE KEY `email` (`email`),

    UNIQUE KEY `username` (`username`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    --

    -- Extraindo dados da tabela `re2_agents`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_banners`

    --

    CREATE TABLE IF NOT EXISTS `re2_banners` (

    `ClientID` int(10) NOT NULL DEFAULT '0',

    `BannerID` int(10) NOT NULL AUTO_INCREMENT,

    `BannerURL` varchar(255) NOT NULL,

    `BannerFile` varchar(255) NOT NULL,

    `BannerAlt` varchar(255) NOT NULL,

    `BannerType` varchar(50) NOT NULL,

    `bCat` int(10) NOT NULL DEFAULT '0',

    `bSub` int(10) NOT NULL DEFAULT '0',

    PRIMARY KEY (`BannerID`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    --

    -- Extraindo dados da tabela `re2_banners`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_categories`

    --

    CREATE TABLE IF NOT EXISTS `re2_categories` (

    `CategoryID` int(10) NOT NULL AUTO_INCREMENT,

    `CategoryName` varchar(255) NOT NULL,

    PRIMARY KEY (`CategoryID`),

    UNIQUE KEY `CategoryName` (`CategoryName`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    --

    -- Extraindo dados da tabela `re2_categories`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_listings`

    --

    CREATE TABLE IF NOT EXISTS `re2_listings` (

    `ListingID` int(10) NOT NULL AUTO_INCREMENT,

    `AgentID` int(10) NOT NULL DEFAULT '0',

    `CategoryID` int(10) NOT NULL DEFAULT '0',

    `SubcategoryID` int(10) NOT NULL DEFAULT '0',

    `address` text NOT NULL,

    `city` varchar(100) NOT NULL,

    `state` varchar(100) NOT NULL,

    `country` varchar(150) NOT NULL,

    `ShortDesc` text NOT NULL,

    `DetailedDesc` text NOT NULL,

    `Price` float(15,2) NOT NULL DEFAULT '0.00',

    `PropertyType` varchar(50) NOT NULL,

    `neighbourhood` text NOT NULL,

    `rooms` int(2) NOT NULL DEFAULT '0',

    `bathrooms` int(2) NOT NULL DEFAULT '0',

    `fireplace` char(1) NOT NULL DEFAULT 'n',

    `garage` int(2) NOT NULL DEFAULT '0',

    `SquareMeters` float(15,2) NOT NULL DEFAULT '0.00',

    `LotSize` float(15,2) NOT NULL DEFAULT '0.00',

    `HomeAge` int(3) NOT NULL DEFAULT '0',

    `NearSchool` char(1) NOT NULL DEFAULT 'n',

    `NearTransit` char(1) NOT NULL DEFAULT 'n',

    `NearPark` char(1) NOT NULL DEFAULT 'n',

    `OceanView` char(1) NOT NULL DEFAULT 'n',

    `LakeView` char(1) NOT NULL DEFAULT 'n',

    `MountainView` char(1) NOT NULL DEFAULT 'n',

    `OceanWaterfront` char(1) NOT NULL DEFAULT 'n',

    `LakeWaterfront` char(1) NOT NULL DEFAULT 'n',

    `RiverWaterfront` char(1) NOT NULL DEFAULT 'n',

    `image` text NOT NULL,

    `DateAdded` int(10) NOT NULL DEFAULT '0',

    `visits` int(10) NOT NULL DEFAULT '0',

    PRIMARY KEY (`ListingID`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    --

    -- Extraindo dados da tabela `re2_listings`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_mail_archive`

    --

    CREATE TABLE IF NOT EXISTS `re2_mail_archive` (

    `subject` varchar(255) NOT NULL,

    `message` text,

    `MailDate` int(10) NOT NULL DEFAULT '0'

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

    --

    -- Extraindo dados da tabela `re2_mail_archive`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_prices`

    --

    CREATE TABLE IF NOT EXISTS `re2_prices` (

    `PackageName` varchar(50) NOT NULL,

    `PriceID` int(10) NOT NULL AUTO_INCREMENT,

    `PriceValue` float(5,2) NOT NULL DEFAULT '0.00',

    `Duration` varchar(10) NOT NULL,

    `PriorityLevel` int(1) NOT NULL DEFAULT '0',

    `PriceType` varchar(10) NOT NULL DEFAULT '0',

    `offers` int(10) NOT NULL DEFAULT '0',

    PRIMARY KEY (`PriceID`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    --

    -- Extraindo dados da tabela `re2_prices`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_priority`

    --

    CREATE TABLE IF NOT EXISTS `re2_priority` (

    `PriorityID` int(10) NOT NULL AUTO_INCREMENT,

    `PriorityName` varchar(50) NOT NULL,

    `PriorityLevel` int(1) NOT NULL DEFAULT '0',

    PRIMARY KEY (`PriorityID`),

    UNIQUE KEY `PriorityName` (`PriorityName`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    --

    -- Extraindo dados da tabela `re2_priority`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_settings`

    --

    CREATE TABLE IF NOT EXISTS `re2_settings` (

    `id` int(1) NOT NULL DEFAULT '0',

    `SiteTitle` varchar(255) NOT NULL,

    `SiteName` varchar(255) NOT NULL,

    `SiteKeywords` varchar(255) NOT NULL,

    `SiteDescription` text,

    `ContactEmail` varchar(150) NOT NULL,

    `CompanyAddress` text,

    `PayPalEmail` varchar(150) NOT NULL,

    `SellerID` int(5) NOT NULL DEFAULT '0',

    `Agreement` text NOT NULL,

    `sp_vendor_email` varchar(255) NOT NULL,

    `sp_payee_email` varchar(255) NOT NULL,

    `sp_secret_code` varchar(255) NOT NULL

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

    --

    -- Extraindo dados da tabela `re2_settings`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_stats`

    --

    CREATE TABLE IF NOT EXISTS `re2_stats` (

    `BannerID` int(10) NOT NULL DEFAULT '0',

    `impressions` int(10) NOT NULL DEFAULT '0',

    `clicks` int(10) NOT NULL DEFAULT '0',

    `mydate` int(10) NOT NULL DEFAULT '0',

    `ip` varchar(50) NOT NULL

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

    --

    -- Extraindo dados da tabela `re2_stats`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_subcategories`

    --

    CREATE TABLE IF NOT EXISTS `re2_subcategories` (

    `SubcategoryID` int(10) NOT NULL AUTO_INCREMENT,

    `SubcategoryName` varchar(255) NOT NULL,

    `CategoryID` int(10) NOT NULL DEFAULT '0',

    PRIMARY KEY (`SubcategoryID`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    --

    -- Extraindo dados da tabela `re2_subcategories`

    --

    -- --------------------------------------------------------

    --

    -- Estrutura da tabela `re2_types`

    --

    CREATE TABLE IF NOT EXISTS `re2_types` (

    `TypeID` int(10) NOT NULL AUTO_INCREMENT,

    `TypeName` varchar(100) NOT NULL,

    PRIMARY KEY (`TypeID`),

    UNIQUE KEY `TypeName` (`TypeName`)

    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

    --

    -- Extraindo dados da tabela `re2_types`

    --

    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;

    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

    Desde já agradeço a ajuda.

    Obrigado!!!

  12. Oi Tudo Bem!!!

    Estou com uma duvida em um código, o sistema esta funcionando, mas queria fazer uma pequena mudança, no mesmo. Vou tentar explicar:

    Seria na hora de inserir dados, a pagina que inseri fecha, queria manter a mesma aberta após inserir os dados, Só fechar quando termina-se de inserir os dados, pois tenho que clicar sempre em adicionar para abrir a pagina “products.php”

    Abaixo esta o código da pagina “products.php:”

    <form enctype="multipart/form-data" action="products.php" method=post>
    
    <table width=100% border=0 cellpadding=3 cellspacing=0>
    
    <tr>
    <td align=right><?php echo ADMIN_CATEGORY_PARENT;?></td>
    <td>
    <select name="categoryID">
    <option value="0"><?php echo ADMIN_CATEGORY_ROOT;?></option>
    <?php
        //show categories select element
        $cats = fillTheCList(0,0);
        for ($i=0; $i<count($cats); $i++)
        {
            echo "<option value=\"".$cats[$i][0]."\"";
            if ($row[0] == $cats[$i][0]) //select category
                echo " selected";
            echo ">";
            for ($j=0;$j<$cats[$i][5];$j++) echo "&nbsp;&nbsp;";
            echo $cats[$i][1];
            echo "</option>";
        }
    ?>
    </select>
    </td>
    </tr>
    
    <tr>
    <td align=right><?php echo ADMIN_PRODUCT_NAME;?></td>
    <td><input type="text" name="name" value="<?php echo str_replace("\"","&quot;",$row[1]); ?>">
    </td>
    </tr>
    
    <?php    if ($_GET["productID"]) { ?>
    
    <?php }; ?>
    
    <tr>
    <td align=right><?php echo ADMIN_PRODUCT_PRICE;?></td>
    <td><input type="text" name="price" value=<?php echo $row[4]; ?>> 
      <font color="#FF0000">&nbsp; </font></td>
    </tr>
    
    <?php
        if ($row[6]<0) $is = 0;
        else $is = $row[6];
    
    ?>
    <tr>
    <td align=right><?php echo ADMIN_PRODUCT_INSTOCK;?>:</td>
    <td><input type="checkbox" name="in_stock"<?php if ($is > 0) echo " checked"; ?>></td>
    </tr>
    
    
    <tr><td>&nbsp;</td></tr><tr><td></td><td>&nbsp;
    </td>
    </tr><tr><td></td><td><p align="center"><strong><font color="#FF0000">Depois
              de Adicionado o Pre&ccedil;o do produto, n&atilde;o &eacute; possivel
              deletar, Somente Administrador </font></strong></p>
        <p align="center">&nbsp;</p>
        </td>
    </tr><tr><td></td><td valign=top>&nbsp;
    </td>
    </tr>
    
    </table>
    
    
    <p><center>
    <input type="submit" value="<?php echo SAVE_BUTTON;?>" width=5 onClick="window.open();">
    <input type="hidden" name="save_product" value=<?php echo $_GET["productID"]; ?>>
    <input type="button" value="<?php echo CANCEL_BUTTON;?>" onClick="window.open();">
    <?php    if ($_GET["productID"]) echo "<input type=button value=\"".DELETE_BUTTON."\" onClick=\"confirmDelete('".QUESTION_DELETE_CONFIRMATION."','products.php?productID=".$_GET["productID"]."&delete=1');\">"; ?>
    </center></p>
    </form>
    Abaixo o Codigo do botão salvar, o mesma encontra-se acima, mas coloquei pra destacar melhor:
    <input type="submit" value="<?php echo SAVE_BUTTON;?>" width=5 onClick="window.open();">
    <input type="hidden" name="save_product" value=<?php echo $_GET["productID"]; ?>>
    <input type="button" value="<?php echo CANCEL_BUTTON;?>" onClick="window.open();">
    <?php    if ($_GET["productID"]) echo "<input type=button value=\"".DELETE_BUTTON."\" onClick=\"confirmDelete('".QUESTION_DELETE_CONFIRMATION."','products.php?productID=".$_GET["productID"]."&delete=1');\">"; ?>
    Demais Muito Obrigado!!! Fiz um teste, na linha :
    <input type="submit" value="<?php echo SAVE_BUTTON;?>" width=5 onClick="window.open();">
    Mudei para:
    <input type="submit" value="<?php echo SAVE_BUTTON;?>" width=5 onClick="window.open(products.php);">

    Funcionou em parte, ela abre outra pagina, "products.php", mas não fecha a anterior, sendo assim fica acumulando paginas...

    Decidi deixar como estava, vou aguardar respostas...

  13. puts tá fácil

    $linha = mysql_fetch_array($logar);

    header("location:$linha[link] ");

    Procura a ler e entender os erros e os códigos isso que você esta querendo é coisa básica...

    Ve agora

    Deu Certo Ficou assim:

    <?
    require_once("conexao.php");
    ?>
    <form action="login.php" name="cadastro" method="post">
    <div align="center">Nome: 
        <input type="text" name="nome">
        <br>
      Senha: 
      <input type="password" name="senha">
      <br>
      <input type="submit" value="enviar">
    </div>
    </form>
    <p>&nbsp;</p>
    </body>
    </html>
    
    <?
    
    $nome= $_POST['nome'];
    $senha = $_POST['senha'];
    //faz a confirmação de nome e senha no db
    $logar = mysql_query("SELECT LINK FROM conta WHERE NOME='$nome' AND SENHA='$senha'") or die("erro ao selecionar");
    
    if (strlen($senha)< 1)
    echo '<p align="center"> Senha Incorreta, Por favor<BR><a href="java script:history.back(1);">tente denovo</a></p>';
    elseif (mysql_num_rows($logar)>0 ){
    $linha = mysql_fetch_array($logar);
    header("location:$linha[LINK]");
    } else {
    echo '<p align="center">Senha ou apelido invalido.<BR><a href="java script:history.back(1);">Tente novamente.</a></p>';
    }
    ?>

  14. Na linha 26 tira o seu header

    Coloque isso daqui

    $linha mysql_fetch_array($logar);
    header("location:$linha ");
    Se não rolar tira isso dai e faã isso print_r($linha); se tudo eu certo vai trazer os dados do cliente.
    Mudei ficou assim:
    ?>
    <html>
    <body>
    <form action="login.php" name="cadastro" method="post">
    Nome: <input type="text" name="nome"><br>
    Senha: <input type="text" name="senha"><br>
    <input type="submit" value="enviar">
    </form>
    </body>
    </html>
    
    <?
    
    $nome= $_POST['nome'];
    $senha = $_POST['senha'];
    //faz a confirmação de nome e senha no db
    $logar = mysql_query("SELECT LINK FROM conta WHERE NOME='$nome' AND SENHA='$senha'") or die("erro ao selecionar");
    
    if (strlen($senha)< 1)
    echo '<p align="center"> Senha Incorreta, Por favor<BR><a href="java script:history.back(1);">tente denovo</a></p>';
    elseif (mysql_num_rows($logar)>0 ){
    $linha mysql_fetch_array($logar);
    header("location:$linha ");
    } else {
    echo '<p align="center">Senha ou apelido invalido.<BR><a href="java script:history.back(1);">Tente novamente.</a></p>';
    }
    ?>
    Agora da este erro:
    PHP Parse error:  syntax error, unexpected T_STRING in E:\home\buscariogran\Web\guia\login.php on line 26

×
×
  • Criar Novo...