Beste Phphulpers, Ik heb zoals mij net is aangeraden hier een nieuw Topic gestart. En zit met een vraagje weer.
Ik heb namelijk nu dat die een Fout geeft als Else fout.
Maar dus gaat iets mis hier tussen:
Dit zijn de 3 scripts. En ik laat alles wegschrijven tussen Cookies ;). Dat werkt goed.
Hier de 3 Scripts:
****Config.php****
<?php
ob_start();
// Host name
$username="******"; // Mysql username
$password="******"; // Mysql password
$db_name="******"; // Database name
$tbl_name="player"; // Table name
// Connect to server and select databse.
mysql_connect("localhost", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$name = $_COOKIE['username'];
$sql = 'mysql_query("SELECT * FROM player WHERE name = $name")';
$res = mysql_query($sql);
if ($res && mysql_num_rows($res) >= 1)
{
while($row = mysql_fetch_array($sql))
{
$money = $rows["money"];
$bullets = $rows["bullets"];
}
} else {
echo 'Fout !, Controleer nog iets.'; }
?>
****Index_Player.php****
<?php
include 'config.php';
?>
<html>
<head>
</head>
<body>
<BR>
Je hebt:
<?php
if(isset($bullets)){
echo $bullets; }
else{echo 'error';};
?>
Kogels als er 5 staat dan klopt het. en error dan niet.<BR><BR>
<?php
if(isset($money)){
echo $money ; }
else{echo 'error';};
echo $_COOKIE['username']
?>
</body>
</html>
****Index.php****
<html>
<head>
<TITLE>NoName - Online maffia game</TITLE>
</head>
<body>
<center
<font size="24">NoName</font>
<table width="400" border="0" BACKGROUND="log_bg.jpg">
<th>
<form name="form1" method="post" action="login_submit.php"> Naam:<BR> <input name="myusername" type="text" id="myusername" value="<?
if(isset($_COOKIE["username"])){
echo $_COOKIE['username'];
}
?>"><BR><BR> Wachtwoord:<BR> <input name="mypassword" type="password" id="mypassword" value="<?
if(isset($_COOKIE["password"])){
echo $_COOKIE['password'];
}?>"><BR><BR> Remember <input type="checkbox" name="coockie" value="yes"><BR>
<input type="submit" name="Submit" value="Login">
</p></form><BR>
</th></table>
</body>
</html>
**************************************************************
Er zit nog iets tussen om alles weg te schrijven en zo ;), maar dat lijtk me niet belangrijk. Als het toch handig is hoor ik het wel. Dit is de fout die hij geeft ook al staat er in de mysql onder dat 5 bij bullets:
Fout !, Controleer nog iets.
Je hebt: error Kogels als er 5 staat dan klopt het. en error dan niet.
errorRuben
Ik hoop dat iemand het snapt, Als iemand het weet,
Alvast Bedankt,
Ruben
p.s. Ik ben een beginner ;)
296 views