我正在写这个剧本
<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上运行,稍后会包含安全线程,但首先需要插入我的数据库。
任何帮助或建议?