Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help in PHP Code Please

    Hi All,

    I need your help in below mention code. How can i convert mysql_result to mysqli_result. I have no knowledge of PHP. Just trying to learn.

    I got this error-->

    Warning: mysql_result() expects parameter 1 to be resource, object given in D:\wamp\www\DBMS\login\include\view_active.php on line 18

    Please help.

    <code>
    <?php
    if(!defined('TBL_ACTIVE_USERS')) {
    die("Error processing page");
    }

    $q = "SELECT username FROM ".TBL_ACTIVE_USERS
    ." ORDER BY timestamp DESC,username";
    $result = $database->query($q);
    /* Error occurred, return given name by default */
    $num_rows = mysqli_num_rows($result);
    if(!$result || ($num_rows < 0)){
    echo "Error displaying info";
    }
    elseif($num_rows > 0){
    /* Display active users, with link to their info */
    echo "<br/>Users Online:<br/>";
    for($i=0; $i<$num_rows; $i++){
    $uname = mysql_result($result,$i,"username"); // line 18
    if($session->logged_in){
    echo "<a href=\"userinfo.php?user=$uname\">$uname</a><br/> ";

    }
    else{
    echo "$uname<br/>";

    }
    }
    }
    ?>
    </code>

  • #2
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Please help me guys.......


  •  

    Tags for this Thread

    Posting Permissions

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