我有一个 php 脚本,如果文本框表单中的条目与数据库中的任何内容匹配,则创建一个会话:
$name= $_POST['name'];
$db= new PDO('sqlite:people.db');
$query = "SELECT * from names WHERE name= '$name'";
$results = $db->Query($query)->fetchAll();
$allow= count($results);
if ( $table > 0 )
{
session_start();
$enable= 1;
$_SESSION['enabled'] = $enable;
}
另一个脚本是这样的:
if (isset($_SESSION))
{
$code= $_POST['code'];
$db= new PDO('sqlite:Properties1.db');
$query = "SELECT * from properties WHERE postcode = '$postcode'";
$results = $db->Query($query)->fetchAll(); //fetchAll puts results into an array
$allow= count($results); //count the rows in the results array
if ( $rowcount > 0 )
{
do this
}
但是第二个脚本没有接听会话