试图从数据库打印信息[关闭]

I'm trying to print the info from the database where the user login using school code and store inside session, and I use the session school code to search to particular rows in the database, but it couldn't display out? What's the problem?

$school_code = $_SESSION['login_school'];

$data = mysql_query("SELECT * FROM schools_info WHERE school_name = 'school_code'");
$info = mysql_fetch_array($data); 

print_r ($info); 

You're passing the string literal "school_code" not the variable.

$data = mysql_query("SELECT * FROM schools_info WHERE school_name = '$school_code'");

First use this

$data = mysql_query("SELECT * FROM schools_info WHERE school_name = '$school_code'");

second instead of print_r($info)

u shud do while loop like this

while ($info = mysql_fetch_array($data)) {

}