Warning: mysql_error() expects parameter 1 to be resource, string given
<?php
$username = "root";
$password = "password";
$database = "meipolytechnic";
mysql_connect('localhost', $username,$password);
@mysql_select_db($database) or die(mysql_error());
$query = "SELECT rollno FROM users where username = $_SESSION[MM_Username]";
$result = mysql_query($query) or die(mysql_error());
$num = mysql_numrows($result);
mysql_close();
$rows = array();
while($r = mysql_fetch_row($result))
{
$rows[] = $r[0];
}
echo ($rows['rollno']); ?>
?>
i want to retrieve only the logged in users roll no from users table in
database
when i run this code
and log in as foo
i get the following stuff
Unknown column 'foo' in 'where clause'
No comments:
Post a Comment