Support » Plugins and Hacks » Help plz

  • Hello..

    well i’m calling a PHP file in the root of WP containing the following:

    <?php
    global $current_user;
    get_currentuserinfo();
    $userid = $current_user->description;
    
    $serverName = "****\*****"; //serverName\instanceName
    $connectionInfo = array( "Database"=>"*******", "UID"=>"****", "PWD"=>"*******");
    $conn = sqlsrv_connect( $serverName, $connectionInfo);
    
    if( $conn ) {
         echo "Connection established.<br />";
    }else{
         echo "Connection could not be established.<br />";
         die( print_r( sqlsrv_errors(), true));
    }
    $sql = "SELECT 1, 2, 3, 4 FROM cat where id='$userid';
    $stmt = sqlsrv_query( $conn, $sql );
    
    echo "<table border='1'>
    <tr>
    <th>1</th>
    <th>2</th>
    <th>3</th>
    <th>4</th>
    </tr>";
    
    while( $row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC))
     {
      echo "<tr>";
      echo "<td>" . $row['1'] . "</td>";
      echo "<td>" . $row['2'] . "</td>";
      echo "<td>" . $row['3'] . "</td>";
      echo "<td>" . $row['4'] . "</td>";
        echo "</tr>";
      }
    
    echo "</table>";
    sqlsrv_free_stmt( $stmt);
    ?>

    but its not importing the $current_user->description;

    its showing this msg:

    Fatal error: Call to undefined function get_currentuserinfo() in C:\xampp\htdocs\as\getuser.php

    what should i put in the beging so it will import this infos from the current user login

  • The topic ‘Help plz’ is closed to new replies.