我正在写这个脚本
<form method="post" id="form" action="join_config.php">
<label>First Name</label>
<input name="first_name" type="text" id="firstname">
<label>Last Name</label>
<input name="last_name" type="text" id="lastname">
<label>Email</label>
<input name="email" type="email">
<label>Twitter Handle</label>
<input name="twitter" type="text">
<label>Country</label>
<input name="country" type="text">
<label>City</label>
<input name="city" type="text">
<label>Phone</label>
<input name="phone" type="checkbox">iPhone
<input name="phone" type="checkbox">Samsung
<input name="phone" type="checkbox">HTC
<input name="phone" type="checkbox">Nokia
<p style="margin-bottom:0;">Others:</p><input name="phone" type="text">
<label>Availability</label>
<input name="availability" type="text">
<input name="submit" type="submit" value="Submit" id="#submit">
</form>
还有我的 PHP mysqli 代码
<?php
$firstname = $_POST['first_name'];
$lastname = $_POST['last_name'];
$email = $_POST['email'];
$twitter = $_POST['twitter'];
$country = $_POST['country'];
$city = $_POST['city'];
$phone = $_POST['phone'];
$availability = $_POST['availability'];
$date = date("d.m.y");
$SQL = "INSERT INTO join(first_name, last_name, email, twitter, country, city, phone, availability, date)VALUES('$firstname','$lastname','$email','$twitter','$country','$city','$phone','$availability','$date')";
echo $SQL . "<br>";
include_once('inc/config.php');
$stmt = $db->prepare("INSERT INTO join VALUES (?,?)");
$stmt->bind_param('ss', $firstname, $lastname);
$stmt->execute();
$stmt->close();
?>
当我运行它时,我收到了这个错误:
Fatal error: Call to a member function bind_param() on a non-object in /join_config.php on line 17
我在 mac OSX Lion 上运行,稍后将包含安全线程,但首先我需要插入到我的数据库中。
有什么帮助或建议吗?