This question has been bothering me for a few days. The following image shows the data submitted in the form to jump to the query page but it does not appear to be inserted in the data database has been inserted but if you open the Data query page can be displayed who can help me?
Here's my code you guys can try it at first I thought it was a cache problem. Change a few browsers.
The first page submitted
The second page inserts a
$con =mysql_connect ("localhost", "root", "");; mysql_connect ("localhost", "root", "");
if (! $con)
{
Die (' Could not connect: '. Mysql_error ());
}
mysql_select_db ("T1", $con);
$sql = "INSERT into Stu (ID, name, num)
VALUES (' $_post[firstname] ', ' $_post[lastname] ', ' $_post[age] ') ";
if (!mysql_query ($sql, $con))
{
die('Error: ' . mysql_error());
}
echo "";
Mysql_close ($con)
?>
The third page of the query, that is, this page if you open this page alone can display the data just inserted but jump over the page is not displayed like in the picture is really strange
$con = mysql_connect ("localhost", "root", "");
if (! $con)
{
echo "连接数据库失败"; exit;
}
$sql = ' Use T1 ';
mysql_query ($sql, $con);
$sql = ' Select*from stu ';
$rs =mysql_query ($sql, $con);
$list =array ();
while ($row =mysql_fetch_assoc ($rs)) {
$list[]=$row;
}
Echo ' $sql '
?>
学号姓名年龄
'.$v['id'].''; echo ''.$v['name'],''; echo ''.$v['num'].''; echo '编辑';}
?>
Reply content:
This question has been bothering me for a few days. The following image shows the data submitted in the form to jump to the query page but it does not appear to be inserted in the data database has been inserted but if you open the Data query page can be displayed who can help me?
Here's my code you guys can try it at first I thought it was a cache problem. Change a few browsers.
The first page submitted
The second page inserts a
$con =mysql_connect ("localhost", "root", "");; mysql_connect ("localhost", "root", "");
if (! $con)
{
Die (' Could not connect: '. Mysql_error ());
}
mysql_select_db ("T1", $con);
$sql = "INSERT into Stu (ID, name, num)
VALUES (' $_post[firstname] ', ' $_post[lastname] ', ' $_post[age] ') ";
if (!mysql_query ($sql, $con))
{
die('Error: ' . mysql_error());
}
echo "";
Mysql_close ($con)
?>
The third page of the query, that is, this page if you open this page alone can display the data just inserted but jump over the page is not displayed like in the picture is really strange
$con = mysql_connect ("localhost", "root", "");
if (! $con)
{
echo "连接数据库失败"; exit;
}
$sql = ' Use T1 ';
mysql_query ($sql, $con);
$sql = ' Select*from stu ';
$rs =mysql_query ($sql, $con);
$list =array ();
while ($row =mysql_fetch_assoc ($rs)) {
$list[]=$row;
}
Echo ' $sql '
?>
学号姓名年龄
'.$v['id'].''; echo ''.$v['name'],''; echo ''.$v['num'].''; echo '编辑';}
?>
Use the header to do the jump header (' Location:xxx.php '), see the error, as if the version of the problem
Should be your version of the problem, you can add in front of the mysql_connect @, I use your source, in the local test everything is normal and will not prompt the wrong. But this is not a positive approach, I suggest you upgrade the version, you can also tell me which version of MySQL you are using.