我知道在 SE 上已经有很多关于“警告:缺少论点 2”问题的文章,尽管我似乎无法真正找到答案(即使在多次查看所有其他问题之后)。
第一个错误集:http: //i.stack.imgur.com/HTySO.png
第二个错误集:http: //i.stack.imgur.com/wDwxm.png
(我尝试发布为 SE 图像,但由于我是新手,它不会让我)
这是我目前遇到的两个错误 20 次(我有 20 个不同的数据库字段,这是一个“配置文件”部分)。
我花了大约两个小时试图弄清楚为什么它不起作用,但我一无所知。
addProfile.php :
<?php
include('../includes/functions.php');
if(isset($_POST['submit'])) {
if(isset($_POST['profile_name'])) {
addProfile($_POST['profile_name']);
} else {
echo "Please Enter A Profile Name!";
include('manage_settings.php');
}
if(isset($_POST['profile_description'])) {
addProfile($_POST['profile_description']);
} else {
echo "Please Enter A Profile Description!";
include('manage_settings.php');
}
if(isset($_POST['first_name'])) {
addProfile($_POST['first_name']);
}
if(isset($_POST['last_name'])) {
addProfile($_POST['last_name']);
}
if(isset($_POST['company'])) {
addProfile($_POST['company']);
}
if(isset($_POST['office_phone'])) {
addProfile($_POST['office_phone']);
}
if(isset($_POST['cell_phone'])) {
addProfile($_POST['cell_phone']);
}
if(isset($_POST['fax_num'])) {
addProfile($_POST['fax_num']);
}
if(isset($_POST['email_addr'])) {
addProfile($_POST['email_addr']);
}
if(isset($_POST['website'])) {
addProfile($_POST['website']);
}
if(isset($_POST['motto'])) {
addProfile($_POST['motto']);
}
if(isset($_POST['street_addr'])) {
addProfile($_POST['street_addr']);
}
if(isset($_POST['city'])) {
addProfile($_POST['city']);
}
if(isset($_POST['state'])) {
addProfile($_POST['state']);
}
if(isset($_POST['zip'])) {
addProfile($_POST['zip']);
}
if(isset($_POST['country'])) {
addProfile($_POST['country']);
}
if(isset($_POST['facebook_url'])) {
addProfile($_POST['facebook_url']);
}
if(isset($_POST['places_url'])) {
addProfile($_POST['places_url']);
}
if(isset($_POST['twitter_url'])) {
addProfile($_POST['twitter_url']);
}
if(isset($_POST['linkedin_url'])) {
addProfile($_POST['linkedin_url']);
}
} else {
header("Location: manage_settings.php");
}
?>
函数.php:
<?php
include('connect.php');
function getProfiles() {
$query = mysql_query("SELECT * FROM global_profiles") or die(mysql_error());
if(mysql_num_rows($query) == 0) {
echo "<center><h3><b><u>No Profiles Currently Available</u></b></h3></center>";
} else {
while($profile = mysql_fetch_assoc($query)) {
echo "<tr><td><input type=\"checkbox\" /></td><td>" . $profile['profile_name'] . "</td><td><a href=\"#\" title=\"title\">Coming Soon</a></td><td>" . $profile['profile_description'] . "</td><td>" . $profile['pid'] . "</td><td><a href=\"edit.php?pid=" . $profile['pid'] . "\" title=\"Edit\"><img src=\"images/pencil.png\" alt=\"Edit\" /></a> <a href=\"delete.php?pid=" . $profile['pid'] . "\" title=\"Delete\"><img src=\"images/cross.png\" alt=\"Delete\" /></a> <a href=\"duplicate.php?pid=" . $profile['pid'] . "\" title=\"Duplicate\"><img src=\"images/hammer_screwdriver.png\" alt=\"Duplicate\" /></a></td></tr>";
}
}
}
function deleteProfile($pid) {
$pid = (int) $pid;
mysql_query("DELETE FROM global_profiles WHERE pid = '$pid'") or die(mysql_error());
header("Location: manage_settings.php");
}
function addProfile($pid, $profile_name, $profile_description, $first_name, $last_name, $company, $office_phone, $cell_phone, $fax_num, $email_addr, $website, $motto, $city, $state, $zip, $country, $facebook_url, $places_url, $twitter_url, $linkedin_url) {
$query = mysql_query("INSERT INTO global_profiles VALUES(null,'$profile_name','$profile_description','$first_name','$last_name','$company','$office_phone','$cell_phone','$fax_num','$email_addr','$website','$motto','$city','$state','$zip','$country','$facebook_url','$places_url','$twitter_url','$linkedin_url')") or die(mysql_error());
}
?>
我要做的基本上是将新信息“保存”到我的数据库中。我已经能够通过 phpMyAdmin 手动将其添加到数据库中,然后在我的管理区域内显示信息。
非常感谢任何帮助!