Ready to get started?Download WordPress


Help plz (1 post)

  1. mrhussein
    Posted 1 year ago #


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

    global $current_user;
    $userid = $current_user->description;
    $serverName = "****\*****"; //serverName\instanceName
    $connectionInfo = array( "Database"=>"*******", "UID"=>"****", "PWD"=>"*******");
    $conn = sqlsrv_connect( $serverName, $connectionInfo);
    if( $conn ) {
         echo "Connection established.<br />";
         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'>
    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

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.