Jump to content


Leo_cgi's Content

There have been 5 items by Leo_cgi (Search limited from 19/04/2023)


Ordernar por                Order  

#1019556 Listar Por Ordem Numérica

Posted by Leo_cgi on 10/10/2012, 08:30 in PHP

Olá!
Estou desenvolvendo um sistema de sorteio (15 bolas sorteadas).

Abaixo segue a tabela do MySQL com os dados dos 3 sorteios:

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!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: `banco`
--

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

--
-- Estrutura da tabela `bolas`
--

CREATE TABLE IF NOT EXISTS `bolas` (
  `id` int(3) NOT NULL AUTO_INCREMENT,
  `bola1` smallint(2) NOT NULL,
  `bola2` smallint(2) NOT NULL,
  `bola3` smallint(2) NOT NULL,
  `bola4` smallint(2) NOT NULL,
  `bola5` smallint(2) NOT NULL,
  `bola6` smallint(2) NOT NULL,
  `bola7` smallint(2) NOT NULL,
  `bola8` smallint(2) NOT NULL,
  `bola9` smallint(2) NOT NULL,
  `bola10` smallint(2) NOT NULL,
  `bola11` smallint(2) NOT NULL,
  `bola12` smallint(2) NOT NULL,
  `bola13` smallint(2) NOT NULL,
  `bola14` smallint(2) NOT NULL,
  `bola15` smallint(2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Extraindo dados da tabela `bolas`
--

INSERT INTO `bolas` (`id`, `bola1`, `bola2`, `bola3`, `bola4`, `bola5`, `bola6`, `bola7`, `bola8`, `bola9`, `bola10`, `bola11`, `bola12`, `bola13`, `bola14`, `bola15`) VALUES
(1, 20, 23, 12, 8, 6, 1, 7, 11, 14, 4, 16, 10, 9, 17, 24),
(2, 16, 5, 25, 24, 23, 8, 12, 2, 17, 18, 1, 10, 4, 19, 13),
(3, 15, 13, 20, 2, 11, 24, 9, 16, 4, 23, 25, 12, 8, 19, 1),
(4, 23, 19, 1, 5, 7, 21, 16, 10, 15, 25, 6, 2, 12, 4, 17);

/*!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 */;

Abaixo segue o PHP que carrega as bolas do sorteio:
<html>
 <head>
  <title>Exibir dados com PHP/MySql</title>
 </head>
<body>

<h1>Exibir dados com PHP/MySql</h1>

<?php

$servidor = "localhost"; /*maquina a qual o banco de dados está*/
$usuario = "user"; /*usuario do banco de dados MySql*/
$senha = "senha"; /*senha do banco de dados MySql*/
$banco = "banco"; /*seleciona o banco a ser usado*/

$conexao = mysql_connect($servidor,$usuario,$senha);  /*Conecta no bando de dados MySql*/

mysql_select_db($banco); /*seleciona o banco a ser usado*/

$res = mysql_query("select * from bolas"); /*Executa o comando SQL, no caso para pegar todos os usuarios do sistema e retorna o valor da consulta em uma variavel ($res)  */

echo "<table><tr><td>Jogo</td>
<td>Bola 1</td>
<td>Bola 2</td>
<td>Bola 3</td>
<td>Bola 4</td>
<td>Bola 5</td>
<td>Bola 6</td>
<td>Bola 7</td>
<td>Bola 8</td>
<td>Bola 9</td>
<td>Bola 10</td>
<td>Bola 11</td>
<td>Bola 12</td>
<td>Bola 13</td>
<td>Bola 14</td>
<td>Bola 15</td></tr>";

/*Enquanto houver dados na tabela para serem mostrados será executado tudo que esta dentro do while */
while($escrever=mysql_fetch_array($res)){

/*Escreve cada linha da tabela*/
echo "<tr><td>" . $escrever['id'] . "</td>
<td>" . $escrever['bola1'] . "</td>
<td>" . $escrever['bola2'] . "</td>
<td>" . $escrever['bola3'] . "</td>
<td>" . $escrever['bola4'] . "</td>
<td>" . $escrever['bola5'] . "</td>
<td>" . $escrever['bola6'] . "</td>
<td>" . $escrever['bola7'] . "</td>
<td>" . $escrever['bola8'] . "</td>
<td>" . $escrever['bola9'] . "</td>
<td>" . $escrever['bola10'] . "</td>
<td>" . $escrever['bola11'] . "</td>
<td>" . $escrever['bola12'] . "</td>
<td>" . $escrever['bola13'] . "</td>
<td>" . $escrever['bola14'] . "</td>
<td>" . $escrever['bola15'] . "</td></tr>";

}/*Fim do while*/

echo "</table>"; /*fecha a tabela apos termino de impressão das linhas*/

mysql_close($conexao);

?>

</body>
</html>

Agora eu queria uma ajuda de vocês para conseguir listar as bolas do sorteio em ordem numérica.

Poderiam me ajudar?

Valeu!



#1014419 Revenda De Hospedagem... Escolha.

Posted by Leo_cgi on 28/10/2011, 10:04 in Dúvidas Gerais

Sugiro dar uma olhada na PlugHost. Tem planos muito bons de Revenda de Hospedagem com 30 dias pgrátis para testes e também tem SSL e WHMCS Grátis.



#1014418 Revenda De Hospedagem Linux

Posted by Leo_cgi on 28/10/2011, 10:01 in Servidores Linux

Continuo recomendando a mesma empresa, a PlugHost. Estou copm ela a muito tempo e os planos de Revenda de Hospedagem são muito bons e o suporte também.

Abraço!



#1014417 Como Criar Um Site Para Revenda De Hospedagem E Adaptar Na Revenda?

Posted by Leo_cgi on 28/10/2011, 09:59 in Dúvidas Gerais

Olá!
Procura a PlugHost. Estou lá a bastante tempo e lá tem planos de Revenda de Hospedagem e uns tutoriais ilustrados que te ensinam os primeiros passos.

Abraço!



#1014411 Revenda De Hospedagem

Posted by Leo_cgi on 27/10/2011, 22:31 in Mercado de Trabalho

Eu tenho uma Revenda de Hospedagem na PlugHost já tem 3 anos. Comecei lá com apenas um cliente e hoje tenho algumas dezenas. Recomendo conferir.




IPB Skin By Virteq