Jump to content
  • 0

OLD themes php to new php


Takuyakii

Question


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

Good day rA,

 

can someone help me to fix this error about query? i already googled some and fix the other error but this error, i can't fix it
 

MYSQLI_FETCH_ARRAY() EXPECT PARAMETER 1 to be MYSQLI_Result object given

 

below is my code 

<?php if (!defined('FLUX_ROOT')) exit; ?>
<?php
		
//SQL Connection
function Connection()
{
$db_host="127.0.0.1"; //insert the IP Address of your website
$db_name="rathena"; //insert your database name insid the 2 double quotesS
$username="zxc"; //insert the username of your phpmyadmin (SQL username)
$password="zxc"; //insert the password of your phpmyadmin (SQL password)
$conn = mysqli_connect($db_host,$username,$password);


    if (!$conn) {
        echo "Connection failed!";

        return false;
    }

    mysqli_select_db($conn, $db_name);

    return $conn;
}

$conn = Connection();

if ($conn)
{
    $hpsql = mysqli_query($conn, "SELECT * FROM cp_onlinepeak ORDER BY users DESC LIMIT 1");
    $hprow = mysqli_fetch_array($conn,$hpsql);

    
    echo $hprow['users'];
}

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.02
  • Content Count:  206
  • Reputation:   10
  • Joined:  08/30/19
  • Last Seen:  

3 hours ago, Takuyakii said:

Good day rA,

 

can someone help me to fix this error about query? i already googled some and fix the other error but this error, i can't fix it
 

MYSQLI_FETCH_ARRAY() EXPECT PARAMETER 1 to be MYSQLI_Result object given

 

below is my code 


<?php if (!defined('FLUX_ROOT')) exit; ?>
<?php
		
//SQL Connection
function Connection()
{
$db_host="127.0.0.1"; //insert the IP Address of your website
$db_name="rathena"; //insert your database name insid the 2 double quotesS
$username="zxc"; //insert the username of your phpmyadmin (SQL username)
$password="zxc"; //insert the password of your phpmyadmin (SQL password)
$conn = mysqli_connect($db_host,$username,$password);


    if (!$conn) {
        echo "Connection failed!";

        return false;
    }

    mysqli_select_db($conn, $db_name);

    return $conn;
}

$conn = Connection();

if ($conn)
{
    $hpsql = mysqli_query($conn, "SELECT * FROM cp_onlinepeak ORDER BY users DESC LIMIT 1");
    $hprow = mysqli_fetch_array($conn,$hpsql);

    
    echo $hprow['users'];
}

 

Solved. please close this threads thank you.

Link to comment
Share on other sites

×
×
  • Create New...