Page 1 of 1

problem in mysql_query

Posted: Thu Feb 09, 2012 8:16 am
by newbie123
<?php
ob_start();
session_start();
if(!isset($_SESSION['Username'])){
header("Location: login.php");
}
else{
$username=$_SESSION['Username'];

include ('database_connection.php');
$connection = mysql_query("SELECT `Balance`, `Nick_name`, `Activation`, `Email`, `Memberid` FROM `members` WHERE `Username`=$username");
list($Balance, $Nick_name, $Activation, $Email, $Memberid) = mysql_fetch_row($connection);
}
?>

here i am using echo $Balance but its not printing. _SESSION['Username'] printing correctly.
Is there any problem with mysql_query.
Please help

Re: problem in mysql_query

Posted: Thu Feb 09, 2012 8:20 am
by Celauran
And if you put single quotes around $username in your query?