Jump to content
Sign in to follow this  
Bogdano

Ajutor creare tabel in baza de date

Recommended Posts

Cum creez o tabela care sa aiba minimum level sa pot modifica din baza de date levelul la panel de aici http://postimg.org/image/emhow9067/ ,am incercat sa creez singur o tebela dar nu am reusit adica nustiu informatiile necesare sa faca legatura intre panel>>>minimum level si baza de date.......daca ma puteti ajuta ar fi super.....


Daca te-am ajutat ,nu ezita sa dai +1.

Skipe: bogo.bogo11

Y/M: bogdano_bogo@yahoo.com

Site: [http://alien-gaming.ro/]

 

 

Share this post


Link to post
Share on other sites

De ce ai crea o tabela completa pentru o singura coloana? Cand lista de unde tragi serverele sigur are propia tabla.


PHP Developer - Not available for freelancing right now

Daca ai de gand sa postezi la categoria IPB, nu uita sa citesti regulamentul: Link regulament

Share this post


Link to post
Share on other sites

Pai trebuie sa vezi de unde citeste datele alea, unde executa query-ul pentru lista aia, vezi ce tabla citeste:

SELECT * FROM NumeTabla

 


PHP Developer - Not available for freelancing right now

Daca ai de gand sa postezi la categoria IPB, nu uita sa citesti regulamentul: Link regulament

Share this post


Link to post
Share on other sites

da dar asta e problema ca nu am facuta tabela respectiva adica in fiserul list.php din panel unde am toate alea qeriul e facut pt toate factiunile uite cum am list.php

<?php
include 'includes/config.php';
include 'includes/header.php';

$lspd = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 1');
$lspd = mysql_fetch_array($lspd);

$fbi = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 2');
$fbi = mysql_fetch_array($fbi);

$ng = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 3');
$ng = mysql_fetch_array($ng);

$para = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 4');
$para = mysql_fetch_array($para);

$lvpd = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 5');
$lvpd = mysql_fetch_array($lvpd);

$rus = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 6');
$rus = mysql_fetch_array($rus);

$grove = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 7');
$grove = mysql_fetch_array($grove);

$aztec = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 8');
$aztec = mysql_fetch_array($aztec);

$rifa = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 9');
$rifa = mysql_fetch_array($rifa);

$balas = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 10');
$balas = mysql_fetch_array($balas);

$vagos = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 11');
$vagos = mysql_fetch_array($vagos);

$hitman = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 12');
$hitman = mysql_fetch_array($hitman);

$si = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 13');
$si = mysql_fetch_array($si);

$taxi = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 14');
$taxi = mysql_fetch_array($taxi);

$nr = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 15');
$nr = mysql_fetch_array($nr);

$da = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 16');
$da = mysql_fetch_array($da);


$nu = mysql_query('SELECT COUNT(playerID) as total FROM playeraccounts WHERE playerGroup = 17');
$nu = mysql_fetch_array($nu);

?>

<div class="main-content">
<div class="page-content">
<div class="row-fluid">
 
<div class="page-header">
<h1>Lista factiuni</h1>
</div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th class="center">ID</th>
<th>Nume</th>
<th class="hidden-480">Membrii</th>
<th class="hidden-480">Optiuni</th>
<th class="hidden-100">Status aplicatii</th>
<th class="center">Level minim</th>
</tr>
</thead>
<?php $query = mysql_query('SELECT * from groups order by groupID asc'); 
      while($dnn=mysql_fetch_array($query)) { ?>
<tbody>
<tr>
<td class="center"><?php echo htmlentities($dnn['groupID']); ?></td>
<td>
<?php echo htmlentities($dnn['groupName']); ?>
</td>
<td class="hidden-480">
<?php if($dnn['groupID']=="1") { ?> <?=$lspd['total']?> <?php } ?> 
<?php if($dnn['groupID']=="2") { ?> <?=$fbi['total']?> <?php } ?>
<?php if($dnn['groupID']=="3") { ?> <?=$ng['total']?> <?php } ?> 
<?php if($dnn['groupID']=="4") { ?> <?=$para['total']?> <?php } ?> 
<?php if($dnn['groupID']=="5") { ?> <?=$lvpd['total']?> <?php } ?>
<?php if($dnn['groupID']=="6") { ?> <?=$rus['total']?> <?php } ?> 
<?php if($dnn['groupID']=="7") { ?> <?=$grove['total']?> <?php } ?> 
<?php if($dnn['groupID']=="8") { ?> <?=$aztec['total']?> <?php } ?> 
<?php if($dnn['groupID']=="9") { ?> <?=$rifa['total']?> <?php } ?>
<?php if($dnn['groupID']=="10") { ?> <?=$balas['total']?> <?php } ?> 
<?php if($dnn['groupID']=="11") { ?> <?=$vagos['total']?> <?php } ?> 
<?php if($dnn['groupID']=="12") { ?> <?=$hitman['total']?> <?php } ?>  
<?php if($dnn['groupID']=="13") { ?> <?=$si['total']?> <?php } ?>
<?php if($dnn['groupID']=="14") { ?> <?=$taxi['total']?> <?php } ?>
<?php if($dnn['groupID']=="15") { ?> <?=$nr['total']?> <?php } ?>


 / <?php echo htmlentities($dnn['groupSlots']); ?>
</td>
<td>
<a href="members.php?f=<?php echo htmlentities($dnn['groupID']); ?>">Membrii</a> / <a href="logs.php?f=<?php echo htmlentities($dnn['groupID']); ?>">Log-uri</a> / <a href="aplications.php?f=<?php echo htmlentities($dnn['groupID']); ?>">Aplicatii</a> / <a href="fcomplaints.php?f=<?php echo htmlentities($dnn['groupID']); ?>">Reclamatii</a>
</td>
<td>

<?php if($dnn['groupAplication']=="1"){ ?>

<a href="apply.php?f=<?php echo htmlentities($dnn['groupID']); ?>"><button class="btn btn-small btn-success">Aplica!</button></a>

<?php } ?>

<?php if($dnn['groupAplication']=="0") { ?>


<span class="text-error">Aplicatii inchise.</span>


<?php } ?>


<?php if($dnn['groupAplication']=="15") { ?> <?=$nr['total']?> <?php } ?>

</td>
<td class="center">3</td>

</tr>
<?php } ?>
</tbody>
</table>
 
 

 

<!-- do not affect this divs, or your design will fuck up -->
</div>
</div>
</div>
<!-- do not affect this divs, or your design will fuck up -->

 

Si eu in baza de date nu am facuta tabela aia la groups cu minimum level ca sa fac legatura la fiecare factiune sa pot edita la fiecare in parte levelul,mai exact eu vreau sa stiu cum fac tebala aia si legatura in php.....

Edited by Bogdano

Daca te-am ajutat ,nu ezita sa dai +1.

Skipe: bogo.bogo11

Y/M: bogdano_bogo@yahoo.com

Site: [http://alien-gaming.ro/]

 

 

Share this post


Link to post
Share on other sites

Pentru a crea o tabla: http://www.w3schools.com/sql/sql_create_table.asp

Conectarea o faci la fel ca si aia cu playerii:

$SQL = mysql_query('SELECT * FROM tabla WHERE server = ID-server');
$server = mysql_fetch_array($SQL);

Asa vei lua datele de la tabla X si de la serveru Y. Eu tot nu inteleg unde ai tu lista aia de factiuni/servere sau ce or fi, le ai puse manual 1 cate 1? Daca da, foarte rau, poti adauga factiunile in baza de date si sa aiba o coloana minimum_level sau cum vrei so numesti tu.

Adica sa ai ceva de genu ca si coloane in tabla acea ( sa zicem ca o numesti "factiuni" ):

id, server/factiune, level_minim

Odata ce ai asta, poti face un query cu:

$SQL = "SELECT * FROM factiuni";
$res = mysql_fetch_array($SQL);

Aia iti va returna toate factiunile cu toate datele prezente in baza de date. Sa le arati intr-o lista, te poti folosi de foreach ( http://php.net/manual/es/control-structures.foreach.php ):

foreach($res as $value) {
    echo "<tr><td>{$value['factiune']}</td><td>{$value['level_minim']}</td></tr>"
}

Tine minte ca asta e doar un exemplu de cod, il poti aplica cu orice cod HTML vrei pentru fiecare rand din baza de date.

Toata bucata ce ai tu acolo repetata de 100 de ori, se poate lucra cu un singur array si functia foreach de la PHP.


PHP Developer - Not available for freelancing right now

Daca ai de gand sa postezi la categoria IPB, nu uita sa citesti regulamentul: Link regulament

Share this post


Link to post
Share on other sites

am incercat sa creez o coloana noua cum ai zis tu minim_level dar imi da niste erori, ma gandesc ca strucutra care o folosesc eu nu este corecta am incercat sub mai multe forme dar imi da eroare de la tokeni http://postimg.org/image/h2iv4ixmb/ ma puteti ajuta aici sami ziceti ce setari ar trebui facute?

Edited by Bogdano

Daca te-am ajutat ,nu ezita sa dai +1.

Skipe: bogo.bogo11

Y/M: bogdano_bogo@yahoo.com

Site: [http://alien-gaming.ro/]

 

 

Share this post


Link to post
Share on other sites

Pai sa incepem.

Tipu varchar nu poate contine 0.1 la lungime/setare, doar numere intregi, fara decimali.

Daca e vorba sa fie doar numere la coloana minim_level, ar trebui sa fie o coloana tip 'INT'.

La 'Implicit', seteaza NULL.

La 'Index' seteaza prima optiune '--'.

Si acum ar trebui sa te lase.


PHP Developer - Not available for freelancing right now

Daca ai de gand sa postezi la categoria IPB, nu uita sa citesti regulamentul: Link regulament

Share this post


Link to post
Share on other sites

k am rezolvat am reusit sa creez coloana dar problema e ca nustiu cum sa fac legatura in fiserul list.php am incercat manual cu  

$lspd=mysql_query('SELECT FROM(playerID) as total FROM playeraccounts WHERE level_minim = 1');
$lspd = mysql_fetch_array($lspd);

 dar nu imi face nicio afisare ,sunt incepator si nustiu prea bine functiile.......,daca ai nevoie de list.php lam postat mai sus.


Daca te-am ajutat ,nu ezita sa dai +1.

Skipe: bogo.bogo11

Y/M: bogdano_bogo@yahoo.com

Site: [http://alien-gaming.ro/]

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...