mysqli_query()需要参数1 [英] mysqli_query() expects parameter 1

查看:71
本文介绍了mysqli_query()需要参数1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

警告:mysqli_query()期望参数1为mysqli,第30行的C:\ xampp \ htdocs \ iapdone2_myprofile.php中提供的资源

Warning: mysqli_query() expects parameter 1 to be mysqli, resource given in C:\xampp\htdocs\iapdone2_myprofile.php on line 30

警告:mysqli_fetch_array()期望参数1为mysqli_result, 在第32行的C:\ xampp \ htdocs \ iapdone2_myprofile.php中给出的空值

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in C:\xampp\htdocs\iapdone2_myprofile.php on line 32

注意:未定义的索引:C:\ xampp \ htdocs \ 22_myprofile.php中的地址 在第37行

Notice: Undefined index: address in C:\xampp\htdocs\22_myprofile.php on line 37

注意:未定义索引:C:\ xampp \ htdocs \ 22_myprofile.php中的性别 在第41行

Notice: Undefined index: gender in C:\xampp\htdocs\22_myprofile.php on line 41

    <html>          <div id="myProfile">
                <?php
                    if(($_SERVER["REQUEST_METHOD"] == "POST") and (isset($_POST['editProfile'])))
                    {


                        include 'opendatabase.php';

                        $updateUserDetails="UPDATE users SET email='".$_POST['email']."',address='".$_POST['address']."',gender='".$_POST['gender']."' WHERE username='".$_SESSION['ID']."'";

                        //mysqli_query($connection,$updateUserDetails) or die(mysqli_error($connection));

                        include 'closedatabase.php';

                        header("Refresh: 0; url=userProfile.php");
                    }//endif

                ?>
                    <h2>Personal Details</h2>
                    <hr/>
                    <form action="<?php echo 'userProfile.php';?>" method="POST" onsubmit="return profileValidation()" enctype="multipart/form-data">
                    <table id="profileDetails">
                        <tr>
                        <?php

                            include 'opendatabase.php';?>
                            <?php
                            $personalDetails="SELECT email,description,address,gender,join_date FROM users WHERE username='".$_SESSION['ID']."'";

                            $getPersonalDetails=mysqli_query($connection,$personalDetails);

                            $rowPersonalDetails=mysqli_fetch_array($getPersonalDetails);
                            if($rowPersonalDetails['email']==NULL)
                            {
                                $rowPersonalDetails['email']="-";
                            }
                            if($rowPersonalDetails['address']==NULL)
                            {
                                $rowPersonalDetails['address']="-";
                            }
                            if($rowPersonalDetails['gender']==NULL)
                            {
                                $rowPersonalDetails['gender']="-";
                            }

                        ?>

                        </tr>
                        <tr>
                            <td>Username:</td>
                            <td><?php echo $_SESSION['ID'];?><hr/></td>
                        </tr>
                        <tr>
                            <td>Email:</td>
                            <td><?php echo $rowPersonalDetails['email'];?><hr/></td>
                        </tr>
                        <tr>
                            <td>Address:</td>
                            <td><?php echo $rowPersonalDetails['address'];?><hr/></td>
                        </tr>
                        <tr>
                            <td>Gender:</td>
                            <td><?php echo $rowPersonalDetails['gender'];?><hr/></td>
                        </tr>
                        <tr>
                            <td>Join Date:</td>
                            <td><?php echo $rowPersonalDetails['join_date'];?><hr/></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><input type="button" onclick="editProfile()" value="Edit"></td>
                        </tr>
                    </table>
                    </form>
                </div>

推荐答案

您可能同时使用了mysql和mysqli函数.坚持使用mysqli函数.确保您没有混淆那些功能

You might be using both mysql and mysqli functions. Stick to mysqli function. Make sure that you did not mix up those functions

这篇关于mysqli_query()需要参数1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆