Here's the problem i'm having.
I've created a login page where the user enter his name and pass to enter. The database has already been created and i store the entered login info in session variable.
On clicking submit, i redirect the user to the page where php accesses the mysql database and searches the database for the user name and pass combination using session variables.
And there is the problem. The session variables cannot access the database table entries.
here is my code :
<?php
//starting the session
session_start();
//connecting to database and table "testdb"
@mysql_connect("localhost","root","") or die("no connect");
@mysql_select_db("testdb") or die ("no select");
//the session variables holding the username and password
//trying to access the entries in table named "table"
$sql="SELECT * FROM `table` WHERE name='.$_SESSION['uname'].' AND
pass='.$_SESSION['pass'].'";
$query=mysql_query($sql);
//printing the result which is just one entry
while($result=mysql_fetch_array($query))
{
echo $result['name'].' ';
echo $result['pass'];
}
?>
i don't know what the error is or if i'm using the syntax wrong. i've not written comments on the actual code...this is just an identical example :D
I'm not looking for alternates cause i'm in the learning stages as of now. So any fix to this code will be greatly appreciated.
PS: I don't know java script.
or die(mysql_error());it will give the perfect error of what's going wrong!