我写的脚本是用来从mysql获取数据来预加载表单和编辑表单的,但是我的脚本没有插入任何数据,我不知道是什么问题。
它没有给出连接错误,但是没有数据插入到我的数据库中。有什么想法吗?
非常感谢。
下面是我的php文件:
<?php
include 'header.php';
$connection = mysql_connect("localhost", "User_Name", "Password");
$db = mysql_select_db("DB_Name", $connection);
if (isset($_GET['submit'])) {
$Id = "1";
$AppName = $_GET['appname'];
$AppVersion = $_GET['appversion'];
$AboutTitle = $_GET['abouttitle'];
$AboutText = $_GET['abouttext'];
$Developer = $_GET['developedby'];
$Copyright = $_GET['copyright'];
$Slider1 = $_GET['slider1'];
$Slider2 = $_GET['slider2'];
$Slider3 = $_GET['slider3'];
$Slider4 = $_GET['slider4'];
$KlassenArray = $_GET['klassenarray'];
$LehrerArray = $_GET['lehrerarray'];
$query = mysql_query("update AppInfo set
AppName='$AppName', AppVersion='$AppVersion', AboutTitle='$AboutTitle',
AboutText='$AboutText', Developer='$Developer',
Copyright='$Copyright', Slider1='$Slider1', Slider2='$Slider2', Slider3='$Slider3',
Slider4='$Slider4', KlassenArray='$KlassenArray',
LehrerArray='$LehrerArray' where Id=1", $connection);
}
$query = mysql_query("select * from AppInfo", $connection);
$update = $_GET['update'];
$query1 = mysql_query("select * from AppInfo where Id=1", $connection);
while ($row1 = mysql_fetch_array($query1)) {
$DAppName = $row1['AppName'];
$DAppVersion = $row1['AppVersion'];
$DAboutTitle = $row1['AboutTitle'];
$DAboutText = $row1['AboutText'];
$DDeveloper = $row1['Developer'];
$DCopyright = $row1['Copyright'];
$DSlider1 = $row1['Slider1'];
$DSlider2 = $row1['Slider2'];
$DSlider3 = $row1['Slider3'];
$DSlider4 = $row1['Slider4'];
$DKlassenArray = $row1['KlassenArray'];
$DLehrerArray = $row1['LehrerArray'];
}
?>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="page_title_block">
<div class="col-md-5 col-xs-12">
<div class="page_title">Settings</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row mrg-top">
<div class="col-md-12">
<div class="col-md-12 col-sm-12">
</div>
</div>
</div>
<div class="card-body mrg_bottom">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#app_settings" aria-controls="app_settings" role="tab" data-toggle="tab">App Settings</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="app_settings">
<form action="" name="settings_from" method="get" class="form form-horizontal">
<div class="section">
<div class="section-body">
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-6">
<input type="hidden" name="id" value="1" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">App Name :-</label>
<div class="col-md-6">
<input type="text" name="appname" value="<?php echo $DAppName; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">App Version :-</label>
<div class="col-md-6">
<input type="text" name="appversion" value="<?php echo $DAppVersion; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">About Title :-</label>
<div class="col-md-6">
<input type="text" name="abouttitle" value="<?php echo $DAboutTitle; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">About Text :-</label>
<div class="col-md-6">
<input type="text" name="abouttext" value="<?php echo $DAboutText; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Developed By :-</label>
<div class="col-md-6">
<input type="text" name="developedby" value="<?php echo $DDeveloper; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Copyright :-</label>
<div class="col-md-6">
<input type="text" name="copyright" value="<?php echo $DCopyright; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Slider 1 :-</label>
<div class="col-md-6">
<input type="text" name="slider1" value="<?php echo $DSlider1; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Slider 2 :-</label>
<div class="col-md-6">
<input type="text" name="slider2" value="<?php echo $DSlider2; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Slider 3 :-</label>
<div class="col-md-6">
<input type="text" name="slider3" value="<?php echo $DSlider3; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Slider 4 :-</label>
<div class="col-md-6">
<input type="text" name="slider4" value="<?php echo $DSlider4; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Klassen Array :-</label>
<div class="col-md-6">
<input type="text" name="klassenarray" value="<?php echo $DKlassenArray; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Lehrer Array :-</label>
<div class="col-md-6">
<input type="text" name="lehrerarray" value="<?php echo $DLehrerArray; ?>" class="form-control">
</div>
</div>
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<button type="submit" name="submit" value="update" class="btn btn-primary">Save</button>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
mysql_close($connection);
include 'footer.php';
?>
暂无答案!
目前还没有任何答案,快来回答吧!