我正在制作一个非常简单的群组(如 vb 论坛群组)。在遇到一些错误并修复它之后,我已经编写了所有代码,现在它显示的页面没有错误。
现在的问题是数据没有被插入到 mysql 中。将输入放入表单然后按创建时,它会转到“?update = update”并回显成功消息,但不会提交给mysql。
代码:
<? if(!$update) { ?>
<form action="make_group.php?update=update" method="post">
Group name: <br />
<input name="title" type="text" size="30" />
<br />
Group picture: <br />
<input name="picture" type="text" size="30" />
<br />
Group desc: <br />
<textarea name="desc" cols=30 rows=10 wrap=physical></textarea>
<br />
<input type="submit" value="Create" />
<? }
elseif($update==update)
{
$username = $_SESSION[usr_name];
$action = "made a group";
$title = clean($_POST[title]);
$desc = clean($_POST[desc]);
$pictures = clean($_POST[pictures]);
$updateemail = mysql_query("insert into usr_groups(username, title, desc, picture) values('$username', '$title', '$desc', '$picture')");
$result = @mysql_query($qry2);
echo("Your group has been created");
} ?>
以上页面代码
<?
session_start();
include("config.php");
$ip = $_SERVER['REMOTE_ADDR'];
$sqlcontent = mysql_query("select * from usr_config");
$content = mysql_fetch_array($sqlcontent);
if(!isset($_SESSION[usr_name]) || empty($_SESSION[usr_name]) || !isset($_SESSION[usr_level]) || empty($_SESSION[usr_level]))
{
session_destroy();
session_unset();
die('
<tr>
<td><meta http-equiv="REFRESH" content="0;url=/index.php"></HEAD></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</div>
</body>');
}
include("func.php");
$update = clean($_GET[update]);
$getprof = mysql_query("select * from usr_users where username = '$_SESSION[usr_name]'");
$prof = mysql_fetch_array($getprof);
?>