PHP+MYSQL+HTML question... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: PHP+MYSQL+HTML question... (
/showthread.php?tid=482376)
PHP+MYSQL+HTML question... -
NeroX98 - 20.12.2013
Hi guys...
I have a question... how to show top 10 most rich players on my website... i know the basics from php, mysql, html and css, but only the BASICS.
Here is my code:
PHP код:
<?php
include('../konekcija.php');
$proveripari = mysql_query("SELECT * FROM Igraci ORDER BY pCash LIMIT 10");
while ($row = mysql_fetch_array($proveripari))
{
$ime = $row["pProfil"];
$pari = $row["pCash"];
}
?>
and after this shit i have:
Код HTML:
<table id='desnastrana-tabela'>
<thead>
<th>Бр</th><th>Име</th><th>Држ</th><th>Богатство</th>
</thead>
<tbody>
<tr>
<td>1</td>
<td><?php$ime?></td>
</tr>
</tbody>
and its showing just blank field...
Re: PHP+MYSQL+HTML question... - Patrick - 20.12.2013
You had some errors in there, anyways I am not a
professional php coder, but I have knowledge about
php, the code below should work.
pawn Код:
<?php
include('../konekcija.php'); //include.
$proveripari = mysql_query("SELECT pProfil, pCash FROM Igraci ORDER BY pCash DESC LIMIT 10;"); //selects, pProfil, pCash and order pCash them by 10.
if( mysql_num_rows($proveripari) > 0) //if the row is more than 0, if no accounts registered the row will print none.
{//opening bracket 1
while ($row = mysql_fetch_array($proveripari))
{//opening bracket 2
echo"{$row['pProfil']}"; //shows the pProfil of the player
echo"{$row['pCash']}"; //shows the pCash of the player
}//closing bracket 1
}//closing bracket 2
?>
Re: PHP+MYSQL+HTML question... -
NeroX98 - 20.12.2013
OMG DUDE
IT WORKS
I LOVE YOU
REP +1