对不起,我的最后一个帖子。这是我的修改,请帮助我。
<?php
//connect database
$sql = "SELECT * FROM user where user_id = 8320 AND password = 'admin' ";
$query = pg_query($sql);
var_dump($row = pg_fetch_array($query)); //dumps correctly.
?>
但问题是这样的..当我尝试将其作为一个函数时:
function check($user_id, $password)
{
$sql = "SELECT * FROM user where user_id = $user_id AND password = '$password' ";
$query = pg_query($sql);
$row = pg_fetch_array($query);
return $row;
}
并在此处调用:
var_dump($data = check(8320, 'admin')); DUMPS NULL;
怎么就变成这样了?