PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
//.....
echo $sql = "SELECT * from accounts WHERE username='$user'"; // added
$checklevel = mysql_query($sql) or die(mysql_error()); // your line, modified
echo mysql_num_rows($checklevel); // added
while ($fetch=mysql_fetch_array($checklevel)) // your line
{
print_r($fetch);
//........
<?php
checkcookie = $_COOKIE['terrastormlogin'];
if (isset($checkcookie))
{
$loggedin = "1";
global $loggedin;
global $user;
require("db_info.php");
mysql_connect($host,$username,$password) or die(mysql_error());
mysql_select_db($database) or die(mysql_error());
$sql = "SELECT * FROM `accounts` WHERE `username`='$user'";
$query = mysql_query($sql) or die(mysql_error());
while ($fetch=mysql_fetch_array($query))
{
$dbuser=$fetch['username'];
$userlevel=$fetch['level'];
$maincontent = "";
$maincontent .= "$dbuser";
}
}
else if (!isset($checkcookie))
{
$loggedin = "0";
global $loggedin;
$maincontent = "";
$maincontent .= "Not logged in!";
}
?>
But not all i'm getting is:
Notice: Undefined variable: maincontent in *hidden*\portal.php on line 97
*EDIT* - I changed the code again, and put in what you told me to, i still get the maincontent error. and i get: SELECT * FROM `accounts` WHERE `username`=''0 in the top corner, because it echo's it