mysqli_select_db()正好需要2个参数

时间:2017-07-30 15:33:40

标签: php html

我在localhost中执行我的代码,现在我想在线上传 我正在使用000webhost免费托管 当我尝试查看代码时发生以下错误。

names.flatMap(name => f(name))
List[String] = List(Benny, Danna)

我的完整代码已上传到驱动器中,链接如下所示

https://drive.google.com/open?id=0B_p3RU7WzdVjMXZWMEZIc2JKenc

任何人都可以帮助我解决错误

2 个答案:

答案 0 :(得分:0)

您没有保存mysqli_connect的结果并将其作为第一个参数传递给其他方法:

$db = mysqli_connect(...parameters omitted...);
mysqli_select_db($db, "id627165_mydb");
$result=mysqli_query($db, "select * from register where AadarNumber=$AadharNumber");

...等

答案 1 :(得分:0)

用此替换您的代码并尝试检查:

<?php
session_start();
?>  
</head>
<body>

<div style="width:1350px; height:100px; background-image:url(images/tooplate_top.png); margin-top:10px">
<div id="tooplate_titlebar">

        <div id="tooplate_menu" class="ddsmoothmenu">
        <form action="#" method="POST">
          <label style="color:#FFF; font-size:20px">Enter Adhar Number</label>&nbsp;&nbsp;&nbsp;
          <input type="text" name="AadharNumber" placeholder="Enter the Adhar Code Here" required="required" autocomplete="off"/>&nbsp;&nbsp;&nbsp;
          <input type="submit" value="Login" name="Login" />

          </form>   

    </div>   

</div>

<?php


 //$aadar=$_Session['uname'];

if($_SERVER['REQUEST_METHOD']=="POST")
{
    if(isset($_POST['Login']))
    {


$con = mysqli_connect("localhost","id627165_root","veneeth");
mysqli_select_db($con, 'id627165_mydb') or die(mysqli_error($con));


$AadharNumber=mysqli_real_escape_string($con, $_POST['AadharNumber']);

$result=mysqli_query($con, "select * from register where AadarNumber=$AadharNumber");

$row=mysqli_fetch_array($result);

if($row['AadarNumber']==$AadharNumber)
{

    print '<script>alert("Login Sucess !! Welcome ")</script>'.$row['Username'];
    $_SESSION['AadharNumber']=$AadharNumber;
    header("Location:userdetails1.php");


}
else 
{
    print '<script>alert("Failed to login")</script>';
}
    }
}
?>


        <div id="site_title" style="width: 504px; position: absolute">   
          <h2 style="color:#FFF"><br />
          <img src="images/unnamed.jpg" alt="Image 04" width="61" height="42" title="Etiam faucibus felis eget metus tempor." />

         TicketReservation</h2>
        </div>
</div>

    <div id="tooplate_mid_wrapper">
        <div id="tooplate_mid_home">

            <div id="slider-wrapper">

                <div id="slider" class="nivoSlider">
                    <img src="images/new.jpg" style="height:250" />

                </div>
                <div id="htmlcaption" class="nivo-html-caption">
                    <strong>This</strong> is an example of a HTML caption with <a h ref="#">a link</a>.
                </div>

            </div>
                <script type="text/javascript" src="js/jquery-1.4.3.min.js"></script>
                <script type="text/javascript" src="js/jquery.nivo.slider.js"></script>
                <script type="text/javascript">
                $(window).load(function() {
                    $('#slider').nivoSlider();
                });
                </script>

            <div id="mid_left">
                <div id="mid_title" style="margin-left:100px; margin-top:-50px; height:500px; width:400px">
                <div style="margin-left:350px; position:absolute">
                 <a href="admin.php"><img src="images/admin_icon.png" width="75" height="75" /></a>
                 </div>
                <br /> <br /> <br /> <br /> 
                &nbsp; &nbsp; 
                <label style="color:#000">Signup For Free!!!</label>

                 <br /> <br />
             <form name="regform" action="#" method="POST">   
              <label style="color:#000; font-size:20px"> Adhar Number</label>&nbsp;&nbsp;&nbsp;<input type="text" name="aadarnum" placeholder="Enter Adhar Number" required="required" autocomplete="off" />
              <br /><br />

               <label style="color:#000; font-size:20px"> Mobile Number</label>&nbsp;&nbsp;&nbsp;<input type="text" name="mobnum" placeholder="Enter 10 digit Number" required="required" autocomplete="off"/>
               <br /><br />
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               <input type="submit" value="Submit" name="submit1" />

                </form>
                   </div>




<?php


    if($_SERVER['REQUEST_METHOD']=="POST")
    {
        if(isset($_POST['submit1']))
        {

    $con = mysqli_connect("localhost","id627165_root","veneeth");
    mysqli_select_db($con, 'id627165_mydb') or die(mysqli_error($con));

    $MobileNumber=mysqli_real_escape_string($con, $_POST['mobnum']);
    $AadharNumber=mysqli_real_escape_string($con, $_POST['aadarnum']);
    $bool=true;
    $ros=false;
    $mob=false;


    $query=mysqli_query($con, "select * from aadardetails where AadharNumber=$AadharNumber");
    $numb=mysqli_num_rows($query);
        if($numb>=1)
        {
            $query1=mysqli_query($con, "Select * from register where MobileNumber=$MobileNumber");
            $norows=mysqli_num_rows($query1);
            if($norows>=1)
            {   
                $bool=false;
                $mob=true;
            }
        }
        else
        {
            $bool=false;
            $ros=true;
        }


    if($ros)
    {
            print '<script>alert("Aadhar Number Does not Exist in the database")</script>';
    }
if($bool)
{

    mysqli_query($con, "insert INTO register(MobileNumber,AadarNumber) values ($MobileNumber,$AadharNumber)");
    print '<script>alert("registered Sucessfully")</script>';
    print '<script>window.location.assign(register.php)</script>';

}
if($bool)
{

    print '<script>window.location.assign(register.php)</script>';
}


    }
        }       
        ?>

</body>