dspym82000 2013-01-19 09:08 采纳率: 100%
浏览 27

警告:缺少addProfile()的参数2

I know there are already quite a few articles on SE about "Warning: Missing argument 2 for" questions, although I couldn't really seem to find an answer (even after looking over all of the other questions several times).

First Error Set: http://i.stack.imgur.com/HTySO.png

Second Error Set: http://i.stack.imgur.com/wDwxm.png

(I tried posting as SE images, but since I'm new it wouldn't let me)

Those are the two errors I'm currently getting 20 times (I have 20 different fields for the database, it's a "profile" section).

I've spent the better half of two hours trying to figure out why it's not working but I'm clueless.

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");
    }
?>

functions.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());
}
?>

What I'm trying to do is basically "save" new information to my database. I've been able to manually add it into the database via phpMyAdmin, then display the information inside my admin area.

Any assistance is much appreciated!

  • 写回答

1条回答 默认 最新

  • dream04110 2013-01-19 09:17
    关注

    Modify your addProfile() to:

    function addProfile($post) {
    
        // Here check wether you have certain post array key set and add it to query
    
    }
    

    and use it as :

    if(isset($_POST['profile_name'])) {
    
          addProfile($_POST);
    
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测