mysql am i doing something wrong ?
Posted: Sat Feb 06, 2010 1:24 am
im trying to show info about the user on the page there id and stuff but for some resson it ent showing
it does not show anything none of them work im not getting any errors i am starting the session at top of the page two but still ent working
i am making the variable $username on the login page
all the login works fine just showing the info dont and i dont know why ?
Code: Select all
<?php
mysql_connect("..", "_", "") or die(mysql_error());
mysql_select_db("_") or die(mysql_error());
$sql = ("SELECT username FROM users WHERE username = '$username'")or die(mysql_error());
$result = mysql_query($sql) or die(mysql_error());
$values = mysql_fetch_array($result);
print $values['username'];
?>
- Trainer #
<?php
$sql = ("SELECT ID FROM users WHERE username = '$username'")or die(mysql_error());
$result = mysql_query($sql) or die(mysql_error());
$values = mysql_fetch_array($result);
print $values['ID'];
?>
</p>
<p class="style6"> </p>
<p>
<?php
$sql = ("SELECT pokemon1_pic FROM users WHERE username = '$username'")or die(mysql_error());
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($result);?>
</p>
<p align="center"><img src="<?php echo $row['pokemon1_pic'] ?>" width="94" height="93" /> </p>
<p><span class="style6">Pokemon:</span>
<?php
$sql = ("SELECT pokemon FROM users WHERE username = '$username'")or die(mysql_error());
$result = mysql_query($sql) or die(mysql_error());
$values = mysql_fetch_array($result);
print $values['pokemon'];
?>
</p>
<p><span class="style6">Level:</span>
<?php
$sql = ("SELECT poke1lvl FROM users WHERE username = '$username'")or die(mysql_error());
$result = mysql_query($sql) or die(mysql_error());
$values = mysql_fetch_array($result);
print $values['poke1lvl'];
?>it does not show anything none of them work im not getting any errors i am starting the session at top of the page two but still ent working
i am making the variable $username on the login page
Code: Select all
// if login is ok then we add a cookie
$_POST['username'] = stripslashes($_POST['username']);
$hour = time() + 3600;
setcookie(ID_my_site, $_POST['username'], $hour);
setcookie(Key_my_site, $_POST['pass'], $hour);
//if there is, it logs you in and directes you to the members page
{
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{
if ($pass != $info['password'])
{
}
else
{
header("Location: members.php");all the login works fine just showing the info dont and i dont know why ?