I'm very a new comer to PHP and seeking to choose data from the MySQL area (inside a table). I made use of the next query.
$token = $wpdb->query("SELECT ami_st_token_aut FROM $wpdb->users WHERE ID = '".$current_user->ID."' ");
The worthiness within the ami_st_token_aut is really a large number however when i echo $token, it's echoing out
$current_user->ID rather than the large token number. What is failing?
Two methods for doing the work.
If you are doing the work with WordPress, make use of the
$token = $wpdb->get_var( $wpdb->prepare( "SELECT ami_st_token_aut FROM $wpdb->users WHERE ID=%d", $current_user->ID ) );
If you are doing the work without Wordpress, make use of the
mysql_query( "SELECT ami_st_token_aut FROM tablename WHERE ID='" . mysql_real_escape_string($ID) . "'" );
See the Wordpress Codex.
$wpdb->query function returns the amount of rows that matched up your query (should you perform a Choose, anyway).
$wpdb->get_var may be the function to make use of to obtain a single value in the database.
See this http://www.w3schools.com/php/php_mysql_select.asp about query execution