www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Use a variable in php row output

  1. #1
    Join Date
    Apr 2010
    Posts
    62

    resolved [RESOLVED] Use a variable in php row output

    Hi, I'm trying to use a posted column name to output it's contents. It's hard for me to explain, so maybe the code below will speak better.

    PHP Code:
    $field $_POST['id']; // this is the column name posted from another page
    $commanda "SELECT * FROM users WHERE userid = '$_SESSION[user_id]'";
    $resulta mysqli_query($mysqli$commanda) or die('error');
    echo 
    $resulta[$field]; // the line in question 
    throws the error:
    Fatal error: Cannot use object of type mysqli_result as array

  2. #2
    Join Date
    Apr 2010
    Posts
    62
    Never mind, I changed it to mysql_query instead of mysqli_query and it works. go figure

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles