Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Mar 2012
    Posts
    55
    Member #
    31209

    OK...Warning: mysqli_query() expects at least 2 parameters, 1 given in xxx.xxx.xx

    Warning: mysqli_query() expects at least 2 parameters, 1 given in xxx/xxx/xxx/xxx/equipment.php on line 56

    OK. Different problem then yesterday, but it is still in the same category. As you can see, they are different codes for something the functions basically the same, but this one has more features if I add the other pages from the tutorial. I get the error above with the php code below. I cant figure out what the problem is.

    Thanks!

    Code:
    Code:
    <?php 
         Line 56-----if ($result = mysqli_query("SELECT * FROM equipment"));
                            
    {
                                    // display records if there are records to display
                                    if ($result->num_rows > 0)
                                    {
                                            // display records in a table
                                            echo "<table border='1' cellpadding='10'>";
                                            
                                            // set table headers
                                            echo "<tr><th>ID</th><th>First Name</th><th>Last Name</th><th></th><th></th></tr>";
                                            
                                            while ($row = $result->fetch_object())
                                            
                                            {
                                                    // set up a row for each record
                                                    echo "<tr>";
                                                    echo "<td>" . $row->id . "</td>";
                                                    echo "<td>" . $row->name . "</td>";
                                                    echo "<td>" . $row->type . "</td>";
                                                    echo "<td>" . $row->out . "</td>";
                                                    echo "<td>" . $row->outbywho . "</td>";
                                                    echo "<td><a href='records.php?id=" . $row->id . "'>Edit</a></td>";
                                                    echo "<td><a href='delete.php?id=" . $row->id . "'>Delete</a></td>";
                                                    echo "</tr>";
                                            }
                                            
                                            echo "</table>";
                                    }
                                    // if there are no records in the database, display an alert message
                                    else
                                    {
                                            echo "No results to display!";
                                    }
                            }
    
                           
                           
     ?>
    Thanks

  2.  

  3. #2
    Junior Member
    Join Date
    Aug 2013
    Posts
    1
    Member #
    36936
    Hi, Yoshee.

    The problem is in the line:

    if ($result = mysqli_query("SELECT * FROM equipment"));

    the function mysqli_query needs two parameters, the first being the value returned by mysqli_connect();

    Like this:

    $link = mysqli_connect($server, $username, $password, $db_name);

    $result = mysqli_query($link, "SELECT * FROM equipment");

    Please try it out and let me know if it was helpful.

    Ken

  4. #3
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    MySQLi is different than MySQL, so be careful which online tutorials you are looking at. Lots of similarities, but small quirky things like Ken mentioned.



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

mysqli query expects 2 parameters
,
mysqli query expects at least 2 parameters
,
ok xxx
,

wwwxxxok

,
wwwxxxokk
,

xxx ok

,
xxx xxx ok
,

xxx-ok

,
xxx-ok 1
,
xxxokvideo
Click on a term to search for related topics.
All times are GMT -6. The time now is 02:31 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com