如果我的函数返回true,我想用1替换数据库中的null。对于会话用户,我不知道该怎么做。
在PHP中我应该使用0还是1来表示真的?
这是我的代码的第一部分,包括会话用户和javascript函数的返回。
<?php
mysql_connect('localhost','user','pass');
mysql_select_db('db');
session_start();
$username=$_SESSION['username'];
if(!$username){
die("Please login");
}
else
{
$query="select *from users WHERE username='$username' ";
$run=mysql_query($query);
while($row=mysql_fetch_array($run)){
$admin=$row['username'];
}
}
?>
<!doctype html>
<html>
<head>
<title>practice</title>
<link rel="stylesheet" type="text/css" href="Substyle.css">
<script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
<script src="js/general.js" type="text/javascript">
</script>
</head>
<body>
<form name="myForm" autocomplete="on" onsubmit="return validateForm()">