• im trying to write a function and i keep getting a mysql sytax error.
    heres the part that isnt working:
    ‘code’
    $name = $wpdb->get_results(“SELECT (user_login) FROM $tableusers WHERE user_id = $id”);
    ‘code’
    obviously its suposed to get a users login name from the wp_users table where the user_id is some number.
    i have the global vaiables defined at the top like this:
    global $wpdb, $tableusers;
    so can someone rewrite that line for me?

Viewing 2 replies - 1 through 2 (of 2 total)
  • What error are you getting?
    I believe you probably also want to use get_var(…) instead of get_results.
    get_results will return an array. (I’m pretty sure)

    Thread Starter esgaroth

    (@esgaroth)

    i knew i was doing something dumb like that. thanks, it works now.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘mysql syntax error, help please.’ is closed to new replies.