Ir para conteúdo

POWERED BY:

Arquivado

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

Pedroalves

problema com tabelas no php

Recommended Posts

o meu problema e o seguinte não estou a conseguir uma tabela com linhas vazias

tipo

a minha tabela e constituída pelas seguinte colunas

Continente|Coordenadas | Nome da Cidade| Jogador| Aliança e o quero fazer é o seguinte

[1] [1:1:1] Maria Ola null

[1] [2:1:1]

[1] [3:1:1]

o continente vai 1 a 20 e coordenadas o 1 vai de 1 a 9 o segundo vai 1 a 400 e terceiro vai até 12

os campos Nome da Cidade jogador e aliança so são preenchidos se existir na base de dados

segue-se o código

<!DOCTYPE html>
<html ng-app="myApp" lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="Game">
    <meta name="author" content="Pedro Alves">
    <link rel="icon" href="../favicon.ico">
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src = "dist/js/mapas.js"></script> 
    <title>Game</title>

    <!-- Bootstrap core CSS -->
    <link href="dist/css/bootstrap.min.css" rel="stylesheet">
<link href="dist/css/menu.css" rel="stylesheet" type="text/css">
<script src="dist/js/modernizr.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="dist/js/ui-bootstrap-tpls-0.10.0.min.js"></script>
<script type="text/javascript" src="dist/js/shCore.js"></script> 
<script type="text/javascript" src="dist/js/shBrushXml.js"></script> 
<script type="text/javascript" src="dist/js/shBrushJScript.js"></script>


    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="dist/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="dist/css/starter-template.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="dist/js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
 <script type="text/javascript">
 function startTime() {
     var today=new Date();
     var h=today.getHours();
     var m=today.getMinutes();
     var s=today.getSeconds();
     
     // add a zero in front of numbers<10
     m=checkTime(m);
     s=checkTime(s);
     document.getElementById('txt').innerHTML=h+":"+m+":"+s;
     
 }

 function checkTime(i){
 if (i<10) {
     i= "0" + i;
 }
     return i;
 }
 
 setInterval(function(){ 
 	startTime();
 }, 
 500);
 </script>
  </head>
  
<body  >


<?php 
require_once('../configurations/auth.php');
require_once('../configurations/Database.php');
require_once('../classes/cidade.php');

$ola=$_SESSION['SESS_LOGIN'];
$dinheiro=$_SESSION['SESS_DINHEIRO']; 
$ouro=$_SESSION['SESS_OURO'];
$madeira=$_SESSION['SESS_MADEIRA'];
$metal=$_SESSION['SESS_METAL'] ;
$pedra=$_SESSION['SESS_PEDRA'];
$energia=$_SESSION['SESS_ENERGIA'];
$comida=$_SESSION['SESS_COMIDA'];
$petrolio=$_SESSION['SESS_PETROLIO'];

$nivel=$_SESSION['SESS_NIVEL'];

include ('include/menu.php');?>
<div id="conteudo-left"> 
<h1><img src="../imagens/logo.ico">Game</h1> 
</div>
<div id="conteudo-right">
  <h5>
	<img width="50px" height="50px" src="../imagens/recursos/ouro.png"><?php echo $ouro; ?>
  	<img width="50px" height="50px" src="../imagens/recursos/madeira.png"><?php echo $madeira; ?>
    <img width="50px" height="50px" src="../imagens/recursos/metal.png"><?php echo $metal;?>
    <img width="50px" height="50px" src="../imagens/recursos/pedra.png"><?php echo $pedra;?>
    <img width="50px" height="50px" src="../imagens/recursos/Lampada.png"><?php echo $energia;?>
    <img width="50px" height="50px" src="../imagens/recursos/comida.png"><?php echo $comida;?>
    <img width="50px" height="50px" src="../imagens/recursos/petrolio.png"><?php echo $petrolio;?>
    <img width="50px" height="50px" src="../imagens/recursos/moeda.png"><?php echo $dinheiro; ?> 
  
  	
    </h5>
   </div>
   
 <div style="width:100%;height:50px;background-color:#FFF"></div>
 
 

<div class="container-fluid" style="background-color:#FFF;height:550px;">
  
  <div class="row" style="width:100%">
    <div class="col-sm-4" style="width:20%">
    	<a style="float:right">Help </a>	
	<?php include ('include/vermenu.php');
 ?>
 </div>
    <div class="col-sm-4" style="background-color:#FFF; width:60%">
    <div style="height:50px;background-color:#000;"> <?php include ('include/mensagens.php');?> 
    </div>
    <div style="background-color:#0F9;height:700px">
    	  <div ng-controller="customersCrtl" class="container"  align="left" style="width:100%;height:800px;">
      <h3 align="center">Mapa</h3>
     <div class="row">
    <div class="col-md-2">PageSize:
        <select ng-model="entryLimit" class="form-control">
            <option>5</option>
            <option>10</option>
            <option>20</option>
            <option>50</option>
            <option>100</option>
        </select>
    </div>
    <div class="col-md-3">Filter:
        <input type="text" ng-model="search" ng-change="filter()" placeholder="Filter" class="form-control" />
    </div>
    <div class="col-md-4">
      <h5>Filtered {{ filtered.length }} of {{ totalItems}} total Cidades</h5>
    </div>
</div>
<br/>
<div class="row">
    <div class="col-md-12" ng-show="filteredItems > 0">
        <table class="table table-striped table-bordered">
        
        <thead>
        
         <th>Continente <a ng-click="sort_by('continente');"></a></th>
        <th>Nome <a ng-click="sort_by('nome');"><i class="glyphicon glyphicon-sort"></i></a></th>
        <th>Jogador <a ng-click="sort_by('username');"><i class="glyphicon glyphicon-sort"></i></a></th>
       <th>Aliança <a ng-click="sort_by('alianca');"><i class="glyphicon glyphicon-sort"></i></a></th-->
    <th>Ver</th>
    <!--  <th>Postal Code <a ng-click="sort_by('postalCode');"><i class="glyphicon glyphicon-sort"></i></a></th>
        <th>Country <a ng-click="sort_by('country');"><i class="glyphicon glyphicon-sort"></i></a></th>
        <th>Credit Limit <a ng-click="sort_by('creditLimit');"><i class="glyphicon glyphicon-sort"></i></a></th>
     -->
        </thead>
        <tbody ng-init="get_product()">
           <!---
            <tr ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
             -->
             <tr ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
         
      			<td>{{data.continente}}</td>
                <td>{{data.nome}}</td>
                <td>{{data.username}}</td>
                <td>{{data.alianca}}</td>
               <td> <button class="btn" ng-click="prod_espiar(data.continente)">
      <span class="glyphicon glyphicon-pencil"></span>  Espiar
      </button>
      <button class="btn" ng-click="prod_Escreve(data.username)">
      <span class="glyphicon glyphicon-pencil"></span>  Escreve Mensagen
      </button>
      <button class="btn" ng-click="prod_amizade(data.username)">
      <span class="glyphicon glyphicon-pencil"></span>  Pedido Amizade
      </button>
      <button class="btn" ng-click="prod_Ataque(data.continente)">
      <span class="glyphicon glyphicon-pencil"></span>  Ataque 
      </button>
      </td>
            
            </tr>
        </tbody>
        </table>
 
    </div>
    <div class="col-md-12" ng-show="filteredItems == 0">
        <div class="col-md-12">
            <h4>Nenhum projecto Adecionado</h4>
        </div>
    </div>
 
    <div class="col-md-12" ng-show="filteredItems > 0">
  <div pagination="" page="currentPage" max-size="10" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div>
 
 
    </div>
    
</div> 
  </div>
    	
   </div>
     </div>
    <div class="col-sm-4" style="width:20%;height:100%">cidades
    	
    	
    	<?php 
    	$cidades = new cidades();
  
    ?>
    	<br>
   <ul class="nav nav-pills nav-stacked">
    <?php 
    foreach ($cidades->getcidade($ola) as $m):
    $d=$m['cod_cidade']; ?>
    <li class="active"><a href="changer.php?id=<?php echo $d;?>" ><?php echo $m['Nome']; ?><br> <?php
		echo $m['continente'];
		echo $m['coordenadas'];
		?><br></a></li>
  <?php endforeach;?>
  </ul>
    	</div>
  </div>
 
   
  </div>

                 
<div>
            
  <?php  
include ('include/footer.php');
?>
</div>



    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="dist/js/jquery.min.js"><\/script>')</script>
    <script src="dist/js/bootstrap.min.js"></script>
    <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
    <script src="dist/js/holder.min.js"></script>
   
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="dist/js/ie10-viewport-bug-workaround.js"></script>
    
  
      <script src="dist/js/bootstrapValidator.js"></script>
   <script src="dist/js/bootstrapValidator.min.js"></script>
   
  </body>
</html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

a minha tabela e constituída pelas seguinte colunas

Continente|Coordenadas | Nome da Cidade| Jogador| Aliança e o quero fazer é o seguinte

[1] [1:1:1] Maria Ola null

[1] [2:1:1]

[1] [3:1:1]

....

quando insiro um novo dado na base de dados fica o seguinte

Continente|Coordenadas | Nome da Cidade| Jogador| Aliança|

[1] [1:1:1] Maria Ola null

[1] [2:1:1]

[1] [3:1:1] Manuel Maria Torradas

ou seja o nome da cidade , Jogador e aliança são preenchidos com os dados que tenho na base de dados

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.