[PHP] My php code rofl :P
Code:
<?php
error_reporting(0);
include("settings.php");
echo "<title>".$settings_title."</title>";
$con = mysql_connect($settings_sqlhost,$settings_username,$settings_password);
mysql_select_db($settings_database, $con);
$res = mysql_query("SELECT count(*) FROM accounts;");
$val = mysql_num_rows($res);
$res = mysql_query("SELECT Name FROM characters");
$res2 = mysql_query("SELECT Level FROM characters ORDER BY Money DESC LIMIT 1;");
$val = mysql_fetch_array($res);
$val2 = mysql_fetch_array($res2);
echo "<div style='top: 200; left: 550; position: absolute; z-index: 1; visibility: show;'><br> <b>Name:</b> ".$val[0]." - ";
?>
How do i show all the characters their names
[LOGIN]
And everytime i try to make a login work with other tables it doesnt work and i dont know why can someone make me one with this tables:
accounts.AccountID and accounts.Password
Kthx,
WannaDeaD
re: [PHP] My php code rofl :P
what exactly are you trying to do.
1. trying to get All characters names
or
2. trying to get the name of the person logging in
Re: [PHP] My php code rofl :P
do display all the characters on your database you must put the fetch array function on a while loop.
Re: [PHP] My php code rofl :P
its not limited to a while function but its the most commonly used.
if im understanding his question then i think the best would be a foreach function
Re: [PHP] My php code rofl :P
Umm.. this is one way you can select all of the names from the characters table and display them,
PHP Code:
<?php
echo '<strong>Names: </strong><blockquote><p>';
$query = mysql_query('SELECT Name FROM characters');
while($row = mysql_fetch_array($query))
echo $row['Name'].'<br />';
echo '</blockquote></p>';
?>
Is that by any chance what you want?
As for the login script, why do you need two different tables?
If you do use two different tables, what's the problem that comes up?
Re: [PHP] My php code rofl :P
Alll fixed thx for ur help