Jump to content
The forums will be going offline for an extended maintenance period at 1400hrs GMT on 19th June 2025. The number of hours for this downtime is intentionally not advertised due to the nature of these upgrades. ×
  • 0

OLD themes php to new php


Takuyakii

Question


  • Group:  Members
  • Topic Count:  41
  • Topics Per Day:  0.02
  • Content Count:  215
  • Reputation:   11
  • 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:  41
  • Topics Per Day:  0.02
  • Content Count:  215
  • Reputation:   11
  • 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...