我创建了这段代码来更新 mysql,但它似乎不起作用。我已经尽力了,但还是不行。它没有更新我的数据库。可能是什么问题呢?我的配置页面
<?php
define("dbuser", "XX");
define("dbpass", "XX");
define("dbhost", "localhost");
define("dbname", "smsplugin");
?>
$smsbal = $_POST['smsbal'];
$values =$_POST['values'];
$api = $_POST['api'];
$db = new PDO('mysql:host='.dbhost.';dbname='.dbname.';charset=utf8', dbuser, dbpass);
$sql="UPDATE user SET api=?,values=?,left=? WHERE id='1'";
$q=$db->prepare($sql);
$q->execute(array($api,$values,$smsbal));
<form method="POST" action="" class="well form-horizontal" style="width:338px;margin:0 auto;"><br />
<br />
<p>
<label for="api"><strong>API Setting</strong></label>
<input type="text" name="api" id="api" data-placement="right" data-html="true" data-animation="true"/>
</p>
<p>
<label for="values"><strong>API Values</strong></label>
<input type="text" name="values" id="values" title="These are the values that are passed to your SMS provider; <strong>Sender, Receiver and the Message</strong>. Depending on the
setting of your SMS Provider, ensure that <em>$sender</em> is use for the sender value, <em>$receipient</em> is used for the receiver value and <em>$message</em> is used for the message value like in the
example below <br /><strong>NOTE: CHANGE 'sender=','receipient=' and 'message=' TO THE ACCEPTED VARIABLES OF YOUR SMS PROVIDER.</strong>
sender=$sender&recipient=$recipient&message= $message" value="<?php print $fapi ;?>" data-placement="right" data-html="true" data-animation="true"/>
</p>
<p>
<label for="smsbal"><strong>SMS Balance</strong> (optional)</label>
<input type="text" name="smsbal" id="smsbal" title="This is the script that checks the remaining balance of your SMS unit. <br />
<strong>NOTE: ENTER THE ACCEPTED VARIABLE AND VALUE OF YOUR SMS PROVIDER.</strong><strong>E.g: bal=true</strong>" data-placement="right" data-html="true" data-animation="true" />
</p>
<div class="control-group">
<button type="submit" name="save" value="save" class="btn-primary btn-mini">Save</button>
</div>
</form>