一切正常,除了当我从load_info函数调用save_info函数以保存到数据库时 我尝试将save_info函数中的整个代码块都包含在if语句中,但仍然无法正常工作
// This function will save information to an existing account
//==MAN8==
function save_info($dbh, $table, $pname, $pip, $pnp, $pop, $psp)
{
try
{
$stmt = $dbh->prepare("UPDATE $table SET p_ip=?, p_np=?,p_op=?,p_sp=? WHERE p_name=?");
$stmt->execute(array($pip,$pnp,$pop,$psp,$pname));
echo "1";
}
catch (PDOExecption $ex)
{
echo "0";
}
$dbh = null;
}
// This function will pull account information
//==MAN9==
function load_info($dbh,$table,$pname)
{
{
$stmt = $dbh->query("SELECT * FROM $table WHERE p_name = '$pname'");
$result = $stmt->fetchObject();
if ($result->p_ip > $result->p_np)
{
echo 'yes';
}
if ($result->p_ip = $result->p_np)
{
save_info($dbh, $table, $pname, $pip, $pnp, $pop, $psp);
}
}